diff --git a/function/ui_compare_rh/README.md b/function/ui_compare_rh/README.md new file mode 100644 index 0000000000000000000000000000000000000000..c4522b53d50850a5eeee1376030ef71e71d67665 --- /dev/null +++ b/function/ui_compare_rh/README.md @@ -0,0 +1,136 @@ +# UI对比测试开发指南 + +## 0、需求(文本用例) + +用例举例,开发如下用例: + +| 用例_名称 | 用例_编号 | 创建版本 |预置条件| 测试步骤|预期结果|自动化类型| +|-----|------|-------|------|------|------|------| +| 文本样式fontColor:Color类型 | SUB_ACE_UI_ATTRIBUTES_FONT_INTERFACE_0010 | OpenHarmony V400R001 |新建eTS页面|1、添加文本组件2、设置fontColor为Color.Blue 3、编译测试demo|3、编译通过,文本显示蓝色|UI对比| + +## 1、编写工程和代码 + +### 1.1 新建或导入已有工程,创建目录和页面 + +以从DevEco导入本目录下的uicompare工程为例: + +在testability目录下创建页面,命名规则,用例编号除数字外,相同的用例在pages下创建一个同名子目录,每个编号的用例创建一个ets文件,文件名采用大驼峰如下: + +![image](figures/1.png) + +### 1.2 创建测试用例目录和文件 + +在test目录下创建用例目录,目录名称和2\.1中的页面相同并在后面加Test,用例文件和页面ets文件相同,后缀多了\.test,如下图: + +![image](figures/2.png) + +### 1.3 编写页面 + +按用例要求编写页面,创建文本组件,并设置颜色为Blue。 + +结构名称和文件名相同,组件需要设置id的,使用本文件名加"_001"按递增使用,避免和别的文件中的id重名。 + +![image](figures/3.png) + +### 1.4 编写用例 + +修改类名,注释,测试套名称,用例名称,和测试用例文件及用例文档中对应,修改调用的页面文件路由,和页面路径对应: + +![image](figures/4.png) + +![image](figures/5.png) + +### 1.5 在List.test.ets中添加测试套和页面路由 +注意:这里的页面是写在ohosTest模块下,不要写到main模块里。 + +![image](figures/6.png) + +![image](figures/7.png) + +## 2、编译运行 +### 2.1 编译 + +因为工程使用了截屏接口,需要系统权限,在SDK的sdk\12\toolchains\lib\UnsgnedReleasedProfileTemplate.json文件中修改应用级别:"apl":"system_core", +"app-feature":"hos_system_app"。 + +在IDE的file -> Project Structure 中自动签名: + +![image](figures/8.png) + +Build-> Rebuild 编译hap: + +![image](figures/9.png) + +### 2.2 执行用例 +右键xxxxx.test.ets 文件执行用例,或右键test目录执行全部用例: + +![image](figures/10.png) + +观察设备是否正常显示测试页面,显示了蓝色的文字: + +![image](figures/11.png) + +测试结果: + +![image](figures/12.png) + +### 2.3 检查截屏图片: + +![image](figures/13.png) + +用hdc从设备拉取截屏图片: + +![image](figures/14.png) + +打开检查截图是否正确: + +![image](figures/15.png) + +用例开发完成,且调试成功。 + +## 3、对比UI图片 + +使用uicompare_tools目录下的python对比工具脚本。 + +使用对比脚本前需要安装python环境,安装依赖包:需安装三个包:openpyxl、numpy、pillow。 + +hdc配置到系统环境变量。 + +### 3.1 将编译的hap包拷贝到ui对比工具的hap目录下 + +![image](figures/16.png) + +![image](figures/17.png) + +### 3.2 在excel表中添加测试用例 + +excel文件名和hap名必须相同,一个excel对应一个hap。 + +![image](figures/18.png) + +![image](figures/19.png) + +### 3.3 生成基线图片: + +![image](figures/20.png) + +![image](figures/21.png) + +### 3.4 对此测试 + +指定基线图片目录和上中路径一致: + +![image](figures/22.png) + +测试显示用例执行通过: + +![image](figures/23.png) + +### 3.5 测试报告 + +![image](figures/24.png) + +![image](figures/25.png) + + + diff --git a/function/ui_compare_rh/figures/1.png b/function/ui_compare_rh/figures/1.png new file mode 100644 index 0000000000000000000000000000000000000000..5424b7902c69330ffe5f6dd97aadefda3091164f Binary files /dev/null and b/function/ui_compare_rh/figures/1.png differ diff --git a/function/ui_compare_rh/figures/10.png b/function/ui_compare_rh/figures/10.png new file mode 100644 index 0000000000000000000000000000000000000000..a3e91a1b1164e13c1a4032e9ec4619944a533e5f Binary files /dev/null and b/function/ui_compare_rh/figures/10.png differ diff --git a/function/ui_compare_rh/figures/11.png b/function/ui_compare_rh/figures/11.png new file mode 100644 index 0000000000000000000000000000000000000000..7dbbbb8680139cc82151b17593d7fd2bd5e42402 Binary files /dev/null and b/function/ui_compare_rh/figures/11.png differ diff --git a/function/ui_compare_rh/figures/12.png b/function/ui_compare_rh/figures/12.png new file mode 100644 index 0000000000000000000000000000000000000000..4ccf7d44417f7d93f94ddda5b18be9517348269f Binary files /dev/null and b/function/ui_compare_rh/figures/12.png differ diff --git a/function/ui_compare_rh/figures/13.png b/function/ui_compare_rh/figures/13.png new file mode 100644 index 0000000000000000000000000000000000000000..2024a8115867c326dee5efaa621ce962521f434a Binary files /dev/null and b/function/ui_compare_rh/figures/13.png differ diff --git a/function/ui_compare_rh/figures/14.png b/function/ui_compare_rh/figures/14.png new file mode 100644 index 0000000000000000000000000000000000000000..633a80c80bc310cd66deb08f2473918db9ba2eb7 Binary files /dev/null and b/function/ui_compare_rh/figures/14.png differ diff --git a/function/ui_compare_rh/figures/15.png b/function/ui_compare_rh/figures/15.png new file mode 100644 index 0000000000000000000000000000000000000000..08c41aa20d552bfaddd2a40e90ea4eafc0fbadc3 Binary files /dev/null and b/function/ui_compare_rh/figures/15.png differ diff --git a/function/ui_compare_rh/figures/16.png b/function/ui_compare_rh/figures/16.png new file mode 100644 index 0000000000000000000000000000000000000000..61a4c79840404a664181de7eaab0637b38c9f9b2 Binary files /dev/null and b/function/ui_compare_rh/figures/16.png differ diff --git a/function/ui_compare_rh/figures/17.png b/function/ui_compare_rh/figures/17.png new file mode 100644 index 0000000000000000000000000000000000000000..b3c346c1220ee4529f0b60752b9996e16485617d Binary files /dev/null and b/function/ui_compare_rh/figures/17.png differ diff --git a/function/ui_compare_rh/figures/18.png b/function/ui_compare_rh/figures/18.png new file mode 100644 index 0000000000000000000000000000000000000000..68d8881e20e301488b1cd85fb33bf3b106dad5c7 Binary files /dev/null and b/function/ui_compare_rh/figures/18.png differ diff --git a/function/ui_compare_rh/figures/19.png b/function/ui_compare_rh/figures/19.png new file mode 100644 index 0000000000000000000000000000000000000000..ac58da7cc49e6f0957fbadc50a1927becfc4e2c9 Binary files /dev/null and b/function/ui_compare_rh/figures/19.png differ diff --git a/function/ui_compare_rh/figures/2.png b/function/ui_compare_rh/figures/2.png new file mode 100644 index 0000000000000000000000000000000000000000..6c3dde1577ddb12f63061e4ddfd380d1f32d167a Binary files /dev/null and b/function/ui_compare_rh/figures/2.png differ diff --git a/function/ui_compare_rh/figures/20.png b/function/ui_compare_rh/figures/20.png new file mode 100644 index 0000000000000000000000000000000000000000..f1168f94ca1a07da6b8d4573040f440e19a37811 Binary files /dev/null and b/function/ui_compare_rh/figures/20.png differ diff --git a/function/ui_compare_rh/figures/21.png b/function/ui_compare_rh/figures/21.png new file mode 100644 index 0000000000000000000000000000000000000000..62c5318d417bd4616d52857c7661c12a768f840e Binary files /dev/null and b/function/ui_compare_rh/figures/21.png differ diff --git a/function/ui_compare_rh/figures/22.png b/function/ui_compare_rh/figures/22.png new file mode 100644 index 0000000000000000000000000000000000000000..03ce77ab89e45415079f6239d53cde66e1bbc37a Binary files /dev/null and b/function/ui_compare_rh/figures/22.png differ diff --git a/function/ui_compare_rh/figures/23.png b/function/ui_compare_rh/figures/23.png new file mode 100644 index 0000000000000000000000000000000000000000..8efdb1a39de83730abec3a4b7f0f5fb740c2389a Binary files /dev/null and b/function/ui_compare_rh/figures/23.png differ diff --git a/function/ui_compare_rh/figures/24.png b/function/ui_compare_rh/figures/24.png new file mode 100644 index 0000000000000000000000000000000000000000..ba25f3a4b3ba91274b7eccf5051a158261b23a55 Binary files /dev/null and b/function/ui_compare_rh/figures/24.png differ diff --git a/function/ui_compare_rh/figures/25.png b/function/ui_compare_rh/figures/25.png new file mode 100644 index 0000000000000000000000000000000000000000..5277cf722abb4f1d7943c2deffaf90e4d33dab39 Binary files /dev/null and b/function/ui_compare_rh/figures/25.png differ diff --git a/function/ui_compare_rh/figures/3.png b/function/ui_compare_rh/figures/3.png new file mode 100644 index 0000000000000000000000000000000000000000..f67097e20179919a3ff91dd8c6c209773538a1cb Binary files /dev/null and b/function/ui_compare_rh/figures/3.png differ diff --git a/function/ui_compare_rh/figures/4.png b/function/ui_compare_rh/figures/4.png new file mode 100644 index 0000000000000000000000000000000000000000..fb62a3cf06c8afe812c7caebef4d2283a3e46e13 Binary files /dev/null and b/function/ui_compare_rh/figures/4.png differ diff --git a/function/ui_compare_rh/figures/5.png b/function/ui_compare_rh/figures/5.png new file mode 100644 index 0000000000000000000000000000000000000000..b728087c47ad5e2f7ef28dc1de3566165b1604ce Binary files /dev/null and b/function/ui_compare_rh/figures/5.png differ diff --git a/function/ui_compare_rh/figures/6.png b/function/ui_compare_rh/figures/6.png new file mode 100644 index 0000000000000000000000000000000000000000..ba08042c823ef71f49e76a4b3e1ea812d5c8432f Binary files /dev/null and b/function/ui_compare_rh/figures/6.png differ diff --git a/function/ui_compare_rh/figures/7.png b/function/ui_compare_rh/figures/7.png new file mode 100644 index 0000000000000000000000000000000000000000..276823adc1fa505f57d4059d768357654fc9d992 Binary files /dev/null and b/function/ui_compare_rh/figures/7.png differ diff --git a/function/ui_compare_rh/figures/8.png b/function/ui_compare_rh/figures/8.png new file mode 100644 index 0000000000000000000000000000000000000000..93d2547bf903a0b37a8b8f6706789558b95bcea2 Binary files /dev/null and b/function/ui_compare_rh/figures/8.png differ diff --git a/function/ui_compare_rh/figures/9.png b/function/ui_compare_rh/figures/9.png new file mode 100644 index 0000000000000000000000000000000000000000..5ab1b3c96fb2d320093889235d364fc651e2238b Binary files /dev/null and b/function/ui_compare_rh/figures/9.png differ diff --git a/function/ui_compare_rh/uicompare/.gitignore b/function/ui_compare_rh/uicompare/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..fbabf771011fe78f9919db0b1195ab6cadffc2b0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/.gitignore @@ -0,0 +1,11 @@ +/node_modules +/oh_modules +/local.properties +/.idea +**/build +/.hvigor +.cxx +/.clangd +/.clang-format +/.clang-tidy +**/.test \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/AppScope/app.json5 b/function/ui_compare_rh/uicompare/AppScope/app.json5 new file mode 100644 index 0000000000000000000000000000000000000000..eabf71557eadee20c8a9913b10b8e25e6e5347a4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.example.uicompare", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/function/ui_compare_rh/uicompare/AppScope/resources/base/element/string.json b/function/ui_compare_rh/uicompare/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c102b07cf38bd502d548f44266affbd1267ade12 --- /dev/null +++ b/function/ui_compare_rh/uicompare/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "uicompare" + } + ] +} diff --git a/function/ui_compare_rh/uicompare/AppScope/resources/base/media/app_icon.png b/function/ui_compare_rh/uicompare/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/function/ui_compare_rh/uicompare/AppScope/resources/base/media/app_icon.png differ diff --git a/function/ui_compare_rh/uicompare/build-profile.json5 b/function/ui_compare_rh/uicompare/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..25255c09b22c8ee5c92dd996d086837b3ccb6982 --- /dev/null +++ b/function/ui_compare_rh/uicompare/build-profile.json5 @@ -0,0 +1,29 @@ +{ + "app": { + "signingConfigs": [ + ], + "products": [ + { + "name": "default", + "signingConfig": "default", + "compileSdkVersion": 12, + "compatibleSdkVersion": 12, + "runtimeOS": "OpenHarmony" + } + ] + }, + "modules": [ + { + "name": "entry", + "srcPath": "./entry", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/.gitignore b/function/ui_compare_rh/uicompare/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/oh_modules +/.preview +/build +/.cxx +/.test \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/build-profile.json5 b/function/ui_compare_rh/uicompare/entry/build-profile.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f8f03407f77914b43168aeca6bb0929efd6700b4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/build-profile.json5 @@ -0,0 +1,13 @@ +{ + "apiType": 'stageMode', + "buildOption": { + }, + "targets": [ + { + "name": "default" + }, + { + "name": "ohosTest", + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/hvigorfile.ts b/function/ui_compare_rh/uicompare/entry/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..80e4ec5b81689f238c34614b167a0b9e9c83e8d9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { hapTasks } from '@ohos/hvigor-ohos-plugin'; diff --git a/function/ui_compare_rh/uicompare/entry/oh-package.json5 b/function/ui_compare_rh/uicompare/entry/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..225946cb11a2c405c8dc81eea89c22f923556638 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/oh-package.json5 @@ -0,0 +1,10 @@ +{ + "license": "", + "devDependencies": {}, + "author": "", + "name": "entry", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dependencies": {} +} diff --git a/function/ui_compare_rh/uicompare/entry/src/main/ets/entryability/EntryAbility.ts b/function/ui_compare_rh/uicompare/entry/src/main/ets/entryability/EntryAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c239c7738e12c1bc2e5a24b151d2ec5842e760ec --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/main/ets/entryability/EntryAbility.ts @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UIAbility from '@ohos.app.ability.UIAbility'; +import hilog from '@ohos.hilog'; +import window from '@ohos.window'; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + // Main window is created, set main page for this ability + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/Index', (err, data) => { + if (err.code) { + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/main/ets/pages/Index.ets b/function/ui_compare_rh/uicompare/entry/src/main/ets/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0e4b0390777d039b0993caeeff4c0deab3384c57 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/main/ets/pages/Index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/main/module.json5 b/function/ui_compare_rh/uicompare/entry/src/main/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..9b07af70a189c0165e30b9f4bedc3bfd22b53cda --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/main/module.json5 @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "description": "$string:module_desc", + "mainElement": "EntryAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "EntryAbility", + "srcEntry": "./ets/entryability/EntryAbility.ts", + "description": "$string:EntryAbility_desc", + "icon": "$media:icon", + "label": "$string:EntryAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/main/resources/base/element/color.json b/function/ui_compare_rh/uicompare/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/main/resources/base/element/string.json b/function/ui_compare_rh/uicompare/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/main/resources/base/media/icon.png b/function/ui_compare_rh/uicompare/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/main/resources/base/media/icon.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/main/resources/base/profile/main_pages.json b/function/ui_compare_rh/uicompare/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/Index" + ] +} diff --git a/function/ui_compare_rh/uicompare/entry/src/main/resources/en_US/element/string.json b/function/ui_compare_rh/uicompare/entry/src/main/resources/en_US/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f94595515a99e0c828807e243494f57f09251930 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/main/resources/en_US/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "module description" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/main/resources/zh_CN/element/string.json b/function/ui_compare_rh/uicompare/entry/src/main/resources/zh_CN/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..597ecf95e61d7e30367c22fe2f8638008361b044 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/main/resources/zh_CN/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_desc", + "value": "模块描述" + }, + { + "name": "EntryAbility_desc", + "value": "description" + }, + { + "name": "EntryAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/2.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/2.png new file mode 100644 index 0000000000000000000000000000000000000000..382ac7dc322871219388ca27f7c637447e8c9e77 Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/2.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/cat.jpg b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/cat.jpg new file mode 100644 index 0000000000000000000000000000000000000000..382ac7dc322871219388ca27f7c637447e8c9e77 Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/cat.jpg differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/Ability.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..76e140bc60b9e19df3e40c0c70b172198360e76b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/Ability.test.ets @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2024 Huawei Device 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function abilityTest() { + describe('ActsAbilityTest', () => { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(() => { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }); + beforeEach(() => { + // Presets an action, which is performed before each unit test case starts. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: preset action function. + }); + afterEach(() => { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }); + afterAll(() => { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }); + it('assertContain', 0, () => { + // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. + hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); + let a = 'abc'; + let b = 'b'; + // Defines a variety of assertion methods, which are used to declare expected boolean conditions. + expect(a).assertContain(b); + expect(a).assertEqual(a); + }); + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventAttributeModifier/ActionEventAttributeModifier.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventAttributeModifier/ActionEventAttributeModifier.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1edce6c5281998bac1a48bee37e36faae36a7ca4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventAttributeModifier/ActionEventAttributeModifier.test.ets @@ -0,0 +1,317 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON, PointerMatrix } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' +import i18n from '@ohos.i18n' + +export default function ActionEventAttributeModifier() { + + describe('ActionEventAttributeModifier', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + 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_ACTION_EVENT_ATTRIBUTEMODIFIER_0040 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0040', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0040 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0040"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0040_001')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0040 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0110 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0110 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0110"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0110_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0110 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0080 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0080 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0080"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0080_001')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0080 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0060 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0060', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0060 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0060_001')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0060 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0100 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0100 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0100"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0100 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0090 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0090 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0090"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0090 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0120 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0120 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0120"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0120_001')); + await button.click(); + await Utils.sleep(500); + await driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0120 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0030 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0030 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0030_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0030 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0130 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0130 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0130_001')); + let pos = await button.getBoundsCenter(); + let info = await button.getBounds(); + await driver.mouseMoveTo({ + x: pos.x, y: info.bottom - 10 + }) + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + await button.click(); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0130 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0070 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0070', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0070 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0070 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0010 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0010 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0010_001')); + await button.click(); + await Utils.sleep(500); + let text: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0010_002')); + await text.click(); + await Utils.sleep(1000); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0010 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0050 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0050 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0050_001')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0050 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0020 + */ + it('SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0020 start.'); + Settings.createWindow("testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0020_001')); + await button.click(); + await Utils.sleep(500); + let text: Component = await driver.findComponent(ON.id('ActionEventAttributeModifier0020_002')); + await text.click(); + await Utils.sleep(1000); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_ATTRIBUTEMODIFIER_0020 finish.'); + done(); + }) + + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd6689613ff454582cc26f05706dcb80b5a2040f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface.test.ets @@ -0,0 +1,230 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON, MouseButton } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' +import i18n from '@ohos.i18n' + +export default function ActionEventCommoneventEventInterface() { + + describe('ActionEventCommoneventEventInterface', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + 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_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0030 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0030 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let stack1: Component = await driver.findComponent(ON.id('Stack1')); + let stack2: Component = await driver.findComponent(ON.id('Stack2')); + let stack3: Component = await driver.findComponent(ON.id('Stack3')); + let button1: Component = await driver.findComponent(ON.id('Button1')); + let info1 = await stack1.getBounds(); + let info2 = await stack2.getBounds(); + let info3 = await stack3.getBounds(); + let info4 = await button1.getBounds(); + await driver.mouseClick({ + x: info1.left + 10, y: info1.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info2.left + 10, y: info2.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info3.left + 10, y: info3.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info4.left + 10, y: info4.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + await stack1.click(); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0030 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0080 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0080 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0080"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let stack1: Component = await driver.findComponent(ON.id('Stack1')); + let stack2: Component = await driver.findComponent(ON.id('Stack2')); + let stack3: Component = await driver.findComponent(ON.id('Stack3')); + let button1: Component = await driver.findComponent(ON.id('Button1')); + let info1 = await stack1.getBounds(); + let info2 = await stack2.getBounds(); + let info3 = await stack3.getBounds(); + let info4 = await button1.getBounds(); + await driver.mouseClick({ + x: info1.left + 10, y: info1.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info2.left + 10, y: info2.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info3.left + 10, y: info3.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info4.left + 10, y: info4.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + await stack1.click(); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0080 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0020 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0020 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let stack1: Component = await driver.findComponent(ON.id('Stack1')); + let stack2: Component = await driver.findComponent(ON.id('Stack2')); + let stack3: Component = await driver.findComponent(ON.id('Stack3')); + let button1: Component = await driver.findComponent(ON.id('Button1')); + let info1 = await stack1.getBounds(); + let info2 = await stack2.getBounds(); + let info3 = await stack3.getBounds(); + let info4 = await button1.getBounds(); + await driver.mouseClick({ + x: info1.left + 10, y: info1.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info2.left + 10, y: info2.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info3.left + 10, y: info3.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info4.left + 10, y: info4.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + await stack1.click(); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0020 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0170 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0170', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0170 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0170"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let stack1: Component = await driver.findComponent(ON.id('Stack1')); + let stack2: Component = await driver.findComponent(ON.id('Stack2')); + let stack3: Component = await driver.findComponent(ON.id('Stack3')); + let button1: Component = await driver.findComponent(ON.id('Button1')); + let info1 = await stack1.getBounds(); + let info2 = await stack2.getBounds(); + let info3 = await stack3.getBounds(); + let info4 = await button1.getBounds(); + await driver.mouseClick({ + x: info1.left + 10, y: info1.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info2.left + 10, y: info2.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info3.left + 10, y: info3.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(500); + await driver.mouseClick({ + x: info4.left + 10, y: info4.top + 10 + }, MouseButton.MOUSE_BUTTON_LEFT); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + await stack1.click(); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_EVENT_INTERFACE_0170 finish.'); + done(); + }) + + + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..28ee1bf33f13b6f30c676b413516bc1ac9d540fa --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault.test.ets @@ -0,0 +1,888 @@ +/* + * + * * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON } from '@ohos.UiTest' +import { Rect } from '@ohos.graphics.scene' +import uiAppearance from '@ohos.uiAppearance' +import i18n from '@ohos.i18n' + +export default function ActionEventCommoneventFocusDefault() { + + describe('ActionEventCommoneventFocusDefault', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + 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_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0020 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0020', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0020 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0020"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + input_1.click(); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(1000); + let input_2: Component = await driver.findComponent(ON.id('Input_2')); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + input_2.click(); + await Utils.sleep(1000); + botton_2.click() + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0020 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0030 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0030', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0030 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0030"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + botton_1.click(); + await Utils.sleep(1000); + botton_2.click() + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0030 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0040 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0040', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0040 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0040"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + botton_1.click(); + await Utils.sleep(1000); + botton_2.click() + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0040 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0050 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0050', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0050 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0050"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await botton_1.click(); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + botton_2.click() + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0050 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0060 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0060', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0060 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0060"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await botton_1.click(); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + botton_2.click() + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0060 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0070 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0070_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0070_1 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0070"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + await input_1.click() + await Utils.sleep(2000); + await driver.triggerKey(2) + await Utils.sleep(4000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0070_1 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0070_2 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0070_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0070_2 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0070"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + await input_1.click() + await Utils.sleep(2000); + await driver.triggerKey(2054) + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0070_2 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0080 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0080', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0080 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0080"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + await input_1.click(); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(1000); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + let input_2: Component = await driver.findComponent(ON.id('Input_2')); + input_2.click(); + await Utils.sleep(1000); + botton_2.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0080 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0090 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0090', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0090 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0090"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + botton_1.click(); + await Utils.sleep(1000); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + botton_2.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0090 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0100 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0100', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0100 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0100"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + botton_1.click(); + await Utils.sleep(1000); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + botton_2.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0100 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0110 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0110', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0110 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0110"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + driver.triggerKey(2049); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(1000); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + driver.triggerKey(2049); + await Utils.sleep(1000); + botton_2.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0110 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0120 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0120', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0120 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0120"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + driver.triggerKey(2049); + await Utils.sleep(500); + driver.triggerKey(2049); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(1000); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + driver.triggerKey(2049); + await Utils.sleep(500); + driver.triggerKey(2049); + await Utils.sleep(1000); + botton_2.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0120 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0130_1 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0130_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0130_1 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0130"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + botton_1.click(); + await Utils.sleep(1000); + let input_2: Component = await driver.findComponent(ON.id('Input_2')); + input_2.click() + await Utils.sleep(2000); + await driver.triggerKey(2) + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0130_1 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0130_2 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0130_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0130_2 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0130"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + botton_1.click(); + await Utils.sleep(1000); + let input_2: Component = await driver.findComponent(ON.id('Input_2')); + input_2.click() + await Utils.sleep(1000); + await driver.triggerKey(2054) + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0130_2 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0140 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0140', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0140 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0140"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + input_1.click(); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(1000); + let input_2: Component = await driver.findComponent(ON.id('Input_2')); + input_2.click() + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0140 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0150 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0150', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0150 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0150"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + botton_1.click(); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0150 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0160 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0160', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0160 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0160"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + botton_1.click(); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0160 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0170 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0170', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0170 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0170"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + driver.triggerKey(2049); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0170 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0180 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0180', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0180 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0180"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + driver.triggerKey(2049); + await Utils.sleep(500); + driver.triggerKey(2049); + await Utils.sleep(500); + botton_1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(500); + driver.triggerKey(2049); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0180 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0190 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0190', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0190 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0190"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + input_1.click(); + await Utils.sleep(1000); + botton_1.click(); + await Utils.sleep(1000); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + let input_2: Component = await driver.findComponent(ON.id('Input_2')); + input_2.click(); + await Utils.sleep(1000); + botton_2.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0190 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0200 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0200', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0200 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0200"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + botton_1.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0200 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0210 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0210', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0210 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0210"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + botton_1.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0210 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0220 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0220', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0220 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0210"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + driver.triggerKey(2049); + await Utils.sleep(500); + botton_1.click(); + await Utils.sleep(2000); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + driver.triggerKey(2049); + await Utils.sleep(500); + botton_2.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0220 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0230 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0230', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0230 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0230"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let botton_1: Component = await driver.findComponent(ON.id('Button_1')); + driver.triggerKey(2049); + await Utils.sleep(500); + driver.triggerKey(2049); + await Utils.sleep(500); + botton_1.click(); + await Utils.sleep(1000); + let botton_2: Component = await driver.findComponent(ON.id('Button_2')); + driver.triggerKey(2049); + await Utils.sleep(500); + driver.triggerKey(2049); + await Utils.sleep(1000); + botton_2.click(); + await Utils.sleep(4000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `ActionEventCommoneventFocusDefault0230 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0240_1 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0240_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0240_1 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0240"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + await input_1.click() + await Utils.sleep(2000); + await driver.triggerKey(2) + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0240_1 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0240_2 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0240_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0240_2 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0240"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + await input_1.click() + await Utils.sleep(2000); + await driver.triggerKey(2054) + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0240_2 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0250 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0250', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0250 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0250"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + let button_1: Component = await driver.findComponent(ON.id('Button_1')); + await input_1.click(); + await Utils.sleep(500); + await button_1.click(); + await Utils.sleep(2000); + let input_2: Component = await driver.findComponent(ON.id('Input_2')); + await input_2.click(); + await Utils.sleep(2000); + let backButton: Component = await driver.findComponent(ON.type('BackButton')); + backButton.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0250 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0260 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0260', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0260 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0260"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button_1: Component = await driver.findComponent(ON.id('Button_1')); + await button_1.click(); + await Utils.sleep(2000); + let backButton: Component = await driver.findComponent(ON.type('BackButton')); + backButton.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0260 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0270 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0270', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0270 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0270"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button_1: Component = await driver.findComponent(ON.id('Button_1')); + await button_1.click(); + await Utils.sleep(2000); + let backButton: Component = await driver.findComponent(ON.type('BackButton')); + backButton.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0270 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0280 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0280', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0280 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0280"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button_1: Component = await driver.findComponent(ON.id('Button_1')); + driver.triggerKey(2049); + await Utils.sleep(500); + driver.triggerKey(2049); + await Utils.sleep(1000); + await button_1.click(); + await Utils.sleep(2000); + let backButton: Component = await driver.findComponent(ON.type('BackButton')); + driver.triggerKey(2049); + await Utils.sleep(500); + driver.triggerKey(2049); + await Utils.sleep(1000); + backButton.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0280 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0290 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0290', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0290 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0290"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button_1: Component = await driver.findComponent(ON.id('Button_1')); + driver.triggerKey(2049); + await Utils.sleep(500); + driver.triggerKey(2049); + await Utils.sleep(1000); + await button_1.click(); + await Utils.sleep(2000); + let backButton: Component = await driver.findComponent(ON.type('BackButton')); + driver.triggerKey(2049); + await Utils.sleep(500); + driver.triggerKey(2049); + await Utils.sleep(1000); + backButton.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0290 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0300_1 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0300_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0300_1 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0300"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + await input_1.click() + await Utils.sleep(2000); + await driver.triggerKey(2) + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0300_1 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0300_2 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0300_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0300_2 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0300"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let input_1: Component = await driver.findComponent(ON.id('Input_1')); + await input_1.click() + await Utils.sleep(2000); + await driver.triggerKey(2054) + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0300_2 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0310 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0310', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0310 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0310"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let Button_1: Component = await driver.findComponent(ON.id('Button_1')); + await Button_1.click() + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0310 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0320 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0320', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0320 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0320"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let Button_1: Component = await driver.findComponent(ON.id('Button_1')); + await Button_1.click(); + await Utils.sleep(1000); + await driver.triggerKey(2049) + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0310 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0330 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0330', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0330 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0330"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let Button_1: Component = await driver.findComponent(ON.id('Button_1')); + await Button_1.click(); + await Utils.sleep(1000); + await driver.triggerKey(2049) + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0310 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0340 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0340', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0340 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0340"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let Button_1: Component = await driver.findComponent(ON.id('Button_1')); + await driver.triggerKey(2049) + await Utils.sleep(500); + await Button_1.click(); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUS_DEFAULT_0310 finish.`); + done(); + }) + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a8e63381f95899fe675595310349042ddea04fac --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction.test.ets @@ -0,0 +1,3169 @@ +/* + * + * * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' +import i18n from '@ohos.i18n' + +export default function ActionEventCommoneventFocuseventInteraction() { + + describe('ActionEventCommoneventFocuseventInteraction', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + 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_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0020 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0020', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0020 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0020"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + await button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0020 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0030 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0030', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0030 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0030"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + await button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0030 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0040 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0040', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0040 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0040"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + await button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0040 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0050 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0050', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0050 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0050"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + await button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0050 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0060 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0060', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0060 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0060"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0060 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0070 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0070', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0070 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0070"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0070 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0080 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0080', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0080 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0080"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0080 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0090 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0090', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0090 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0090"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0090 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0100_1 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0100_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0100_1 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0100"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0100_1 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0100_2 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0100_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0100_2 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0100"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0100_2 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0110_1 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0110_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0110_1 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0110"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0110_1 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0110_2 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0110_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0110_2 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0110"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction0110_0')); + await Utils.sleep(1000); + button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0110_2 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0140 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0140', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0140 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0140"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + await Utils.sleep(1000); + button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0140 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0150 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0150', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0150 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0150"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + await Utils.sleep(1000); + button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0150 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0160 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0160', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0160 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0160"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + await Utils.sleep(1000); + button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0160 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0170_1 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0170_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0170_1 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0170"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + await Utils.sleep(1000); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0170_1 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0170_2 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0170_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0170_2 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0170"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_1')); + await Utils.sleep(1000); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0170_2 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0180_1 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0180_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0180_1 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0180"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await driver.triggerKey(2012); + await driver.triggerKey(2013); + await driver.triggerKey(2014); + await driver.triggerKey(2015); + await driver.triggerKey(2015); + await driver.triggerKey(2015); + await driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0180_1 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0180_2 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0180_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0180_2 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0180"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('Interaction0180_001')); + await button1.click(); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2012); + await Utils.sleep(500); + await driver.triggerKey(2012); + await Utils.sleep(500); + await driver.triggerKey(2015); + await Utils.sleep(500); + await driver.triggerKey(2015); + await Utils.sleep(500); + await driver.triggerKey(2013); + await Utils.sleep(500); + await driver.triggerKey(2013); + await Utils.sleep(500); + await driver.triggerKey(2014); + await Utils.sleep(500); + await driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0180_2 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0190 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0190', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0190 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0190"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_2')); + await Utils.sleep(1000); + button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0190 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0200 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0200', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0200 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0200"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_2')); + await Utils.sleep(1000); + button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0200 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0210 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0210', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0210 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0210"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_2')); + await Utils.sleep(1000); + button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0210 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0220 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0220', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0220 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0220"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_2')); + await Utils.sleep(1000); + button.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0220 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0230 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0230', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0230 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0230"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0230 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0240 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0240', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0240 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0240"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0240 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0250 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0250', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0250 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0250"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0250 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0260 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0260', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0260 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0260"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + await Utils.sleep(3000); + await button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0260 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0270 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0270', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0270 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0270"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0270 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0280 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0280', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0280 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0280"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0280 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0310 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0310', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0310 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0310"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0310 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0320 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0320', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0320 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0320"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0320 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0330 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0330', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0330 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0330"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_0')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0330 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0340_1 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0340_1', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0340_1 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0340"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0340_1 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0340_2 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0340_2', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0340_2 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0340"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_002')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0340_2 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0470 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0470', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0470 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0470"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0470 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0480 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0480', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0480 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0480"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0480 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0490 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0490', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0490 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0490"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0490 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0500 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0500', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0500 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0500"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0500 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0510 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0510', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0510 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0510"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0510 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0520 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0520', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0520 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0520"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0520 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0530 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0530', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0530 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0530"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0530 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0540 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0540', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0540 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0540"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0540 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0550 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0550', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0550 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0550"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0550 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0560 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0560', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0560 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0560"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0560 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0610 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0610', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0610 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0610"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0610 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0620 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0620', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0620 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0620"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0620 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0630 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0630', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0630 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0630"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0630 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0640 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0640', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0640 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0640"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0640 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0650 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0650', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0640 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0650"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + let button2: Component = await driver.findComponent(ON.id('FocuseventInteraction_002')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(1000); + button2.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0650 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0660 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0660', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0660 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0660"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0660 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0670 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0670', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0670 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0670"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0670 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0840 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0840', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0840 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0840"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0840 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0850 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0850', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0850 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0850"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0850 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0860 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0860', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0860 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0860"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0860 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0870 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0870', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0870 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0870"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0870 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0880 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0880', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0880 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0880"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0880 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0890 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0890', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0890 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0890"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + let button2: Component = await driver.findComponent(ON.id('FocuseventInteraction_002')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + button2.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0890 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0910 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0910', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0910 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0910"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0910 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0920 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0920', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0920 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0920"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0920 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0930 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0930', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0930 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0930"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0930 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0940 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0940', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0940 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0940"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0940 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0950 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0950', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0950 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0950"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0950 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0960 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0960', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0960 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0960"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0960 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0970 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0970', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0970 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0970"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0970 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0980 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0980', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0980 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0980"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0980 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0990 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0990', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0990 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0990"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0990 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1000 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1000', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1000 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1000"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1000 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1010 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1010', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1010 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1010"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('Interaction0180_001')); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + await button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1010 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1040 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1040', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1040 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1040"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1040 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1050 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1050', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1050 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1050"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1050 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1060 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1060', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1060 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1060"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1060 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1070 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1070', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1070 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1070"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('Interaction_001')); + let button2: Component = await driver.findComponent(ON.id('Interaction_002')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + button2.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1070 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1080 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1080', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1080 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1080"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('Interaction_001')); + let button2: Component = await driver.findComponent(ON.id('Interaction_002')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + button2.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1080 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1090 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1090', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1090 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1090"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('Interaction_001')); + let button2: Component = await driver.findComponent(ON.id('Interaction_002')); + button1.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + button2.click(); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1090 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1100 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1100', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1100 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1100"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1100 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1110 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1110', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1110 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1110"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2015); + await Utils.sleep(500); + await driver.triggerKey(2015); + await Utils.sleep(500); + await driver.triggerKey(2014); + await Utils.sleep(500); + await driver.triggerKey(2014); + await Utils.sleep(500); + await driver.triggerKey(2015); + await Utils.sleep(500); + await driver.triggerKey(2012); + await Utils.sleep(500); + await driver.triggerKey(2013); + await Utils.sleep(500); + await driver.triggerKey(2013); + await Utils.sleep(500); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1110 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1120 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1120', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1120 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1120"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2015); + await Utils.sleep(500); + await driver.triggerKey(2015); + await Utils.sleep(500); + await driver.triggerKey(2014); + await Utils.sleep(500); + await driver.triggerKey(2014); + await Utils.sleep(500); + await driver.triggerKey(2014); + await Utils.sleep(500); + await driver.triggerKey(2015); + await Utils.sleep(500); + await driver.triggerKey(2012); + await Utils.sleep(500); + await driver.triggerKey(2013); + await Utils.sleep(500); + await driver.triggerKey(2013); + await Utils.sleep(500); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1120 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1170 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1170', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1170 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1170"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1170 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1180 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1180', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1180 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1180"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1180 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1190 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1190', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1190 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1190"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1190 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1200 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1200', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1200 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1200"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1200 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1210 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1210', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1210 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1210"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1210 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1220 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1220', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1220 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1220"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + await driver.triggerKey(2049); + await driver.triggerKey(2013); + await driver.triggerKey(2012); + await driver.triggerKey(2015); + await driver.triggerKey(2014); + await driver.triggerKey(2012); + await Utils.sleep(1000); + await button.click() + await Utils.sleep(1000); + await driver.triggerKey(2049); + await driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1220 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1230 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1230', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1230 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1230"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2015); + await Utils.sleep(500); + await driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1240 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1240 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1240', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1240 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1240"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('FocuseventInteraction_001')); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2013); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(500); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1240 finish.`); + done(); + }) + + /** + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1270 + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1270', 0, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1270 start.`); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1270"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(500); + await driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', `SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1270 finish.`); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0720 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0720 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0720', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0720 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0720"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0720_001')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0720 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0800 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0800 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0800', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0800 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0800"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0800_001')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0800 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0810 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0810 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0810', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0810 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0810"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0810_001')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0810 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0830 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0830 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0830', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0830 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0830"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0830_1')); + let pos = await listItem.getBoundsCenter() + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0830 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1030 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1030 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1030 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1030_001')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1030 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1130 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1130 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1130 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2012); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(1000); + driver.triggerKey(2015); + await Utils.sleep(1000); + driver.triggerKey(2014); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1130 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1140 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1140 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1140', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1140 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1140"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1140_001')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1140 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1150 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1150 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1150', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1150 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1150"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1150_001')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1150 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1160 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1160 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1160', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1160 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1160"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1160_001')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1160 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1280 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1280 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1280', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1280 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1280"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1280 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1290 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1290 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1290', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1290 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1290"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1290 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1300 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1300 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1300', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1300 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1300"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1300 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1310 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1310 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1310', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1310 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1310"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1310 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1380 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1380 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1380', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1380 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1380"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1380_001')); + driver.triggerKey(2049); + await Utils.sleep(2000); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1380 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1390 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1390 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1390', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1390 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1390"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1390_001')); + let buttonChange: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1390_002')); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await button.click(); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await buttonChange.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1390 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1400 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1400 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1400', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1400 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1400"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1400_001')); + let buttonChange: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1400_002')); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await button.click(); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await buttonChange.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1400 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1410 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1410 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1410', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1410 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1410"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1410_001')); + let buttonChange: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1410_002')); + driver.triggerKey(2049); + await Utils.sleep(2000); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(1000); + await buttonChange.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1410 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1420 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1420 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1420', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1420 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1420"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1420_001')); + driver.triggerKey(2049); + await Utils.sleep(2000); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1420 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1430 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1430 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1430', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1430 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1430"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1430_5')); + let pos = await listItem.getBoundsCenter(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.swipe(pos.x, pos.y, pos.x, pos.y - 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1430 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0120 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0120 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0120 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0120"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0120_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0120 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0130 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0130 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0130 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0130_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0130 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0290 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0290 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0290', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0290 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0290"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0290_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0290 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0300 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0300 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0300', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0300 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0300"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0300_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0300 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0350 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0350 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0350', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0350 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0350"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0350_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0350 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0360 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0360 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0360', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0360 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0360"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0360_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0360 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0370 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0370 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0370', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0370 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0370"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0370_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0370 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0380 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0380 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0380', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0380 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0380"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0380_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0380 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0390 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0390 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0390', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0390 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0390"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0390_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0390 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0400 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0400 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0400', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0400 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0400"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0400_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0400 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0410 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0410 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0410', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0410 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0410"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0410_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0410 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0420 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0420 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0420', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0420 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0420"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0420_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0420 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0430 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0430 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0430', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0430 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0430"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0430_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0430 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0440 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0440 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0440', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0440 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0440"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0440_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0440 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0450 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0450 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0450', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0450 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0450"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0450_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0450 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0460 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0460 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0460', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0460 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0460"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0460_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0460 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0590 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0590 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0590', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0590 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0590"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0590_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0590 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0600 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0600 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0600', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0600 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0600"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0600_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 100, pos.y); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0600 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0730 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0730 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0730', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0730 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0730"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0730_1')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0730 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0820 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0820 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0820', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0820 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0820"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction0820_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0820 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0570 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0570 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0570', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0570 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0570"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0570 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0580 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0580 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0580', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0580 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0580"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0580 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0680 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0680 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0680', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0680 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0680"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0680 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0690 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0690 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0690', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0690 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0690"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0690 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0700 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0700 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0700', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0700 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0700"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0700 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0710 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0710 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0710', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0710 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0710"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + driver.triggerKey(2014); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0710 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0740 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0740 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0740', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0740 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0740"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + driver.triggerKey(2012); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0740 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0750 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0750 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0750', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0750 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0750"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0750 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0770 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0770 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0770', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0770 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0770"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + driver.triggerKey(2014); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0770 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0780 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0780 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0780', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0780 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0780"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0780 finish.'); + done(); + }) + + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0760 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0760 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0760', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0760 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0760"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0760 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0790 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0790 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0790', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0790 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0790"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0790 finish.'); + done(); + }) + + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0900 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0900 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0900', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0900 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0900"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2013); + await Utils.sleep(2000); + driver.triggerKey(2015); + await Utils.sleep(2000); + driver.triggerKey(2015); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_0900 finish.'); + done(); + }) + + + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1020 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1020 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1020 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1020_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1020 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1250 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1250 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1250', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1250 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1250"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1250_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1250 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1260 + * @tc.name SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1260 + * @tc.desc focus event + */ + it('SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1260', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1260 start.'); + Settings.createWindow("testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1260"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + let listItem: Component = await driver.findComponent(ON.id('ActionEventCommoneventFocuseventInteraction1260_1')); + let pos = await listItem.getBoundsCenter(); + await driver.drag(pos.x, pos.y, pos.x + 40, pos.y + 50); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_ACTION_EVENT_COMMONEVENT_FOCUSEVENT_INTERACTION_1260 finish.'); + done(); + }) + + + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/List.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f95172d880490f9a74ca09553bc86eb52ad23c36 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/List.test.ets @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UIComponentCommonattrResult from './UIComponentCommonattrResult/UIComponentCommonattrResult.test' +import UIAttributesFocuscontrolInterface + from './UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface.test' +import UIComponentCommonattrDrawingoptimization + from './UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization.test' +import UIAttributesFocuscontrolInterAction + from './UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction.test' +import ActionEventCommoneventFocuseventInteraction + from './ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction.test' +import ActionEventCommoneventFocusDefault + from './ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault.test'; + +import UIComponentCommonattrFocusenhancement from './UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement.test' +import UISnapshot from './UISnapshot/UISnapshot.test' +import UIComponentSnapshotAttribute from './UIComponentSnapshotAttribute/UIComponentSnapshotAttribute.test' +import UIComponentCommonattrClearfocuse from './UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse.test' +import ActionEventAttributeModifier from './ActionEventAttributeModifier/ActionEventAttributeModifier.test' +import ActionEventCommoneventEventInterface + from './ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface.test' + +export default function testsuite() { + UIComponentCommonattrResult(); + UIAttributesFocuscontrolInterface(); + UIComponentCommonattrDrawingoptimization(); + UIAttributesFocuscontrolInterAction(); + UIComponentCommonattrFocusenhancement(); + ActionEventCommoneventFocuseventInteraction(); + ActionEventCommoneventFocusDefault(); + UISnapshot(); + UIComponentSnapshotAttribute(); + UIComponentCommonattrClearfocuse(); + ActionEventAttributeModifier(); + ActionEventCommoneventEventInterface() +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..51ab7807c825784a64ad502f2faa54e1b636548b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction.test.ets @@ -0,0 +1,172 @@ +/* + * + * * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' +import i18n from '@ohos.i18n' + +export default function UIAttributesFocuscontrolInterAction() { + + describe('UIAttributesFocuscontrolInterAction', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + 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_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0010 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0010 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0010 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2049); + await Utils.sleep(1000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0010 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0020 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0020 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0020 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0020"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0020 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0030 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0030 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0030 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0030 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0040 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0040 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0040', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0040 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0040"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0040 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0050 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0050 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0050 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERACTION_0050 finish.'); + done(); + }) + + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2bf5f4b0aab9ed2201b395aab808fd17fb95310 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface.test.ets @@ -0,0 +1,446 @@ +/* + * + * * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' +import i18n from '@ohos.i18n' + +export default function UIAttributesFocuscontrolInterface() { + + describe('UIAttributesFocuscontrolInterface', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + 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_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0010 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0010 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0010 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0010"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0010 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0050 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0050 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0050 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(1000); + driver.triggerKey(2013); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0050 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0060 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0060 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0060', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0060 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0060"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0060 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0080 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0080 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0080 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0080"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0080 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0100 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0100 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0100 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0100"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0100 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0120 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0120 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0120 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0120"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0120 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0160 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0160 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0160', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0160 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0160"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0160 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0170 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0170 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0170', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0170 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0170"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0170 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0260 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0260 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0260', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0260 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0260"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIAttributesFocuscontrolInterface0260_001')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0260 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0250 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0250 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0250', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0250 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0250"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIAttributesFocuscontrolInterface0250_001')); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0250 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0030 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0030 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0030 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0030 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0020 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0020 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0020 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0020"); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0020 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0150 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0150 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0150', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0150 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0150"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0150 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0140 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0140 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0140', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0140 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0140"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0140 finish.'); + done(); + }) + + + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0220 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0220 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0220', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0220 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0220"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIAttributesFocuscontrolInterface0220_001')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0220 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0240 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0240 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0240', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0240 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0240"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIAttributesFocuscontrolInterface0240_001')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0240 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0230 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0230 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0230', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0230 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0230"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIAttributesFocuscontrolInterface0230_001')); + await button.click(); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0230 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0090 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0090 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0090 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0090"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0090 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0110 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0110 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0110 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0110"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0110 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0190 + * @tc.name SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0190 + * @tc.desc focus event + */ + it('SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0190', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0190 start.'); + Settings.createWindow("testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0190"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_ATTRIBUTES_FOCUSCONTROL_INTERFACE_0190 finish.'); + done(); + }) + + + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab362882815c5cb4dd0a3309e478b5ff42c794a8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse.test.ets @@ -0,0 +1,255 @@ +/* + * + * * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' +import i18n from '@ohos.i18n' + +export default function UIComponentCommonattrClearfocuse() { + + describe('UIComponentCommonattrClearfocuse', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + if (Settings.windowClass == undefined) { + return + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse001"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001_01 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse001"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001_02 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse001"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_001_02 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse003"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003_01 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse003"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003_02 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse003"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_003_02 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse002"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002_01 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse002"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002_02 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse002"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_CLEARFOCUSE_002_02 finish.'); + done(); + }) + + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a9915f7fc0c4861f99e177c31a5dd56cd292fe30 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization.test.ets @@ -0,0 +1,1155 @@ +/* + * + * * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON } from '@ohos.UiTest' +import i18n from '@ohos.i18n' +import uiAppearance from '@ohos.uiAppearance' + +export default function UIComponentCommonattrDrawingoptimization() { + + describe('UIComponentCommonattrDrawingoptimization', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + if (Settings.windowClass == undefined) { + return + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done() + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0110 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0110 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0110 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0110"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0110 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0240 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0240 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0240', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0240 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0240"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0240 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0080 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0080 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0080 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0080"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0080 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0080_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0080_01 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0080_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0080_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0080"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0080_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_01 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_02 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_02 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_03 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_03 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_03', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_03 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0070_03 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_01 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_02 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_02 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_03 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_03 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_03', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_03 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060_03 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0060 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_01 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_02 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_02 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_03 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_03 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_03', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_03 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_03 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_04 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_04 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_04', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_04 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_04 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_05 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_05 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_05', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_05 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0050_05 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0200 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0200 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0200', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0200 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0200"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0200 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0200_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0200_01 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0200_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0200_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0200"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0200_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_01 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_02 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_02 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_03 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_03 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_03', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_03 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_03 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_04 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_04 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_04', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_04 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_04 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_05 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_05 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_05', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_05 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0030_05 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0040 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0040 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0040', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0040 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0040"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0040 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_01 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_02 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_02 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_03 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_03 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_03', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_03 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_03 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_04 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_04 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_04', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_04 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0010_04 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_01 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_02 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_02 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_03 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_03 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_03', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_03 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_03 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_04 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_04 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_04', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_04 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0020_04 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0120 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0120 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0120 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0120"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0120 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0150 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0150 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0150', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0150 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0150"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(100); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrDrawingoptimization0150_001')); + await button.click(); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + await button.click(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0150 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0220 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0220 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0220', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0220 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0220"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrDrawingoptimization0220_001')); + await button.click(); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0220 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0210 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0210 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0210', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0210 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0210"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrDrawingoptimization0210_001')); + await button.click(); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0210 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0190 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0190 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0190', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0190 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0190"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0190 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0230 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0230 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0230', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0230 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0230"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrDrawingoptimization0230_001')); + await button.click(); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0230 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0180 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0180 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0180', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0180 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0180"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0180 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0130 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0130 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0130 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0130 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0130_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0130_01 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0130_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0130_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0130_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0140 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0140 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0140', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0140 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0140"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0140 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0140_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0140_01 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0140_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0140_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0140"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0140_01 finish.'); + done(); + }) + + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0100 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0100 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0100 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0100"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0100 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0170 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0170 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0170', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0170 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0170"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0170 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0090 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0090 + * @tc.desc focus event test focusBox + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0090 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0090"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_DRAWINGOPTIMIZATION_0090 finish.'); + done(); + }) + + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..adf4ac13a9876211da9597bb2540dd381c1f82ca --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement.test.ets @@ -0,0 +1,502 @@ +/* + * + * * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' +import i18n from '@ohos.i18n' + +export default function UIComponentCommonattrFocusenhancement() { + + describe('UIComponentCommonattrFocusenhancement', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + if (Settings.windowClass == undefined) { + return + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0100 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0100 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0100 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0100"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0100 finish.'); + done(); + }) + + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0050 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0050 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0050 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0050"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0050 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0030 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0030 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0030 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0030"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0030 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0040 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0040 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0040', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0040 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0040"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0040 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0020 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0020 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0020 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0020"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0020 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0010 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0010 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0010 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0010 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0130 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0130 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0130 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0130 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0120 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0120 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0120 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0120"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.mouseMoveTo({x:200, y:250}); + await driver.mouseMoveTo({x:201, y:250}); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0120 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0110 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0110 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0110 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0110"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0110 finish.'); + done(); + }) + + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_01 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_02 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_02 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_03 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_03 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_03', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_03 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_03 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_04 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_04 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_04', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_04 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0060_04 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_01 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_01 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_01', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_01 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_01 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_02 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_02 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_02', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_02 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_02 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_03 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_03 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_03', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_03 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_03 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_04 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_04 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_04', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_04 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(1000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0070_04 finish.'); + done(); + }) + + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0090 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0090 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0090 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0090"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000) + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0090 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0080 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0080 + * @tc.desc listitemgroup constraintSize set height,maxWidth,minHeight,maxHeight + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0080 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0080"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_FOCUSENHANCEMENT_0080 finish.'); + done(); + }) + + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrResult/UIComponentCommonattrResult.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrResult/UIComponentCommonattrResult.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..469535cee93f1c83e2295c01beba8aa33bce4b53 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentCommonattrResult/UIComponentCommonattrResult.test.ets @@ -0,0 +1,550 @@ +/* + * + * * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON, PointerMatrix } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' +import i18n from '@ohos.i18n' + +export default function UIComponentCommonattrResult() { + + describe('UIComponentCommonattrResult', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + if (Settings.windowClass == undefined) { + return + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0230 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0230 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0230', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0230 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0230"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0230_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0230 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0100 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0100 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0100 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0100"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0100_001')); + await button.click(); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0100 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0040 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0040 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0040', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0040 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0040"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0040_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0040 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0110 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0110 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0110 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0110"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0110_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0110 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0020 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0020 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0020 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0020_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0020 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0010 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0010 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0010 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0010_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0010 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0070 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0070 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0070', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0070 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0070_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0070 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0080 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0080 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0080 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0080"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0080_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0080 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0090 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0090 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0090 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0090"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0090_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0090 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0050 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0050 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0050 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0050_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0050 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0060 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0060 + * @tc.desc requestFocus + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0060', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0060 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0060_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0060 finish.'); + done(); + }) + + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0250 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0250 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0250', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0250 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0250"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0250_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0250 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0240 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0240 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0240', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0240 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0240"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0240_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0240 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0150 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0150 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0150', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0150 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0150"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0150_001')); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0150 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0160 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0160 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0160', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0160 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0160"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0160_001')); + await button.click(); + await Utils.sleep(2000); + await button.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0160 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0140 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0140 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0140', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0140 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0140"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0140_001')); + await button.click(); + let buttonMenu: Component = await driver.findComponent(ON.text('Menu1').type('Text')); + await buttonMenu.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0140 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0120 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0120 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0120 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0120"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0120_001')); + await Utils.sleep(2000); + await button.click(); + await Utils.sleep(2000); + let buttonConfirm: Component = await driver.findComponent(ON.id('UIComponentCommonattrResult0120_002')); + await buttonConfirm.click(); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0120 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0030 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0030 + * @tc.desc focus event + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0030 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + driver.triggerKey(2049); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0030 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0200 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0200 + * @tc.desc Focus test + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0200', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0200 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0200"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id("UIComponentCommonattrResult0200_001")); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0200 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0220 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0220 + * @tc.desc Focus test + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0220', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0220 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0220"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id("UIComponentCommonattrResult0220_001")); + await button.click(); + await Utils.sleep(2000); + let buttonPageTwo: Component = await driver.findComponent(ON.id("UIComponentCommonattrResult0220_002")); + await buttonPageTwo.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0220 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0170 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0170 + * @tc.desc Focus test + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0170', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0170 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0170"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id("UIComponentCommonattrResult0170_001")); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0170 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0130 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0130 + * @tc.desc Focus test + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0130 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id("UIComponentCommonattrResult0130_001")); + await button.click(); + await Utils.sleep(2000); + let button1: Component = await driver.findComponent(ON.id("UIComponentCommonattrResult0130_002")); + await button1.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0130 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0190 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0190 + * @tc.desc Focus test + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0190', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0190 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0190"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id("UIComponentCommonattrResult0190_001")); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0190 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0180 + * @tc.name SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0180 + * @tc.desc Focus test + */ + it('SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0180', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0180 start.'); + Settings.createWindow("testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0180"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id("UIComponentCommonattrResult0180_001")); + await button.click(); + await Utils.sleep(2000); + await driver.triggerKey(2049); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_COMMONATTR_RESULT_0180 finish.'); + done(); + }) + + + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b23265967932871773052885d7f1e535c8a7355 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute.test.ets @@ -0,0 +1,4889 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON, PointerMatrix } from '@ohos.UiTest' +import i18n from '@ohos.i18n' +import uiAppearance from '@ohos.uiAppearance' + +export default function UIComponentSnapshotAttribute() { + + describe('UIComponentSnapshotAttribute', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + if (Settings.windowClass == undefined) { + return + } + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1040 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1040', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1040 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1040"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1040_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1040 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1030 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1030 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1030_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1030 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1050 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1050 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1050_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1050 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1060 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1060', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1060 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1060_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1060 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1070 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1070', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1070 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1070_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1070 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1080 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1080 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1080"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1080_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1080 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1090 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1090 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1090"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1090_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1090 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1100 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1100 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1100"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1100_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1100 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1110 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1110 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1110"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1110_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1110 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1120 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1120 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1120"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1120_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1120 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1130 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1130 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1130_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1130 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1140 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1140', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1140 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1140"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1140_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1140 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0980 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0980', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0980 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0980"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0980_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0980 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0970 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0970', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0970 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0970"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0970_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0970 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0990 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0990', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1140 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0990"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0990_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0990 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1010 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1010 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1010_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1010 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1000 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1000', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1000 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1000"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1000_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1000 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1020 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1020 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1020_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1020 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0200 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0200', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0200 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0200"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0200_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0200 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0190 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0190', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0190 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0190"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0190_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0190 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0210 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0210', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0210 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0210"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0210_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0210 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0230 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0230', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0230 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0230"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0230_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0230 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0220 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0220', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0220 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0220"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0220_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0220 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0240 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0240', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0240 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0240"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0240_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0240 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0260 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0260', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0260 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0260"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0260_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0260 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0250 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0250', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0250 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0250"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0250_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0250 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0270 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0270', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0270 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0270"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0270_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0270 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0290 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0290', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0290 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0290"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0290_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0290 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0280 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0280', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0280 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0280"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0280_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0280 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0300 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0300', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0300 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0300"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0300_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0300 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0130 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0130 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0130_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0130 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0140 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0140', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0140 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0140"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0140_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0140 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0150 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0150', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0150 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0150"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0150_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0150 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0170 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0170', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0170 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0170"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0170_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0170 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0160 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0160', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0160 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0160"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0160_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0160 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0180 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0180', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0180 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0180"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0180_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0180 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1330 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1330', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1330 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1330"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1330_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1330 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1340 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1340', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1340 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1340"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1340_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1340 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1350 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1350', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1350 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1350"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1350_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1350 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1360 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1360', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1360 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1360"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1360_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1360 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1370 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1370', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1370 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1370"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1370_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1370 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1380 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1380', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1380 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1380"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1380_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1380 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1630 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1630', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1630 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1630"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1630_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1630 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1640 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1640', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1640 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1640"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1640_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1640 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1650 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1650', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1650 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1650"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1650_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1650 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1660 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1660', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1660 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1660"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1660_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1660 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1670 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1670', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1670 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1670"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1670_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1670 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1680 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1680', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1680 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1680"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1680_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1680 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1570 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1570', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1570 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1570"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1570_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1570 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1580 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1580', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1580 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1580"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1580_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1580 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1590 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1590', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1590 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1590"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1590_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1590 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1600 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1600', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1600 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1600"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1600_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1600 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1610 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1610', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1610 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1610"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1610_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1610 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1620 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1620', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1620 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1620"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1620_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1620 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1450 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1450', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1450 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1450"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1450_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1450 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1460 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1460', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1460 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1460"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1460_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1460 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1470 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1470', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1470 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1470"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1470_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1470 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1480 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1480', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1480 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1480"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1480_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1480 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1490 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1490', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1490 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1490"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1490_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1490 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1500 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1500', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1500 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1500"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1500_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1500 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1510 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1510', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1510 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1510"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1510_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1510 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1520 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1520', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1520 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1520"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1520_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1520 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1530 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1530', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1530 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1530"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1530_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1530 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1540 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1540', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1540 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1540"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1540_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1540 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1550 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1550', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1550 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1550"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1550_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1550 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1560 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1560', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1560 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1560"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1560_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1560 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1390 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1390', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1390 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1390"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1390_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1390 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1400 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1400', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1400 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1400"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1400_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1400 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1410 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1410', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1410 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1410"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1410_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1410 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1420 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1420', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1420 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1420"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1420_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1420 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1430 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1430', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1430 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1430"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1430_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1430 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1440 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1440', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1440 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1440"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1440_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1440 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0490 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0490', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0490 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0490"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0490_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0490 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0500 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0500', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0500 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0500"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0500_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0500 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0510 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0510', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0510 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0510"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0510_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0510 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0520 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0520', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0520 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0520"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0520_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0520 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0530 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0530', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0530 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0530"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0530_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0530 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0540 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0540', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0540 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0540"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0540_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0540 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0790 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0790', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0790 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0790"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0790_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0790 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0800 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0800', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0800 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0800"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0800_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0800 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0810 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0810', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0810 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0810"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0810_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0810 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0820 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0820', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0820 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0820"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0820_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0820 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0830 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0830', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0830 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0830"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0830_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0830 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0840 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0840', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0840 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0840"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0840_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0840 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0730 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0730', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0730 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0730"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0730_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0730 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0740 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0740', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0740 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0740"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0740_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0740 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0750 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0750', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0750 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0750"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0750_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0750 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0760 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0760', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0760 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0760"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0760_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0760 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0770 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0770', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0770 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0770"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0770_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0770 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0780 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0780', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0780 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0780"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0780_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0780 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0610 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0610', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0610 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0610"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0610_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0610 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0620 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0620', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0620 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0620"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0620_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0620 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0630 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0630', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0630 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0630"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0630_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0630 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0640 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0640', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0640 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0640"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0640_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0640 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0650 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0650', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0650 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0650"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0650_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0650 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0660 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0660', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0660 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0660"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0660_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0660 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0670 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0670', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0670 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0670"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0670_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0670 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0680 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0680', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0680 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0680"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0680_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0680 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0690 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0690', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0690 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0690"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0690_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0690 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0700 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0700', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0700 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0700"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0700_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0700 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0710 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0710', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0710 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0710"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0710_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0710 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0720 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0720', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0720 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0720"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0720_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0720 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0550 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0550', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0550 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0550"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0550_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0550 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0560 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0560', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0560 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0560"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0560_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0560 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0570 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0570', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0570 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0570"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0570_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0570 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0580 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0580', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0580 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0580"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0580_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0580 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0590 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0590', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0590 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0590"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0590_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0590 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0600 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0600', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0600 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0600"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0600_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0600 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2170 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2170', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2170 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2170"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2170_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2170 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2180 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2180', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2180 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2180"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2180_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2180 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2190 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2190', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2190 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2190"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2190_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2190 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2200 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2200', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2200 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2200"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2200_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2200 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2210 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2210', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2210 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2210"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2210_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2210 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2220 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2220', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2220 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2220"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2220_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2220 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2470 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2470', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2470 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2470"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2470_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2470 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2480 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2480', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2480 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2480"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2480_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2480 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2490 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2490', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2490 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2490"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2490_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2490 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2500 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2500', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2500 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2500"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2500_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2500 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2510 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2510', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2510 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2510"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2510_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2510 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2520 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2520', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2520 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2520"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2520_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2520 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2410 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2410', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2410 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2410"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2410_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2410 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2420 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2420', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2420 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2420"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2420_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2420 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2430 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2430', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2430 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2430"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2430_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2430 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2440 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2440', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2440 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2440"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2440_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2440 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2450 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2450', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2450 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2450"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2450_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2450 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2460 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2460', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2460 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2460"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2460_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2460 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2290 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2290', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2290 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2290"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2290_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2290 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2300 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2300', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2300 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2300"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2300_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2300 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2310 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2310', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2310 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2310"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2310_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2310 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2320 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2320', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2320 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2320"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2320_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2320 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2330 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2330', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2330 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2330"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2330_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2330 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2340 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2340', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2340 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2340"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2340_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2340 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2230 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2230', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2230 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2230"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2230_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2230 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2240 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2240', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2240 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2240"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2240_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2240 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2250 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2250', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2250 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2250"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2250_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2250 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2260 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2260', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2260 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2260"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2260_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2260 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2270 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2270', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2270 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2270"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2270_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2270 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2280 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2280', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2280 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2280"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2280_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2280 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2350 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2350', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2350 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2350"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2350_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2350 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2360 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2360', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2360 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2360"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2360_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2360 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2370 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2370', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2370 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2370"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2370_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2370 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2380 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2380', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2380 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2380"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2380_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2380 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2390 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2390', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2390 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2390"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2390_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2390 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2400 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2400', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2400 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2400"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2400_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2400 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0310 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0310', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0310 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0310"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0310_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0310 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0320 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0320', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0320 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0320"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0320_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0320 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0330 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0330', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0330 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0330"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0330_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0330 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0340 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0340', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0340 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0340"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0340_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0340 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0350 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0350', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0350 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0350"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0350_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0350 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0360 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0360', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0360 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0360"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0360_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0360 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0370 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0370', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0370 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0370"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0370_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0370 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0380 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0380', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0380 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0380"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0380_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0380 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0390 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0390', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0390 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0390"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0390_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0390 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0400 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0400', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0400 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0400"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0400_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0400 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0410 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0410', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0410 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0410"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0410_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0410 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0420 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0420', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0420 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0420"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0420_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0420 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0910 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0910', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0910 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0910"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0910_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0910 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0920 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0920', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0920 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0920"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0920_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0920 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0930 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0930', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0930 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0930"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0930_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0930 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0940 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0940', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0940 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0940"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0940_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0940 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0950 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0950', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0950 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0950"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0950_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0950 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0960 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0960', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0960 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0960"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0960_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0960 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1210 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1210', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1210 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1210"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1210_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1210 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1220 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1220', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1220 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1220"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1220_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1220 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1230 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1230', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1230 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1230"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1230_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1230 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1240 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1240', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1240 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1240"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1240_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1240 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1250 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1250', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1250 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1250"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1250_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1250 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1260 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1260', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1260 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1260"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1260_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1260 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1150 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1150', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1150 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1150"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1150_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1150 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1160 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1160', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1160 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1160"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1160_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1160 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1170 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1170', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1170 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1170"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1170_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1170 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1180 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1180', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1180 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1180"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1180_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1180 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1190 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1190', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1190 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1190"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1190_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1190 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1200 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1200', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1200 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1200"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1200_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1200 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0070 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0070', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0070 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0070_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0070 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0080 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0080 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0080"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0080_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0080 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0090 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0090 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0090"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0090_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0090 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0100 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0100 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0100"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0100_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0100 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0120 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0120 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0120"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0120_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0120 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2530 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2530', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2530 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2530"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2530_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2530 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0850 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0850', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0850 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0850"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0850_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0850 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0860 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0860', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0860 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0860"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0860_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0860 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0870 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0870', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0870 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0870"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0870_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0870 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0880 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0880', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0880 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0880"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0880_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0880 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0890 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0890', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0890 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0890"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0890_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0890 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0900 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0900', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0900 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0900"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0900_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0900 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0010 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0010 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0010_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0010 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0020 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0020 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0020_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0020 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0030 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0030 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0030_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0030 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0110 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0110 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0110"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0110_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0110 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0040 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0040', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0040 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0040"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0040_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0040 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0050 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0050 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0050_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0050 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0060 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0060', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0060 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0060_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0060 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1270 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1270', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1270 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1270"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1270_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1270 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1280 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1280', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1280 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1280"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1280_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1280 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1290 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1290', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1290 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1290"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1290_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1290 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1300 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1300', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1300 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1300"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1300_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1300 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1310 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1310', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1310 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1310"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1310_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1310 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1320 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1320', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1320 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1320"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1320_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1320 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0430 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0430', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0430 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0430"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0430_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0430 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0440 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0440', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0440 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0440"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0440_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0440 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0450 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0450', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0450 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0450"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0450_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0450 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0460 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0460', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0460 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0460"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0460_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0460 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0470 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0470', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0470 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0470"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0470_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0470 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0480 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0480', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0480 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0480"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute0480_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_0480 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2110 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2110 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2110"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2110_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2110 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2120 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2120 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2120"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2120_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2120 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2130 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2130 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2130_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2130 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2140 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2140', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2140 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2140"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2140_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2140 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2150 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2150', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2150 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2150"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2150_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2150 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2160 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2160', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2160 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2160"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2160_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2160 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1760 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1760', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1760 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1760"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1760_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1760 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1750 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1750', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1750 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1750"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1750_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1750 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1770 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1770', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1770 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1770"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1770_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1770 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1780 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1780', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1780 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1780"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1780_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1780 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1790 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1790', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1790 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1790"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1790_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1790 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1800 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1800', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1800 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1800"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1800_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1800 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1810 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1810', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1810 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1810"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1810_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1810 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1820 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1820', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1820 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1820"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1820_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1820 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1830 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1830', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1830 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1830"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1830_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1830 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1840 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1840', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1840 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1840"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1840_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1840 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1850 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1850', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1850 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1850"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1850_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1850 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1860 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1860', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1860 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1860"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1860_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1860 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1890 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1890', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1890 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1890"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1890_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1890 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1870 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1870', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1870 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1870"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1870_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1870 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1880 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1880', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1880 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1880"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1880_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1880 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1900 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1900', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1900 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1900"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1900_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1900 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1910 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1910', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1910 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1910"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1910_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1910 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1920 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1920', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1920 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1920"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1920_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1920 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1690 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1690', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1690 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1690"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1690_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1690 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1700 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1700', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1700 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1700"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1700_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1700 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1710 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1710', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1700 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1710"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1710_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1710 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1720 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1720', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1720 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1720"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1720_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1720 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1730 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1730', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1730 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1730"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1730_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1730 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1740 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1740', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1740 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1740"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1740_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1740 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2050 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2050 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2050"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2050_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2050 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2060 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2060', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2060 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2060"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2060_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2060 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2070 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2070', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2070 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2070"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2070_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2070 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2080 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2080 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2080"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2080_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2080 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2090 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2090 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2090"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2090_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2090 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2100 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2100 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2100"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2100_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2100 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1990 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1990', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1990 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1990"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1990_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1990 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2000 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2000', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2000 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2000"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2000_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2000 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2010 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2010 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2010"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2010_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2010 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2020 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2020 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2020"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2020_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2020 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2030 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2030 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2030"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2030_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2030 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2040 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2040', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2040 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2040"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute2040_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_2040 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1930 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1930', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1930 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1930"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1930_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1930 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1940 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1940', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1940 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1940"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1940_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1940 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1950 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1950', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1950 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1950"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1950_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1950 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1960 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1960', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1960 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1960"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1960_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1960 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1970 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1970', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1970 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1970"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1970_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1970 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1980 + */ + it('SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1980', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1980 start.'); + Settings.createWindow("testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1980"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button: Component = await driver.findComponent(ON.id('UIComponentSnapshotAttribute1980_001')); + await button.click(); + await Utils.sleep(500); + await button.click(); + await Utils.sleep(2000); + windowSnap.snapShot(); + await Utils.sleep(3000); + Logger.info('TEST', 'SUB_ACE_UI_COMPONENT_SNAPSHOT_ATTRIBUTE_1980 finish.'); + done(); + }) + + + }) +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UISnapshot/UISnapshot.test.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UISnapshot/UISnapshot.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9f96f2a0c6677751d8dc06e4b547f8b4dd67ea8c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/UISnapshot/UISnapshot.test.ets @@ -0,0 +1,5348 @@ +/* + * + * * Copyright (C) 2024 Huawei Device 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 { afterEach, beforeEach, describe, expect, it } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Component, Driver, ON } from '@ohos.UiTest' +import uiAppearance from '@ohos.uiAppearance' +import i18n from '@ohos.i18n' + +export default function UISnapshot() { + + describe('UISnapshot', () => { + beforeEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + done(); + }) + afterEach(async (done: Function) => { + if (uiAppearance.getDarkMode() == uiAppearance.DarkMode.ALWAYS_DARK) { + await uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT).then(() => { + console.info('Setting before Set dark-mode successfully.'); + }).catch((error: Error) => { + console.error('Setting before Set dark-mode failed, ' + error.message); + }); + Utils.sleep(1000); + } else { + console.info('Setting before dark-mode is uiAppearance.DarkMode.ALWAYS_LIGHT'); + } + i18n.System.setAppPreferredLanguage('zh-Hans-CN'); // 设置系统当前Locale为 "zh-CN" + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch before CusLocales,appPreferredLanguage2=${appPreferredLanguage2}`); + 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_0900 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0900', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0900 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0900"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0900')); + await button1.click(); + let velocity: string = getInspectorByKey('SNAPSHOT_0090') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_0900')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0900 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0890 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0890', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0890 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0890"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0890')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0890 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0880 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0880', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0880 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0880"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0880')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0880 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0870 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0870', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0870 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0870"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0870')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0870 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0860 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0860', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0860 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0860"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0860')); + await button1.click(); + let velocity: string = getInspectorByKey('SNAPSHOT_0860') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_0860')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0860 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0850 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0850', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0850 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0850"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0850')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0850 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0840 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0840', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0840 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0840"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0840')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0840 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0830 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0830', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0830 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0830"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0830')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0830 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0820 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0820', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0820 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0820"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0820')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0820 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0810 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0810', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0810 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0810"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0810')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0810 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0800 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0800', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0800 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0800"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0800')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0800 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0790 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0790', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0790 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0790"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0790')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0790 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0780 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0780', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0780 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0780"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0780')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0780 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0770 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0770', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0770 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0770"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0770')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0770 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0760 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0760', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0760 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0760"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0760')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0760 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0750 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0750', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0750 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0750"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0750')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0750 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0740 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0740', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0740 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0740"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0740')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0740 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0730 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0730', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0730 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0730"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0730')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0730 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0720 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0720', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0720 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0720"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0720')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0720 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0710 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0710', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0710 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0710"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0710')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0710 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0700 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0700', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0700 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0700"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0700')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0700 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0690 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0690', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0690 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0690"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0690')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0690 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0680 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0680', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0680 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0680"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0680')); + let velocity: string = getInspectorByKey('SNAPSHOT_0680') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_0680')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0680 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0670 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0670', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0670 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0670"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0670')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0670 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0660 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0660', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0660 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0660"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0660')); + let velocity: string = getInspectorByKey('SNAPSHOT_0660') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_0660')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0660 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0650 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0650', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0650 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0650"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0650')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0650 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0640 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0640', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0640 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0640"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0640')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0640 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0630 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0630', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0630 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0630"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0630')); + await button1.click(); + let velocity: string = getInspectorByKey('SNAPSHOT_0630') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_0630')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0630 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0620 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0620', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0620 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0620"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0620')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0620 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0610 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0610', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0610 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0610"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0610')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0610 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0600 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0600', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0600 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0600"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0600')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0600 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0590 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0590', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0590 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0590"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0590')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0590 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0580 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0580', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0580 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0580"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0580')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0580 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0570 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0570', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0570 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0570"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0570')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0570 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0560 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0560', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0560 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0560"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0560')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0560 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0280 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0280', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0280 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0280"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0280')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0280 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0290 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0290', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0290 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0290"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0290')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0290 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1080 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1080 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1080"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1080')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1080 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1090 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1090 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1090"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1090')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1090 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1100 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1100 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1100"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1100')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1100 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1110 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1110 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1110"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1110')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1110 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1120 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1120 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1120"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1120')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1120 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1130 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1130 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1130"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1130')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1130 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1140 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1140', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1140 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1140"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1140')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1140 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1150 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1150', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1150 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1150"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1150')); + await button1.click(); + let velocity: string = getInspectorByKey('SNAPSHOT_1150') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_1150')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1150 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1160 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1160', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1160 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1160"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1160')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1160 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1170 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1170', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1170 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1170"); + await Utils.sleep(2000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1170')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('SNAPSHOT_1170') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_1170')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1170 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1180 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1180', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1180 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1180"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1180')); + await button1.click(); + let velocity: string = getInspectorByKey('SNAPSHOT_1180') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_1180')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1180 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1190 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1190', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1190 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1190"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1190')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1190 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1200 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1200', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1200 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1200"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1200')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1200 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1210 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1210', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1210 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1210"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1210')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1210 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1220 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1220', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1220 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1220"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1220')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1220 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1230 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1230', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1230 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1230"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1230')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1230 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1240 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1240', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1240 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1240"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1240')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1240 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1250 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1250', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1250 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1250"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1250')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1250 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1260 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1260', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1260 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1260"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1260')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1260 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1270 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1270', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1270 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1270"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1270')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1270 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1280 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1280', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1280 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1280"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1280')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1280 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1290 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1290', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1290 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1290"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1290')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1290 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1300 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1300', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1300 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1300"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1300')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1300 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1310 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1310', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1310 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1310"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1310')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1310 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1320 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1320', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1320 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1320"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1320')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1320 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1330 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1330', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1330 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1330"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1330')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1330 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1340 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1340', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1340 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1340"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1340')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1340 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1350 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1350', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1350 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1350"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1350')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1350 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1360 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1360', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1360 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1360"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1360')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1360 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1370 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1370', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1370 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1370"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1370')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1370 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1380 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1380', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1380 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1380"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1380')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('UI_SNAPSHOT_1380') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_1380')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1380 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1390 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1390', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1390 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1390"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1390')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1390 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1400 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1400', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1400 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1400"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1400')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1400 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1410 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1410', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1410 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1410"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1410')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1410 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1430 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1430', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1430 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1430"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1430')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('UI_SNAPSHOT_1430') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let velocity2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_1430')); + await velocity2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1430 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1440 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1440', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1440 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1440"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1440')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1440 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1450 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1450', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1450 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1450"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1450')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1450 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1460 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1460', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1460 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1460"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1460')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1460 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1470 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1470', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1470 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1470"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1470')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1470 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1480 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1480', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1480 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1480"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1480')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1480 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1490 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1490', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1490 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1490"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1490')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1490 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1500 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1500', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1500 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1500"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1500')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1500 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1510 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1510', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1510 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1510"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1510')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1510 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1520 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1520', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1520 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1520"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1520')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1520 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1530 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1530', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1530 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1530"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1530')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1530 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1540 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1540', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1540 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1540"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1540')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1540 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1550 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1550', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1550 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1550"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1550')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1550 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1560 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1560', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1560 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1560"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1560')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1560 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1580 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1580', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1580 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1580"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1580')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1580 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1820 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1820', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1820 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1820"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1820')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1820 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1830 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1830', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1830 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1830"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1830')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1830 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1840 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1840', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1840 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1840"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1840')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('SNAPSHOT_1840'); + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_1840')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1840 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1850 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1850', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1850 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1850"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1850')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1850 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1860 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1860', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1860 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1860"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1860')); + let velocity: string = getInspectorByKey('SNAPSHOT_1860') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_1860')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1860 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1870 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1870', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1870 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1870"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1870')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1870 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1880 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1880', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1880 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1880"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1880')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1880 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1890 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1890', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1890 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1890"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1890')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1890 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1960 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1960', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1960 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1960"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1960')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1960 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1970 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1970', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1970 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1970"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1970')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1970 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1980 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1980', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1980 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1980"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1980')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1980 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1990 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1990', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1990 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1990"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1990')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1990 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2000 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2000', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2000 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2000"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2000')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2000 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2010 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2010 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2010"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2010')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2010 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2020 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2020 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2020"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2020')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2020 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2030 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2030 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2030"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2030')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2030 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2040 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2040', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2040 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2040"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2040')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2040 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2050 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2050 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2050"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2050')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2050 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2060 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2060', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2060 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2060"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2060')); + await button1.click(); + let velocity: string = getInspectorByKey('SNAPSHOT_2060') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2060')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2060 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2070 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2070', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2070 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2070"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2070')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2070 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2080 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2080 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2080"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2080')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2080 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2090 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2090 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2090"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2090')); + await button1.click(); + let velocity: string = getInspectorByKey('SNAPSHOT_2090') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2090')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2090 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2100 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2100 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2100"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2100')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2100 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2110 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2110 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2110"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2110')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2110 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2120 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2120 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2120"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2120')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2120 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2130 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2130 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2130"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2130')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2130 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2140 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2140', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2140 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2140"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2140')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2140 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2150 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2150', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2150 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2150"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2150')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2150 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2160 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2160', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2160 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2160"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2160')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2160 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2170 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2170', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2170 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2170"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2170')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2170 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2180 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2180', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2180 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2180"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2180')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2180 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2190 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2190', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2190 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2190"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2190')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2190 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2200 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2200', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2200 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2200"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2200')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2200 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2210 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2210', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2210 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2210"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2210')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2210 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2220 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2220', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2220 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2220"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2220')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2220 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2230 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2230', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2230 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2230"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2230')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2230 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2240 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2240', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2240 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2240"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2240')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('UI_SNAPSHOT_2240') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2240')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2240 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2250 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2250', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2250 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2250"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2250')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2250 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2260 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2260', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2260 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2260"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2260')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2260 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2270 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2270', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2270 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2270"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2270')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2270 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2280 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2280', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2280 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2280"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2280')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2280 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2290 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2290', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2290 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2290"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2290')); + let velocity: string = getInspectorByKey('SNAPSHOT_2290'); + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2290')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2290 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2300 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2300', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2300 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2300"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2300')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2300 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2310 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2310', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2310 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2310"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2310')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2310 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2320 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2320', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2320 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2320"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2320')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2320 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2330 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2330', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2330 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2330"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2330')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('SNAPSHOT_2330'); + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2330')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2330 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2340 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2340', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2340 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2340"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2340')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2340 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2350 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2350', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2350 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2350"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2350')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2350 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2360 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2360', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2360 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2360"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2360')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('SNAPSHOT_2360'); + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2360')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2360 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2370 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2370', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2370 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2370"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2370')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2370 finish.'); + done(); + + + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2380 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2380', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2380 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2380"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2380')); + await button1.click(); + let velocity: string = getInspectorByKey('SNAPSHOT_2380') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2380')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2380 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2390 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2390', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2390 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2390"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2390')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2390 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2400 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2400', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2400 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2400"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2400')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2400 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2410 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2410', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2410 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2410"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2410')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2410 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2420 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2420', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2420 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2420"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2420')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2420 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2430 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2430', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2430 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2430"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2430')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2430 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2440 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2440', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2440 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2440"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2440')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('SNAPSHOT_2440'); + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2440')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2440 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2510 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2510', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2510 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2510"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2510')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2510 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2520 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2520', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2520 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2520"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2520')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2520 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2530 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2530', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2530 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2530"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2530')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2530 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2540 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2540', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2540 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2540"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2540')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2540 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2550 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2550', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2550 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2550"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2550')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2550 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2560 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2560', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2560 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2560"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2560')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2560 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2570 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2570', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2570 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2570"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2570')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2570 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2580 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2580', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2580 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2580"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2580')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('SNAPSHOT_2580'); + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2580')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2580 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2590 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2590', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2590 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2590"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2590')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2590 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2600 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2600', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2600 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2600"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2600')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('SNAPSHOT_2600'); + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2600')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2600 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2610 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2610', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2610 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2610"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2610')); + await button1.click(); + await Utils.sleep(1000); + let velocity: string = getInspectorByKey('SNAPSHOT_2610'); + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2610')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2610 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2620 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2620', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2620 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2620"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2620')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2620 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2630 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2630', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2630 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2630"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2630')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2630 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2640 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2640', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2640 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2640"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2640')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2640 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2650 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2650', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2650 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2650"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2650')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2650 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2660 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2660', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2660 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2660"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2660')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2660 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2670 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2670', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2670 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2670"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2670')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2670 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2680 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2680', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2680 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2680"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2680')); + let velocity: string = getInspectorByKey('SNAPSHOT_2680') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2680')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2680 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2690 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2690', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2690 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2690"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2690')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2690 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2700 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2700', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2700 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2700"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2700')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2700 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2710 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2710', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2710 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2710"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2710')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2710 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2720 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2720', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2720 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2720"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2720')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2720 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2730 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2730', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2730 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2730"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2730')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2730 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2740 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2740', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2740 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2740"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2740')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2740 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2750 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2750', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2750 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2750"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2750')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2750 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2760 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2760', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2760 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2760"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2760')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2760 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2770 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2770', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2770 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2770"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2770')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2770 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2780 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2780', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2780 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2780"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2780')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2780 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2790 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2790', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2790 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2790"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2790')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2790 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2800 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2800', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2800 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2800"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2800')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2800 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2810 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2810', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2810 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2810"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2810')); + await button1.click(); + let velocity: string = getInspectorByKey('SNAPSHOT_2810') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_20810')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2810 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2820 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2820', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2820 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2820"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2820')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2820 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2830 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2830', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2830 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2830"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2830')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2830 finish.'); + done(); + }) + + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2840 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2840', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2840 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2840"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2840')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2840 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2860 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2860', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2860 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2860"); + await Utils.sleep(1000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2860')); + await button1.click(); + let velocity: string = getInspectorByKey('SNAPSHOT_2860') + let showname: ESObject = JSON.parse(velocity).$attrs.content; + for (let i = 0; i <= 50; i++) { + if (showname == "100001") { + break; + } else { + button1.click(); + } + } + await Utils.sleep(1000); + let button2: Component = await driver.findComponent(ON.id('btnSNAPSHOT_2860')); + await button2.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2860 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2940 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2940', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2940 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2940"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2940')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2940 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_2950 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_2950', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2950 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2950"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_2950')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2950 finish.'); + done(); + }) + + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1770 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1770', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1770 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1770"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1770')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1770 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1750 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1750', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1750 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1750"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1750')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1750 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1670 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1670', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1670 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1670"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1670')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1670 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1690 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1690', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1690 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1690"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1690')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1690 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1640 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1640', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1640 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1640"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1640')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1640 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1630 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1630', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1630 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1630"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1630')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1630 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1660 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1660', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1660 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1660"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1660')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1660 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1650 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1650', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1650 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1650"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1650')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1650 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1680 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1680', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1680 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1680"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1680')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1680 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1700 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1700', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1700 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1700"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1700')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1700 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1730 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1730', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1730 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1730"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1730')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1730 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1740 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1740', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1740 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1740"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1740')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1740 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1710 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1710', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1710 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1710"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1710')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1710 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_1720 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_1720', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1720 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1720"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_1720')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1720 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0150 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0150', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0150 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0150"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0150')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0150 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0130 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0130', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0130 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0130"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0130')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0130 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0050 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0050', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0050 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0050"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0050')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0050 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0070 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0070', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0070 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0070"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0070')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0070 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0020 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0020', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0020 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0020"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0020')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0020 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0010 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0010 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0010"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0010')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0010 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0040 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0040', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0040 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0040"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0040')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0040 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0030 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0030', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0030 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0030"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0030')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0030 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0060 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0060', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0060 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0060"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0060')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0060 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0080 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0080', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0080 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0080"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0080')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0080 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0110 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0110', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0110 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0110"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0110')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0110 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0120 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0120', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0120 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0120"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0120')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0120 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0090 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0090', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0090 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0090"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0090')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0090 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0100 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0100', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0100 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0100"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0100')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0100 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0340 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0340', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0340 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0340"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0340')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0340 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0320 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0320', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0320 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0320"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0320')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0320 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0240 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0240', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0240 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0240"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0240')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0240 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0260 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0260', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0260 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0260"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0260')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0260 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0210 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0210', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0210 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0210"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0210')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0210 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0200 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0200', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0200 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0200"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0200')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0200 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0230 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0230', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0230 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0230"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0230')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0230 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0220 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0220', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0220 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0220"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0220')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0220 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0250 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0250', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0250 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0250"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0250')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0250 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0270 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0270', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0270 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0270"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0270')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0270 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0300 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0300', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0300 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0300"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0300')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0300 finish.'); + done(); + }) + /* + * @tc.number SUB_ACE_UI_SNAPSHOT_0310 + * @tc.desc focus event + */ + it('SUB_ACE_UI_SNAPSHOT_0310', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0310 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0310"); + await Utils.sleep(3000); + let driver: Driver = Driver.create(); + let button1: Component = await driver.findComponent(ON.id('ui_snapshot_0310')); + await button1.click(); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(4000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0310 finish.'); + done(); + }) + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0140 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0140', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0140 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0140"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0140 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0160 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0160', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0160 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0160"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0160 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0170 + * @tc.name SNAPSHOT + * @tc.desc set scale and wait + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0170', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0170 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0170"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0170 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0180 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0180', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0180 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0180"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0180 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0190 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0190', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0190 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0190"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0190 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0360 + * @tc.name SNAPSHOT + * @tc.desc set scale and wait + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0360', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0360 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0360"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gPromise")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0360 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0370 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0370', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0370 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0370"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gPromise = await driver.findComponent(ON.id("gPromise")); + await gPromise.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0370 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0330 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0330', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0330 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0330"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gPromise = await driver.findComponent(ON.id("gPromise")); + await gPromise.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0330 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0350 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0350', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0350 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0350"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gPromise = await driver.findComponent(ON.id("gPromise")); + await gPromise.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0350 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0380 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0380', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0380 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0380"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gPromise = await driver.findComponent(ON.id("gPromise")); + await gPromise.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0380 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0390 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0390', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0390 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0390"); + await Utils.sleep(1000); + let driver = Driver.create(); + let callback = await driver.findComponent(ON.id("bCallback")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0390 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0400 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0400', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0400 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0400"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for(let i = 0; i < 3; i++){ + await addDelay.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bCallback")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0400 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0420 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0420', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0420 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0420"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for(let i = 0; i < 5; i++){ + await addDelay.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bCallback")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0420 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0410 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0410', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0410 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0410"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for(let i = 0; i < 2; i++){ + await addDelay.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bCallback")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0410 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0430 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0430', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0430 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0430"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + await addDelay.click(); + + let callback = await driver.findComponent(ON.id("bCallback")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0430 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0440 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0440', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0440 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0440"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for(let i = 0; i < 4; i++){ + await addDelay.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bCallback")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0440 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0450 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0450', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0450 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0450"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for(let i = 0; i < 6; i++){ + await addDelay.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bCallback")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0450 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0460 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0460', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0460 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0460"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for(let i = 0; i < 7; i++){ + await addDelay.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bCallback")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0460 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0530 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0530', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0530 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0530"); + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0530 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0540 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0540', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0540 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0540"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + await addDelay.click(); + + let check = await driver.findComponent(ON.id("check")); + for(let i = 0; i < 2; i++){ + await check.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bCallback")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0540 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0550 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0550', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0550 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0550"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for(let i = 0; i < 7; i++){ + await addDelay.click(); + await Utils.sleep(200); + } + let check = await driver.findComponent(ON.id("check")); + await check.click(); + let callback = await driver.findComponent(ON.id("bCallback")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0550 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0910 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0910', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0910 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0910"); + await Utils.sleep(1000); + let driver = Driver.create(); + let callback = await driver.findComponent(ON.id("bPromise")); + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0910 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0920 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0920', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0920 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0920"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for (let i = 0; i < 3; i++) { + await addDelay.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bPromise")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0920 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0930 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0930', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0930 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0930"); + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0930 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0940 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0940', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0940 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0940"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for (let i = 0; i < 5; i++) { + await addDelay.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bPromise")); + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0940 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0950 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0950', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0950 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0950"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + await addDelay.click(); + let callback = await driver.findComponent(ON.id("bPromise")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0950 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0960 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0960', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0960 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0960"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for(let i = 0; i < 4; i++){ + await addDelay.click(); + await Utils.sleep(200); + } + let callback = await driver.findComponent(ON.id("bPromise")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0960 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0970 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0970', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0970 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0970"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for (let i = 0; i < 6; i++) { + await addDelay.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bPromise")); + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0970 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0980 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0980', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0980 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0980"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for (let i = 0; i < 7; i++) { + await addDelay.click(); + await Utils.sleep(200); + } + + let callback = await driver.findComponent(ON.id("bPromise")); + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0980 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_0990 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_0990', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0990 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot0990"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for(let i = 0; i < 7; i++){ + await addDelay.click(); + await Utils.sleep(200); + } + let callback = await driver.findComponent(ON.id("bPromise")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_0990 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1000 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1000', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1000 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1000"); + await Utils.sleep(1000); + let driver = Driver.create(); + let check = await driver.findComponent(ON.id("check")); + for(let i = 0; i < 2; i++){ + await check.click(); + await Utils.sleep(200); + } + let callback = await driver.findComponent(ON.id("bPromise")) + await callback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1000 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1010 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1010', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1010 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1010"); + await Utils.sleep(1000); + let driver = Driver.create(); + let addDelay = await driver.findComponent(ON.id("delay++")); + for(let i = 0; i < 2; i++){ + await addDelay.click(); + await Utils.sleep(200); + } + let check = await driver.findComponent(ON.id("check")); + await check.click(); + + let callback = await driver.findComponent(ON.id("bPromise")) + await callback.click(); + + await Utils.sleep(3000); + await windowSnap.snapShot(); + await Utils.sleep(2000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1010 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1570 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1570', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1570 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1570"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1570 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1590 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1590', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1590 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1590"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1590 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1600 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1600', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1600 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1600"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1600 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1610 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1610', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1610 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1610"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1610 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1620 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1620', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1620 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1620"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1620 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1760 + * @tc.name SNAPSHOT + * @tc.desc set scale and wait + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1760', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1760 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1760"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gPromise")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1760 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1780 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1780', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1780 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1780"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gPromise")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1780 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1790 + * @tc.name SNAPSHOT + * @tc.desc set scale and wait + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1790', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1790 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1790"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gCallback")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1790 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1800 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1800', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1800 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1800"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gPromise")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1800 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_1810 + * @tc.name SNAPSHOT + * @tc.desc set shadow:true + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_1810', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1810 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot1810"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("gPromise")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_1810 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_2880 + * @tc.name SNAPSHOT + * @tc.desc print log + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_2880', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2880 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2880"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("builderPromise")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2880 finish.'); + done(); + }) + + /** + * @tc.number SUB_ACE_UI_SNAPSHOT_2870 + * @tc.name SNAPSHOT + * @tc.desc print log + * @tc.level Level 3 + */ + it('SUB_ACE_UI_SNAPSHOT_2870', 0, async (done: Function) => { + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2870 start.'); + Settings.createWindow("testability/pages/UISnapshot/UISnapshot2870"); + await Utils.sleep(1000); + let driver = Driver.create(); + let gCallback = await driver.findComponent(ON.id("builderPromise")); + await gCallback.click(); + + await Utils.sleep(2000); + await windowSnap.snapShot(); + await Utils.sleep(1000); + Logger.info('TEST', 'SUB_ACE_UI_SNAPSHOT_2870 finish.'); + done(); + }) + }) +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Logger.ts b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Logger.ts new file mode 100644 index 0000000000000000000000000000000000000000..d8e65ace14fe8912c61a0b31c60ba5c767f116f1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Logger.ts @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2024 Huawei Device 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 hilog from '@ohos.hilog'; + +class Logger { + private domain: number; + private prefix: string; + private format: string = "%{public}s, %{public}s"; + + constructor(prefix: string) { + this.prefix = prefix; + this.domain = 0xFF00; + } + + debug(...args: any[]) { + hilog.debug(this.domain, this.prefix, this.format, args); + } + + info(...args: any[]) { + hilog.info(this.domain, this.prefix, this.format, args); + } + + warn(...args: any[]) { + hilog.warn(this.domain, this.prefix, this.format, args); + } + + error(...args: any[]) { + hilog.error(this.domain, this.prefix, this.format, args); + } +} + +export default new Logger('[Screenshot]'); \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Settings.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Settings.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d658dc1e2599bfe1f00e5a64aa61ec2965fbdfc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Settings.ets @@ -0,0 +1,320 @@ +/* + * Copyright (C) 2024 Huawei Device 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 screen from '@ohos.screen'; +import window from '@ohos.window'; +import Logger from './Logger'; +import { GlobalThis } from './globalThis' +import { BusinessError } from '@ohos.base' +import Window from '@ohos.window' +import common from '@ohos.app.ability.common'; +import { i18n } from '@kit.LocalizationKit'; +import { router } from '@kit.ArkUI'; + +const TAG: string = '[TEST]'; + +async function sleep(time: number): Promise { + const result: string = await new Promise((resolve: Function) => { + setTimeout(() => { + resolve('sleep ok') + }, time) + }); + console.info(result); +} + +class Settings { + isPhone: boolean = false; + windowClass: window.Window | undefined = undefined + windowCreateType: string = "changeWindow"; + private static DEFAULT_WIDTH: number = 720; + private static DEFAULT_HEIGHT: number = 1412; + private static DEFAULT_DPI: number = 240; + private static DEFAULT_OFFSET_X: number = 100; + private static DEFAULT_OFFSET_Y: number = 132; + private portrait: boolean = true + + changeWindowPosition(windowClass: window.Window, X: number | undefined, Y: number | undefined) { + //为悬浮窗设置位置 + windowClass.moveWindowTo(X, Y, (err) => { + if (err.code) { + Logger.error(TAG, `Failed to move the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info(TAG, 'Succeed moveWindowTo.'); + }) + } + + changeWindowSize(windowClass: window.Window, width: number | undefined, height: number | undefined) { + //为悬浮窗设置大小 + windowClass.resize(width, height, (err) => { + if (err.code) { + Logger.error(TAG, `Failed to change the window size. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info(TAG, 'Succeed changeWindowSize'); + }) + } + + loadContent(windowClass: window.Window, pageURI: string) { + //为悬浮窗加载对应的目标页面 + windowClass.setUIContent(pageURI, (err) => { + if (err.code) { + Logger.error(TAG, `Failed to load the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info(TAG, `Succeeded in loading the content.`); + + //显示悬浮窗 + windowClass.showWindow((err) => { + if (err.code) { + Logger.error(TAG, `Failed to show the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info(TAG, `Succeeded in showing the window.`); + }) + }) + } + + loadContentChange(windowClass: window.Window, pageURI: string) { + //为悬浮窗加载对应的目标页面 + windowClass.setUIContent(pageURI, (err) => { + if (err.code) { + Logger.error(TAG, `Failed to load the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info(TAG, `Succeeded in loading the content.`); + + }) + } + + changeDpi(dpi: number) { + let screenClass: screen.Screen; + screen.getAllScreens((err: BusinessError, data: Array) => { + if (err.code) { + Logger.error(TAG, `Failed to get all screens. Cause : ${JSON.stringify(err)}`); + return; + } + Logger.info(TAG, `Succeeded in getting all screens. Data:${JSON.stringify(data)}`); + + screenClass = data[0]; + //设置设备dpi + screenClass.setDensityDpi(dpi, (err: BusinessError) => { + if (err.code) { + Logger.error(TAG, `Failed to set the pixel density. Code : ${JSON.stringify(err)}`) + return; + } + Logger.info(TAG, `Succeeded in setting the pixel density`); + }) + }) + } + + setWindowSystemBarEnable(windowClass: window.Window, names: Array<'status' | 'navigation'>) { + windowClass.setWindowSystemBarEnable(names, (err: BusinessError) => { + const errCode: number = err.code; + if (errCode) { + Logger.error(TAG, 'Failed to set the system bar to be invisible. Cause:' + JSON.stringify(err)) + return; + } + Logger.info(TAG, `Succeeded in set the system bar to be invisible`); + }); + } + + destroyWindow(windowClass: window.Window) { + if (!this.isPhone) { + //销毁窗口 + windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error(TAG, `Failed to destroy the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info(TAG, `Succeeded in destroy the window.`); + }) + } + } + + /* + * 窗口页面更新 + * Setting.createWindow(pageURI: String, {X,Y,width,height,dpi}?:{X?:number,Y?:number,width?:number,height?:number,dpi?:number}):void + * 必填: + * pageURI:页面路由 + * 选填: + * X,Y:窗口相对于左上角的位置,默认X=100,Y=100 单位为px + * width,height:窗口宽高,默认width=600,height=1250 可配置范围:[0,2560],单位为vp + * dpi:像素密度,默认dpi=330,可配置范围:80-640 + * */ + + createWindow(pageURI: string, X?: number | undefined, Y?: number | undefined, width?: number | undefined, + height?: number | undefined, dpi?: number | undefined) { + if (!this.isPhone) { + this.windowCreateType = "createWindow" + if (X == undefined) { + X = Settings.DEFAULT_OFFSET_X; + } + if (Y == undefined) { + Y = Settings.DEFAULT_OFFSET_Y; + } + if (width == undefined) { + width = Settings.DEFAULT_WIDTH; + } + if (height == undefined) { + height = Settings.DEFAULT_HEIGHT - Settings.DEFAULT_OFFSET_Y; + } + if (dpi == undefined) { + dpi = Settings.DEFAULT_DPI; + } + Logger.info(TAG, `params,pageURI=${pageURI},X=${X},Y=${Y},width=${width},height=${height},dpi=${dpi}`) + this.changeDpi(dpi) + sleep(1000) + let config: window.Configuration = { + name: "floatWindow", + windowType: window.WindowType.TYPE_FLOAT, + ctx: GlobalThis.getInstance().getContext('context') + }; + + window.createWindow(config, (err, data) => { + if (err.code) { + Logger.error(TAG, `Failed to create the floatWindow. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info(TAG, `Succeeded in creating the floatWindow. Data : ${JSON.stringify(err)}`); + this.windowClass = data; + this.changeWindowPosition(this.windowClass, X, Y); + this.changeWindowSize(this.windowClass, width, height); + this.loadContent(this.windowClass, pageURI) + }) + } else { + try { + router.pushUrl({ + url: pageURI + }) + Logger.info(TAG, `params,pageURI=${pageURI}`) + } catch (e) { + Logger.error(TAG, `params,pageURI=${pageURI} errpr ${e}`) + } + } + } + + async changeWindow(pageURI: string, width?: number | undefined, height?: number | undefined, + dpi?: number | undefined) { + if (!this.isPhone) { + this.windowCreateType = "changeWindow" + if (width == undefined) { + width = Settings.DEFAULT_WIDTH; + } + if (height == undefined) { + height = Settings.DEFAULT_HEIGHT - Settings.DEFAULT_OFFSET_Y; + } + if (dpi == undefined) { + dpi = Settings.DEFAULT_DPI; + } + Logger.info(TAG, `params,pageURI=${pageURI},width=${width},height=${height},dpi=${dpi}`) + this.changeDpi(dpi) + await sleep(500) + window.getLastWindow(GlobalThis.getInstance().getContext('context'), async (err: BusinessError, data) => { + const errCode: number = err.code; + if (errCode) { + Logger.error(TAG, 'Failed to obtain the top Window. Cause : ' + JSON.stringify(err)); + return; + } + Logger.info(TAG, 'succeed to obtain the top Window. Cause : ' + JSON.stringify(err)); + this.windowClass = data; + await sleep(200) + this.loadContent(this.windowClass, pageURI) + await sleep(200) + this.changeWindowSize(this.windowClass, width, height); + await sleep(200) + this.setWindowSystemBarEnable(this.windowClass, []); + }); + } else { + await router.pushUrl({ url: pageURI }) + } + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch Locales,appPreferredLanguage2=${appPreferredLanguage2}`); + } + + /** + * 切换应用内部语言 + */ + switchLocales() { + let currentLanguages = i18n.System.getSystemLanguages(); + let systemLocale: string = i18n.System.getSystemLocale(); // 获取系统当前Locale + let systemRegion: string = i18n.System.getSystemRegion(); // 获取系统当前地区设置 + let appPreferredLanguage: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch Locales,current currentLanguages=${currentLanguages} + ,systemLocale=${systemLocale},systemRegion=${systemRegion},appPreferredLanguage=${appPreferredLanguage}`); + try { + i18n.System.setAppPreferredLanguage('ug-CN'); // 设置系统当前Locale为 "zh-CN" + } catch (error) { + let err: BusinessError = error as BusinessError; + console.error(`call System.setAppPreferredLanguage failed, error code: ${err.code}, message: ${err.message}.`); + } + let appPreferredLanguage2: string = i18n.System.getAppPreferredLanguage(); // 获取应用偏好语言 + console.log(`Switch Locales,appPreferredLanguage2=${appPreferredLanguage2}`); + } + + changeOrientation(object?: Object) { + // 获取上下文,使用common模块 + let context = getContext() + let promise = Window.getLastWindow(context); + promise.then((data) => { + let windowClass = data; + if (this.portrait) { + //切换成横屏 + let orientation = Window.Orientation.LANDSCAPE; + windowClass.setPreferredOrientation(orientation, (err) => { + + }); + // windowSnap.snapShot() + this.portrait = !this.portrait + console.info('LANDSCAPE Succeeded in obtaining the top window. Data: ' + JSON.stringify(data)); + } else { + //切换成竖屏 + let orientation = Window.Orientation.PORTRAIT; + windowClass.setPreferredOrientation(orientation, (err) => { + }); + this.portrait = !this.portrait + console.info('PORTRAIT Succeeded in obtaining the top window. Data: ' + JSON.stringify(data)); + } + }).catch((err: BusinessError) => { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err)); + }); + } + + setOrientation() { + try { + window.getLastWindow(getContext(this), (err, data) => { // 获取window实例 + if (err.code) { + return; + } + let windowClass = data; + + let orientation = window.Orientation.LANDSCAPE; // 设置窗口方向为传感器自动旋转模式。 + try { + windowClass.setPreferredOrientation(orientation, (err) => { + if (err.code) { + return; + } + }); + } catch (exception) { + } + ; + }); + } catch (exception) { + } + ; + } +} + +export default new Settings() \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Utils.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..7f06aa4d872061e0682441fd8f47b33730bc78c1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/Utils.ets @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2024 Huawei Device 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 {Driver , ON} from '@ohos.UiTest' + +export default class Utils { + + static async sleep(time : number) :Promise { + const result:string = await new Promise((resolve:Function)=>{ + setTimeout(()=> { + resolve('sleep ok') + },time) + }); + console.info(result); + } + static async waitAsync (ms:number):Promise{ + return new Promise((resolve)=>{ + setTimeout(resolve,ms) + }) + + } + + static async clickComponentByKey (componentKey :string){ + let driver = Driver.create(); + let component = await driver.findComponent(ON.id(componentKey)) + await component.click(); + + } + + +} + + + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/globalThis.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/globalThis.ets new file mode 100644 index 0000000000000000000000000000000000000000..1fa18fbd244d65f4c78213b89d9d01e29e01eae6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/globalThis.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 Huawei Device 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 common from '@ohos.app.ability.common' + +// 构造单例对象 + +export class GlobalThis { + + private constructor() { + } + + private static instance:GlobalThis; + + private _uiContexts = new Map (); + + public static getInstance():GlobalThis { + + if (!GlobalThis.instance) { + GlobalThis.instance = new GlobalThis(); + + } + + return GlobalThis.instance + + } + getContext(key:string):common.UIAbilityContext | undefined { + + return this._uiContexts.get(key); + } + + setContext(key:string, value:common.UIAbilityContext) :void { + this._uiContexts.set(key,value); + } + + // 其他需要传递的类依次扩展 +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/snapShot.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/snapShot.ets new file mode 100644 index 0000000000000000000000000000000000000000..773f21352336973e8a11bce347632a45bd62dd62 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/test/model/snapShot.ets @@ -0,0 +1,268 @@ +/* + * Copyright (C) 2024 Huawei Device 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 window from '@ohos.window'; +import Logger from './Logger'; +import image from '@ohos.multimedia.image'; +import fs from '@ohos.file.fs'; +import common from '@ohos.app.ability.common' +import { GlobalThis } from './globalThis' +import screenshot from '@ohos.screenshot' +import { BusinessError } from '@ohos.base' +import Settings from './Settings'; +import { Driver } from '@kit.TestKit'; +import { display } from '@kit.ArkUI'; + +const TAG: string = '[TEST]'; + + +class windowSnap { + filePath(suffix: string, pageName ?: string) { + let context: common.UIAbilityContext | undefined = GlobalThis.getInstance().getContext('context') + Logger.info(TAG, 'deleteFile start'); + let pathDir = context ? context.filesDir : "/" + Logger.info(TAG, `deleteFile pathDir = ${pathDir}`) + // let name = pageName ? pageName : "test" + let name = "test" + if (suffix == null) { + suffix = 'webp' + } + let displayName = `IMG_${name}.${suffix}` + let filePath: string = pathDir + "/" + displayName; + Logger.info(TAG, 'createFile filePath = ${filePath}') + return filePath; + + } + + async deleteFile(filePath: string) { + let exists = await fs.access(filePath) + Logger.info(TAG, `oldFile exists = ${exists}`) + if (exists) { + fs.unlinkSync(filePath) + Logger.info(TAG, `remove file succeed`) + } + } + + createFile(filePath: string) { + return fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE) + } + + async save(filePath: string, data: image.PixelMap) { + let packOpts: image.PackingOption = { + format: "image/webp", quality: 100 + } + let imagePackerApi = image.createImagePacker() + let arrayBuffer = await imagePackerApi.packing(data, packOpts) + let file: fs.File | null = null; + while (file == null) { + file = this.createFile(filePath) + } + let exists = await fs.access(file.path) + Logger.info(TAG, `createFile exists = ${exists}`) + let fd = file.fd + Logger.info(TAG, `createFile fd = ${fd}`) + imagePackerApi.release() + try { + await fs.write(fd, arrayBuffer) + } catch (err) { + Logger.error(TAG, `write failed code is ${err.code},message is ${err.message}`) + } + fs.closeSync(file) + Logger.info(TAG, `write picture done`) + } + + async saveLog(content: string, name: string) { + let context: common.UIAbilityContext | undefined = GlobalThis.getInstance().getContext('context') + Logger.info(TAG, 'deleteFile start'); + let pathDir = context ? context.filesDir : "/" + Logger.info(TAG, `deleteFile pathDir = ${pathDir}`) + let displayName = `${name}.txt` + let filePath: string = pathDir + "/" + displayName; + let exists = await fs.access(filePath) + Logger.info(TAG, `oldFile exists = ${exists}`) + if (exists) { + fs.unlinkSync(filePath) + Logger.info(TAG, `remove file succeed`) + } + let file: fs.File | null = null; + while (file == null) { + file = this.createFile(filePath) + } + Logger.info(TAG, `createFile exists = ${exists}`) + let fd = file.fd + Logger.info(TAG, `createFile fd = ${fd}`) + try { + await fs.write(fd, content) + } catch (err) { + Logger.error(TAG, `write failed code is ${err.code},message is ${err.message}`) + } + fs.closeSync(file) + Logger.info(TAG, `write picture done`) + } + + /* + * 获取窗口结合&文件保存 + * 入参必填 ability的context + + * snapShot + * save:设备端保存路径:/data/app/el2/100/base/{bundle_name}/haps/entry_test/files/IMG_test.webp + * 查看命令:hdc_st shell ,cd + **/ + async snapShot(pageName?: string) { + Logger.info(TAG, 'start snapshot') + if (Settings.isPhone) { + try { + let filePath = "/data/storage/el2/base/haps/entry_test/files/IMG_test.png" + let webpFilePath = "/data/storage/el2/base/haps/entry_test/files/IMG_test.webp" + await this.deleteFile(filePath); + await this.deleteFile(webpFilePath); + let driver = Driver.create(); + let orientation = display.getDefaultDisplaySync().orientation; + //竖屏 + let captureRes: boolean; + if (orientation == window.Orientation.PORTRAIT || orientation == window.Orientation.UNSPECIFIED) { + captureRes = await driver.screenCapture(filePath, { + left: 0, + top: 100, + right: 1260, + bottom: 2720 + }) + + } else { + //横屏 + captureRes = await driver.screenCapture(filePath, { + left: 0, + top: 0, + right: 2720, + bottom: 1260 + }) + } + if (captureRes) { + Logger.info(TAG, 'Succeed screenCapture.') + } else { + Logger.info(TAG, 'failed screenCapture.') + } + await fs.copyFile(filePath, webpFilePath); + } catch (exception) { + Logger.error(TAG, 'failed to screenCapture .Cause : ' + JSON.stringify(exception)) + } + } else { + if (Settings.windowClass == undefined) { + Logger.info(TAG, 'getWindowClass error') + return; + } + Logger.info(TAG, 'find window success') + let filePath = this.filePath('webp', pageName) + await this.deleteFile(filePath); + Settings.windowClass.snapshot((err, data: image.PixelMap) => { + if (err.code) { + Logger.info('failed to snap window .cause : ' + JSON.stringify(err)) + return; + } + Logger.info(TAG, 'Succeed in saving screenshot. Pixel bytes number: ' + data.getPixelBytesNumber()) + this.save(filePath, data) + data.release(); + }); + } + } + + /* + * 获取窗口结合&文件保存 + * 入参必填 ability的context + * screenShot + * save:设备端保存路径:/data/app/el2/100/base/{bundle_name}/haps/entry_test/files/IMG_test.webp + * 查看命令:hdc_st shell ,cd + **/ + + async screenShot(pageName?: string) { + Logger.info(TAG, 'start screen shot') + if (Settings.isPhone) { + let filePath = "/data/storage/el2/base/haps/entry_test/files/IMG_test.png" + let webpFilePath = "/data/storage/el2/base/haps/entry_test/files/IMG_test.webp" + await this.deleteFile(filePath); + await this.deleteFile(webpFilePath); + let driver = Driver.create(); + try { + let orientation = display.getDefaultDisplaySync().orientation; + //竖屏 + let captureRes: boolean; + if (orientation == window.Orientation.PORTRAIT || orientation == window.Orientation.UNSPECIFIED) { + captureRes = await driver.screenCapture(filePath, { + left: 0, + top: 100, + right: 1260, + bottom: 2720 + }) + + } else { + //横屏 + captureRes = await driver.screenCapture(filePath, { + left: 0, + top: 0, + right: 2720, + bottom: 1260 + }) + } + if (captureRes) { + Logger.info(TAG, 'Succeed screenCapture.') + } else { + Logger.info(TAG, 'failed screenCapture.') + } + await fs.copyFile(filePath, webpFilePath); + } catch (exception) { + Logger.error(TAG, 'failed to screenCapture .Cause : ' + JSON.stringify(exception)) + } + } else { + if (Settings.windowClass == undefined) { + Logger.info(TAG, 'getWindowClass error') + return; + } + Logger.info(TAG, 'find window success') + let filePath = this.filePath('webp', pageName) + await this.deleteFile(filePath) + try { + let properties = Settings.windowClass.getWindowProperties(); + Logger.info(TAG, 'properties.windowRect = ' + JSON.stringify(properties)) + + let screenshotOptions: screenshot.ScreenshotOptions = { + "screenRect": properties.windowRect, + "imageSize": { + "width": properties.windowRect.width, + "height": properties.windowRect.height + } + }; + Logger.info(TAG, 'screenshotOptions: ' + JSON.stringify(screenshotOptions)); + try { + screenshot.save(screenshotOptions, (err: BusinessError, pixelMap: image.PixelMap) => { + if (err) { + Logger.info('failed to save screenshot .Code : ' + JSON.stringify(err)) + return; + } + Logger.info(TAG, 'Succeed in saving screenshot. Pixel bytes number: ' + pixelMap.getPixelBytesNumber()) + this.save(filePath, pixelMap) //pixelMap 保存生成文件 + pixelMap.release(); + }); + } catch (exception) { + Logger.error(TAG, 'failed to : save screenshot. code: ' + JSON.stringify(exception)); + } + + } catch (exception) { + Logger.error(TAG, 'failed to obtain the window properties .Cause : ' + JSON.stringify(exception)) + } + } + } +} + +export default new windowSnap() \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/TestAbility.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..956959276850fafb640ee420bd6cad3d971d7f05 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/TestAbility.ets @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import bundleManager from '@ohos.bundle.bundleManager'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import UIAbility from '@ohos.app.ability.UIAbility'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import hilog from '@ohos.hilog'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import window from '@ohos.window'; +import Logger from '../test/model/Logger' +import { GlobalThis } from '../test/model/globalThis' +import Want from '@ohos.app.ability.Want' +import AbilityConstant from '@ohos.app.ability.AbilityConstant'; + + +const TAG: string = '[TEST]' + +async function sleep(time: number): Promise { + const result: string = await new Promise((resolve: Function) => { + setTimeout(() => { + resolve('sleep ok') + }, time) + }); + console.info(result); +} + +export default class TestAbility extends UIAbility { + onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? ''); + let abilityDelegator: AbilityDelegatorRegistry.AbilityDelegator + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments: AbilityDelegatorRegistry.AbilityDelegatorArgs + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: window.WindowStage) { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + GlobalThis.getInstance().setContext("context", this.context) + + // + let atManager = abilityAccessCtrl.createAtManager(); + let appFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION; + let permissionFlags = 0; + bundleManager.getBundleInfoForSelf(appFlags, (err, data) => { + if (err) { + Logger.error(TAG, 'getAllApplicationInfo failed: %{public}s', err.message); + console.error("") + } + let tokenID = + data.appInfo.accessTokenId; //系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 + atManager.grantUserGrantedPermission(tokenID, 'ohos.permission.READ_MEDIA', permissionFlags, (err, data) => { + if (err) { + Logger.info(TAG, `grantUserGrantedPermission fail, err->${JSON.stringify(err)}`) + } + }) + atManager.grantUserGrantedPermission(tokenID, 'ohos.permission.WRITE_MEDIA', permissionFlags, (err, data) => { + if (err) { + Logger.info(TAG, `grantUserGrantedPermission fail, err->${JSON.stringify(err)}`) + } + }) + }) + + } + + onWindowStageDestroy() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0010.ets new file mode 100644 index 0000000000000000000000000000000000000000..54ffeb4bcbe428b324a367e942296496e7b6689e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0010.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0010 { + @State text: string = '' + @State eventType: string = '' + @State buttonColor: string = '#87CEFA' + @State modifier: ButtonModifier = new ButtonModifier().onTouch(undefined) + + build() { + Column() { + Button('onTouch') + .id("ActionEventAttributeModifier0010_001") + .backgroundColor(this.buttonColor) + .width(260) + .height(70) + .margin(20) + .fontColor(Color.Black) + .attributeModifier(this.modifier) + + Text('点我设置参数') + .id("ActionEventAttributeModifier0010_002") + .onClick(() => { + this.modifier = new ButtonModifier().onTouch((event) => { + this.buttonColor = '#FF0000' + this.text = 'outer button touched type: ' + (event as TouchEvent).type + }) + }) + Text(this.text).padding(15) + }.height(300).width('100%').padding(35) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..e7e4c9c0f269c31fdf055f85562acd12e79a2249 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0020.ets @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0020 { + @State text: string = '' + @State eventType: string = '' + @State buttonColor: string = '#87CEFA' + @State modifier: ButtonModifier = new ButtonModifier().onTouch((event) => { + this.buttonColor = '#FF0000' + this.text = 'outer button touched type: ' + (event as TouchEvent).type + }) + + build() { + Column() { + Button('onTouch') + .id("ActionEventAttributeModifier0020_001") + .backgroundColor(this.buttonColor) + .width(260) + .height(70) + .margin(20) + .fontColor(Color.Black) + .attributeModifier(this.modifier) + + Text('点我设置参数') + .id("ActionEventAttributeModifier0020_002") + .onClick(() => { + this.modifier = new ButtonModifier().onTouch(undefined) + this.buttonColor = '#87CEFA' + this.text = '' + }) + Text(this.text).padding(15) + }.height(300).width('100%').padding(35) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..b145637f61c3618efe2efe811ad0347de6a8b60c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0030.ets @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { TextModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0030 { + @State value: string = 'onAreaChange' + @State text: string = '' + @State modifier: TextModifier = new TextModifier().onClick(() => { + { + this.value = this.value + 'onAreaChange' + } + }) + .onAreaChange((newValue: Area) => { + this.text = JSON.stringify(newValue) + }) + + build() { + Column() { + Row({ space: 20 }) { + Text(this.value) + .margin(30) + .fontSize(20) + .attributeModifier(this.modifier) + .id("ActionEventAttributeModifier0030_001") + }.margin(20) + + Text(this.text).margin(15) + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c72fc0ed554a09436f213b76af5e02062761b4e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0040.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0040 { + @State value: string = 'OnSizeChange' + @State text: string = '' + @State modifier: ButtonModifier = new ButtonModifier().onClick(() => { + { + this.value = this.value + 'OnSizeChange' + } + }) + .onSizeChange((newValue: SizeOptions) => { + this.text = JSON.stringify(newValue) + + }) + + build() { + Column() { + Row({ space: 20 }) { + Button(this.value).height(40).attributeModifier(this.modifier) + .id("ActionEventAttributeModifier0040_001") + }.margin(20) + + Text(this.text).margin(15) + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..96b08d4503e6d10f6bbec8d42ff995f78b0eef07 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0050.ets @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0050 { + @State isShow: boolean = true + @State text: string = '' + @State modifier: ButtonModifier = new ButtonModifier().onDisAppear(() => { + this.text = 'Button is hidden' + }) + + build() { + Column() { + Button('点击卸载组件') + .id("ActionEventAttributeModifier0050_001") + .onClick(() => { + this.isShow = !this.isShow + }).margin(15) + if (this.isShow) { + Button("onDisAppear") + .attributeModifier(this.modifier) + .backgroundColor('#87CEFA') + .width(260) + .height(70) + .margin(20) + } + Text(this.text).margin(15) + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0060.ets new file mode 100644 index 0000000000000000000000000000000000000000..ede34e77ffe5bc3f419921c29cbf5831c3ef198f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0060.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0060 { + @State isShow: boolean = false + @State text: string = '' + @State modifier: ButtonModifier = new ButtonModifier().onAppear(() => { + this.text = 'Button is shown' + }) + + build() { + Column() { + Button('点击挂载组件') + .id("ActionEventAttributeModifier0060_001") + .onClick(() => { + this.isShow = !this.isShow + }).margin(15) + if (this.isShow) { + Button("onAppear").attributeModifier(this.modifier) + } + Text(this.text).margin(15) + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0070.ets new file mode 100644 index 0000000000000000000000000000000000000000..b387a988e0ef25299dabf2bbebb380f17c7c0a28 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0070.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0070 { + @State text: string = '' + @State eventType: string = '' + @State modifier: ButtonModifier = new ButtonModifier().onKeyEvent((event?: KeyEvent) => { + if (event) { + if (event.type === KeyType.Down) { + this.eventType = 'Down' + } + if (event.type === KeyType.Up) { + this.eventType = 'Up' + } + this.text = 'KeyType:' + this.eventType + '\nkeyCode:' + event.keyCode + '\nkeyText:' + event.keyText + '\nintentionCode:' + event.intentionCode + } + }) + + build() { + Column() { + Button('KeyEvent') + .attributeModifier(this.modifier) + Text(this.text).padding(15) + }.height(300).width('100%').padding(35) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0080.ets new file mode 100644 index 0000000000000000000000000000000000000000..4585239ffb603ce6dabae9f9ceba0d812e7f15ba --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0080.ets @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0080 { + @State text: string = '' + @State modifier: ButtonModifier = new ButtonModifier().onClick((event?: ClickEvent) => { + { + this.text = JSON.stringify(event) + } + }) + + build() { + Column() { + Row({ space: 20 }) { + Button('Click').width(100).height(40).attributeModifier(this.modifier) + .id("ActionEventAttributeModifier0080_001") + }.margin(20) + + Text(this.text).margin(15) + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0090.ets new file mode 100644 index 0000000000000000000000000000000000000000..da07f45dd7e15bbfa951b70f80362709b6504ca5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0090.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0100 { + @State buttonColor: string = '#87CEFA' + @State modifier: ButtonModifier = new ButtonModifier().onBlur(() => { + this.buttonColor = '#FFC0CB' + }) + + build() { + Column() { + Button('键盘走焦再失焦') + .backgroundColor(this.buttonColor) + .width(260) + .height(70) + .margin(20) + .fontColor(Color.Black) + .focusable(true) + .attributeModifier(this.modifier) + .onFocus(() => { + this.buttonColor = '#FF0000' + }) + + + Button('Button2') + .width(260) + .height(70) + .margin(20) + .fontColor(Color.Black) + .focusable(true) + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0100.ets new file mode 100644 index 0000000000000000000000000000000000000000..b53c1e98c16aac504c164ccae7129768e7992f46 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0100.ets @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0100 { + @State buttonColor: string = '#87CEFA' + @State modifier: ButtonModifier = new ButtonModifier().onFocus(() => { + this.buttonColor = '#FF0000' + }) + + build() { + Column() { + Button('键盘走焦变色') + .backgroundColor(this.buttonColor) + .width(260) + .height(70) + .margin(20) + .fontColor(Color.Black) + .focusable(true) + .attributeModifier(this.modifier) + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0110.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c78fd3a7ca5d0a781979d8c14d061489d7132c4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0110.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0110 { + @State text: string = '' + @State eventType: string = '' + @State buttonColor: string = '#87CEFA' + @State modifier: ButtonModifier = new ButtonModifier().onTouch((event) => { + this.buttonColor = '#FF0000' + this.text = 'outer button touched type: ' + (event as TouchEvent).type + }) + + build() { + Column() { + Button('onTouch') + .id("ActionEventAttributeModifier0110_001") + .backgroundColor(this.buttonColor) + .width(260) + .height(70) + .margin(20) + .fontColor(Color.Black) + .attributeModifier(this.modifier) + Text(this.text).padding(15) + }.height(300).width('100%').padding(35) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0120.ets new file mode 100644 index 0000000000000000000000000000000000000000..fe51050862122a0e853b355d113bf4c24c471f55 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0120.ets @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0120 { + @State buttonColor: string = '#87CEFA' + @State modifier: ButtonModifier = new ButtonModifier().onFocus(() => { + this.buttonColor = '#FF0000' + }) + + build() { + Column() { + Button('键盘走焦变色') + .id("ActionEventAttributeModifier0120_001") + .backgroundColor(this.buttonColor) + .width(260) + .height(70) + .margin(20) + .fontColor(Color.Black) + .focusable(true) + .attributeModifier(this.modifier) + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0130.ets new file mode 100644 index 0000000000000000000000000000000000000000..9da611306219969bc06b94fea0a8450e4e0aed7f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0130.ets @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ButtonModifier } from '@ohos.arkui.modifier' + +@Entry +@Component +struct ActionEventAttributeModifier0130 { + @State buttonColor: string = '#87CEFA' + @State modifier: ButtonModifier = new ButtonModifier().onHover(() => { + this.buttonColor = '#FF0000' + }) + + build() { + Column() { + Button('鼠标Hover变色') + .id("ActionEventAttributeModifier0130_001") + .backgroundColor(this.buttonColor) + .width(260) + .height(70) + .margin(20) + .fontColor(Color.Black) + .focusable(true) + .attributeModifier(this.modifier) + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..54d4d029481d385136db10ce308ad038516a98d0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0020.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventEventInterface0020 { + @State text: string[] = []; + + build() { + Column({ space: 10 }) { + Stack() { + Text('Stack1').align(Alignment.Top).width('100%').height('60%').backgroundColor('#ffa6deb6') + Stack() { + Text('Stack2').align(Alignment.Top).width('80%').height('40%').backgroundColor('#ff59a76f') + } + .id('Stack2') + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack2 touched\n'); + }) + + Stack() { + Text('Stack3').align(Alignment.Top).width('60%').height('20%').backgroundColor('#ff318d4a') + Button('Button1').id('Button1').width(80).height(30) + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Button touched\n'); + }) + } + .id('Stack3') + .onTouchIntercept((event: TouchEvent) => { + return HitTestMode.None; + }) + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack3 touched\n'); + }) + + } + .id('Stack1') + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack1 touched\n'); + }) + + Text(`触发组件:\n${this.text}`) + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..16c054883a839b0580d0864d6946c7d9cc458c71 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0030.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventEventInterface0030 { + @State text: string[] = []; + + build() { + Column({ space: 10 }) { + Stack() { + Text('Stack1').align(Alignment.Top).width('100%').height('60%').backgroundColor('#ffa6deb6') + Stack() { + Text('Stack2').align(Alignment.Top).width('80%').height('40%').backgroundColor('#ff59a76f') + } + .id('Stack2') + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack2 touched\n'); + }) + + Stack() { + Text('Stack3').align(Alignment.Top).width('60%').height('20%').backgroundColor('#ff318d4a') + Button('Button1').id('Button1').width(80).height(30) + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Button touched\n'); + }) + } + .id('Stack3') + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack3 touched\n'); + }) + + } + .id('Stack1') + .onTouchIntercept((event: TouchEvent) => { + return HitTestMode.Block; + }) + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack1 touched\n'); + }) + + Text(`触发组件:\n${this.text}`) + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0080.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fcee8bedabf7a691b2e7538db6456733154c992 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0080.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventEventInterface0080 { + @State text: string[] = []; + + build() { + Column({ space: 10 }) { + Stack() { + Text('Stack1').align(Alignment.Top).width('100%').height('60%').backgroundColor('#ffa6deb6') + Stack() { + Text('Stack2').align(Alignment.Top).width('80%').height('40%').backgroundColor('#ff59a76f') + } + .id('Stack2') + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack2 touched\n'); + }) + + Stack() { + Text('Stack3').align(Alignment.Top).width('60%').height('20%').backgroundColor('#ff318d4a') + Button('Button1').id('Button1').width(80).height(30) + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Button touched\n'); + }) + } + .id('Stack3') + .onTouchIntercept((event: TouchEvent) => { + return HitTestMode.Default; + }) + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack3 touched\n'); + }) + + } + .id('Stack1') + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack1 touched\n'); + }) + + Text(`触发组件:\n${this.text}`) + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0170.ets new file mode 100644 index 0000000000000000000000000000000000000000..4dbd70b1173c509d2000a7fdc2e19650014ea9d0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0170.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventEventInterface0170 { + @State text: string[] = []; + + build() { + Column({ space: 10 }) { + Stack() { + Text('Stack1').align(Alignment.Top).width('100%').height('60%').backgroundColor('#ffa6deb6') + Stack() { + Text('Stack2').align(Alignment.Top).width('80%').height('40%').backgroundColor('#ff59a76f') + } + .id('Stack2') + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack2 touched\n'); + }) + + Stack() { + Text('Stack3').align(Alignment.Top).width('60%').height('20%').backgroundColor('#ff318d4a') + Button('Button1').id('Button1').width(80).height(30) + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Button touched\n'); + }) + } + .id('Stack3') + .onTouchIntercept((event: TouchEvent) => { + return HitTestMode.Block; + }) + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack3 touched\n'); + }) + + } + .id('Stack1') + .onTouchIntercept((event: TouchEvent) => { + return HitTestMode.Block; + }) + .onTouch((event: TouchEvent) => { + if (event.type !== TouchType.Down) { + return; + } + this.text.push('Stack1 touched\n'); + }) + + Text(`触发组件:\n${this.text}`) + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..73a423f3293fc2e21fbcc121b5760be3ccc6ccb0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0020.ets @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0020 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + @Builder + spaceBuilder() { + } + controller?: CustomDialogController; + cancel: () => void = () => { + } + + build() { + Column({space: 10}) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .customKeyboard(this.customKeyboard) + .onFocus(() => { + this.focusRecord.push('Input_2') + }) + .onBlur(() => { + this.blurRecord.push('Input_2') + }) + .id('Input_2') + + }.borderRadius(10) + .height(300) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0020 { + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在所有controller的后面 + @Builder + spaceBuilder() { + } + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0020({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .customKeyboard(this.customKeyboard) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + Row({ space: 10 }) { + Button('Open') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open() + } + }).id('Button_1') + Button('Close').onClick(() => { + if (this.dialogController != null) { + this.dialogController.close() + } + }).id('Button_2') + } + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + }.width('100%').margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..36e5c9b4abb1d8de6ac2e5a162522a43b9180e39 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0030.ets @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0030 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + @Builder + spaceBuilder() { + } + controller?: CustomDialogController; + cancel: () => void = () => { + } + + build() { + Column({space: 10}) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .customKeyboard(this.customKeyboard) + .onFocus(() => { + this.focusRecord.push('Input_2') + }) + .onBlur(() => { + this.blurRecord.push('Input_2') + }) + .id('Input_2') + + }.borderRadius(10) + .height(300) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0030 { + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + // 若尝试在CustomDialog中传入多个其他的Controller,以实现在CustomDialog中打开另一个或另一些CustomDialog,那么此处需要将指向自己的controller放在所有controller的后面 + @Builder + spaceBuilder() { + } + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0030({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .customKeyboard(this.customKeyboard) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + Row({ space: 10 }) { + Button('Open') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open() + } + }).id('Button_1') + Button('Close').onClick(() => { + if (this.dialogController != null) { + this.dialogController.close() + } + }).id('Button_2') + } + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + }.width('100%').margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..097d738f6f5ee4ddc5491d6800abc2767d0e7669 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0040.ets @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0040 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + controller?: CustomDialogController; + cancel: () => void = () => { + } + + build() { + Column({ space: 10 }) { + Button('组件b') + .onFocus(() => { + this.focusRecord.push('组件b') + }) + .defaultFocus(true) + .onBlur(() => { + this.blurRecord.push('组件b') + }) + .id('Input_2') + + } + .borderRadius(10) + .height(300) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0040 { + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0040({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + Button('组件a') + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('组件a') + }) + .defaultFocus(true) + .onBlur(() => { + this.blurRecord.push('组件a') + }) + Row({ space: 10 }) { + Button('Open') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open() + } + }).id('Button_1') + Button('Close').onClick(() => { + if (this.dialogController != null) { + this.dialogController.close() + } + }).id('Button_2') + } + + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .width('100%') + .margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..1242db30b6d4cfbbcfda2e40813d2d8e8114e6a2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0050.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0050 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + controller?: CustomDialogController; + cancel: () => void = () => { + } + + build() { + Column({ space: 10 }) { + Button('组件b').id('Input_2').onFocus(() => { + this.focusRecord.push('组件b') + }) + .onBlur(() => { + this.blurRecord.push('组件b') + }) + } + .borderRadius(10) + .height(300) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0050 { + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0050({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + Button('组件a').id('Input_1') + .onFocus(() => { + this.focusRecord.push('组件a') + }) + .onBlur(() => { + this.blurRecord.push('组件a') + }) + Row({ space: 10 }) { + Button('Open') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open() + } + }).id('Button_1') + Button('Close').onClick(() => { + if (this.dialogController != null) { + this.dialogController.close() + } + }).id('Button_2') + } + + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .width('100%') + .margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0060.ets new file mode 100644 index 0000000000000000000000000000000000000000..4e7d3932d096927bb8dfdad38e150a990a534242 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0060.ets @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0060 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + controller?: CustomDialogController; + cancel: () => void = () => { + } + + build() { + Column({ space: 10 }) { + Button('组件b') + .defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('组件b') + }) + .onBlur(() => { + this.blurRecord.push('组件b') + }) + Button('组件c').onFocus(() => { + this.focusRecord.push('组件c') + }) + .onBlur(() => { + this.blurRecord.push('组件c') + }) + } + .borderRadius(10) + .height(300) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0060 { + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0060({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + Button('组件a') + .onFocus(() => { + this.focusRecord.push('组件a') + }).defaultFocus(true) + .onBlur(() => { + this.blurRecord.push('组件a') + }) + Button('组件c') + .onFocus(() => { + this.focusRecord.push('组件c') + }) + .onBlur(() => { + this.blurRecord.push('组件c') + }) + Row({ space: 10 }) { + Button('Open') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open() + } + }).id('Button_1') + Button('Close').onClick(() => { + if (this.dialogController != null) { + this.dialogController.close() + } + }).id('Button_2') + } + + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .width('100%') + .margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0070.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd34ccd099067c1ac4a4709fd06d8817ab8ef8bb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0070.ets @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0070 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + controller?: CustomDialogController; + cancel: () => void = () => { + } + + build() { + Column({space: 10}) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .onFocus(() => { + this.focusRecord.push('Input_2') + }) + .onBlur(() => { + this.blurRecord.push('Input_2') + }) + .id('Input_2') + Button('Close').onClick((event: ClickEvent) => { + this.cancel() + }).id('Button_2') + }.borderRadius(10) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0070 { + controller: SearchController = new SearchController() + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0070({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + }.width('100%').margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0080.ets new file mode 100644 index 0000000000000000000000000000000000000000..05c7d52a574268e2d83a3b0f67d40d0c09a9159b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0080.ets @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0080 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @Link flag: boolean; + controller?: CustomDialogController; + cancel: () => void = () => { + } + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + build() { + Column({space: 10}) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .onFocus(() => { + this.focusRecord.push('Input_2') + }) + .customKeyboard(this.customKeyboard) + .onBlur(() => { + this.blurRecord.push('Input_2') + }) + .id('Input_2') + Button('Close').onClick((event: ClickEvent) => { + this.flag = !this.flag; + }).id('Button_2') + }.borderRadius(10) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0080 { + controller: SearchController = new SearchController() + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State @Watch('flagChange') flag: boolean = false; + flagChange() { + if(this.dialogController) { + this.dialogController.close(); + } + } + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0080({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + flag: this.flag + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .customKeyboard(this.customKeyboard) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + Button('Open') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open(); + } + }).backgroundColor(0x317aff).id('Button_1') + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + }.width('100%').margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0090.ets new file mode 100644 index 0000000000000000000000000000000000000000..1970050398f9a224316eab728af7c6c70ff20b4f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0090.ets @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0090 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @Link flag: boolean; + controller?: CustomDialogController; + cancel: () => void = () => { + } + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + build() { + Column({space: 10}) { + Button('Close').onClick((event: ClickEvent) => { + this.flag = !this.flag; + }).id('Button_2') + }.borderRadius(10) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0090 { + controller: SearchController = new SearchController() + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State @Watch('flagChange') flag: boolean = false; + flagChange() { + if(this.dialogController) { + this.dialogController.close(); + } + } + + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0090({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + flag: this.flag + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + Button('Open') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open() + } + }).backgroundColor(0x317aff).id('Button_1') + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + }.width('100%').margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0100.ets new file mode 100644 index 0000000000000000000000000000000000000000..2fb632741c8220ce6d191a0ef126872cd1b44f95 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0100.ets @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0100 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @Link flag: boolean; + controller?: CustomDialogController; + cancel: () => void = () => { + } + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + build() { + Column({ space: 10 }) { + Button('Close') + .onClick((event: ClickEvent) => { + this.flag = !this.flag; + }) + .id('Button_2') + .defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('button_2') + }) + .onBlur(() => { + this.blurRecord.push('button_2') + }) + }.borderRadius(10) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0100 { + controller: SearchController = new SearchController() + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State @Watch('flagChange') flag: boolean = false; + + flagChange() { + if(this.dialogController) { + this.dialogController.close(); + } + } + + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0100({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + flag: this.flag + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + Button('Open') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open() + } + }) + .backgroundColor(0x317aff) + .id('Button_1') + .defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('button_1') + }) + .onBlur(() => { + this.blurRecord.push('button_1') + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .width('100%') + .margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0110.ets new file mode 100644 index 0000000000000000000000000000000000000000..2f32975ef7e4fa438436f694742ec9a065748dc3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0110.ets @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0110 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @Link flag: boolean; + controller?: CustomDialogController; + cancel: () => void = () => { + } + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + build() { + Column({ space: 10 }) { + Button('Close') + .onClick((event: ClickEvent) => { + this.flag = !this.flag; + }) + .id('Button_2') + .onFocus(() => { + this.focusRecord.push('button_2') + }) + .onBlur(() => { + this.blurRecord.push('button_2') + }) + }.borderRadius(10) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0110 { + controller: SearchController = new SearchController() + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State @Watch('flagChange') flag: boolean = false; + + flagChange() { + if(this.dialogController) { + this.dialogController.close(); + } + } + + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0110({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + flag: this.flag + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + Button('Open') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open() + } + }) + .backgroundColor(0x317aff) + .id('Button_1') + .onFocus(() => { + this.focusRecord.push('button_1') + }) + .onBlur(() => { + this.blurRecord.push('button_1') + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .width('100%') + .margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0120.ets new file mode 100644 index 0000000000000000000000000000000000000000..6347a5c44223a96dda6372fcdafe2823f3234f7f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0120.ets @@ -0,0 +1,149 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0120 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @Link flag: boolean; + @Link focusText: string; + controller?: CustomDialogController; + cancel: () => void = () => {} + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + build() { + Column({ space: 10 }) { + Button('b') + .defaultFocus(true) + .onClick((event: ClickEvent) => { + this.flag = !this.flag; + }) + .backgroundColor(this.focusText === 'button_2' ? Color.Black : undefined) + .id('Button_2') + .onFocus(() => { + this.focusText = 'button_2'; + this.focusRecord.push('button_2') + }) + .onBlur(() => { + this.focusText = ''; + this.blurRecord.push('button_2') + }) + Button('d') + .backgroundColor(this.focusText === 'button_4' ? Color.Black : undefined) + .id('Button_4') + .onFocus(() => { + this.focusText = 'button_4'; + this.focusRecord.push('button_4'); + }) + .onBlur(() => { + this.focusText = ''; + this.blurRecord.push('button_4'); + }) + }.borderRadius(10) + .id('box_2') + .onFocus(() => { + this.focusText = 'box_2'; + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.focusText = ''; + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0120 { + controller: SearchController = new SearchController() + @State textValue: string = ''; + @State focusText: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State @Watch('flagChange') flag: boolean = false; + + flagChange() { + if(this.dialogController) { + this.dialogController.close(); + } + } + + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0120({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + flag: this.flag, + focusText: this.focusText + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + Button('a') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open(); + } + }) + .defaultFocus(true) + .backgroundColor(this.focusText === 'button_1' ? Color.Black : undefined) + .id('Button_1') + .onFocus(() => { + this.focusText = 'button_1'; + this.focusRecord.push('button_1'); + }) + .onBlur(() => { + this.focusText = ''; + this.blurRecord.push('button_1'); + }) + Button('c') + .backgroundColor(this.focusText === 'button_3' ? Color.Black : undefined) + .id('Button_3') + .onFocus(() => { + this.focusText = 'button_3'; + this.focusRecord.push('button_3'); + }) + .onBlur(() => { + this.focusText = ''; + this.blurRecord.push('button_3'); + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .width('100%') + .margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusText = 'box_1'; + this.focusRecord.push('box_1'); + }) + .onBlur(() => { + this.focusText = ''; + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0130.ets new file mode 100644 index 0000000000000000000000000000000000000000..aea2e38bb8849e0730c8991f9a9bb05e8b3d9046 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0130.ets @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +@Component +struct CustomDialogDefault0130 { + @Link focusRecord: string[]; + @Link blurRecord: string[]; + controller?: CustomDialogController; + @Link flag: boolean; + + build() { + Column({space: 10}) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }).caretStyle({ + width: 0 + }) + .onFocus(() => { + this.focusRecord.push('Input_2') + }) + .onBlur(() => { + this.blurRecord.push('Input_2') + }) + .id('Input_2') + Button('Close').onClick((event: ClickEvent) => { + this.flag = !this.flag; + }).id('Button_2') + }.borderRadius(10) + .margin({bottom: 50}) + .id('box_2') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0130 { + controller: SearchController = new SearchController() + @State textValue: string = ''; + @State inputValue: string = 'click me'; + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State @Watch('flagChange') flag: boolean = false; + + flagChange() { + if(this.dialogController) { + this.dialogController.close(); + } + } + + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogDefault0130({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + flag: this.flag + }), + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + build() { + Column({ space: 10 }) { + Button('Open') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open(); + } + }) + .defaultFocus(true) + .id('Button_1') + .onFocus(() => { + this.focusRecord.push('button_1'); + }) + .onBlur(() => { + this.blurRecord.push('button_1'); + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + }.width('100%').margin({ top: 5 }) + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0140.ets new file mode 100644 index 0000000000000000000000000000000000000000..f97238a2cb3fa2b00abf384462bc6324ec3a2f92 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0140.ets @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0140 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State select: boolean = true; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + @Builder + customFocusDefault_0140() { + Column() { + Text('MenuItem') + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .onFocus(() => { + this.focusRecord.push('Input_2') + }) + .onBlur(() => { + this.blurRecord.push('Input_2') + }) + .customKeyboard(this.spaceBuilder()) + .width('100%') + .id('Input_2') + .hitTestBehavior(HitTestMode.Block) + }.id('box_2') + .width('100%') + } + + @Builder + MyMenu(){ + Menu() { + MenuItemGroup() { + MenuItem(this.customFocusDefault_0140()) + } + } + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + .customKeyboard(this.spaceBuilder()) + .id('Input_1') + Button('click to show menu').bindMenu(this.MyMenu).id('Button_1') + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0150.ets new file mode 100644 index 0000000000000000000000000000000000000000..bcee01412f644df692ad70c60f6d32e24b3f0726 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0150.ets @@ -0,0 +1,49 @@ +@Entry +@Component +struct ActionEventCommoneventFocusDefault0150 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State select: boolean = true; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + @Builder + customFocusDefault_0150() { + Column() { + Text('MenuItem').fontSize(30).fontWeight(FontWeight.Bold).focusable(true) + }.id('box_2') + .width('100%') + } + + @Builder + MyMenu(){ + Menu() { + MenuItemGroup() { + MenuItem(this.customFocusDefault_0150()) + } + }.onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + Button('click to show menu').bindMenu(this.MyMenu).id('Button_1') + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0160.ets new file mode 100644 index 0000000000000000000000000000000000000000..842d021957b11fa4460311bad1abfa741319cd39 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0160.ets @@ -0,0 +1,68 @@ +@Entry +@Component +struct ActionEventCommoneventFocusDefault0160 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State select: boolean = true; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + @Builder + customFocusDefault_0160() { + Column() { + Text('MenuItem') + .fontSize(30) + .fontWeight(FontWeight.Bold) + }.id('box_2') + .width('100%') + } + + @Builder + MyMenu() { + Menu() { + MenuItemGroup() { + MenuItem(this.customFocusDefault_0160()) + .defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('b') + }) + .onBlur(() => { + this.blurRecord.push('b') + }) + } + }.onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + Button('click to show menu') + .bindMenu(this.MyMenu) + .id('Button_1') + .defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('a') + }) + .onBlur(() => { + this.blurRecord.push('a') + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0170.ets new file mode 100644 index 0000000000000000000000000000000000000000..94a4685203499952e6a036a44fc0c58d8dbd28df --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0170.ets @@ -0,0 +1,66 @@ +@Entry +@Component +struct ActionEventCommoneventFocusDefault0170 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State select: boolean = true; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + @Builder + customFocusDefault_0170() { + Column() { + Text('MenuItem') + .fontSize(30) + .fontWeight(FontWeight.Bold) + }.id('box_2') + .width('100%') + } + + @Builder + MyMenu() { + Menu() { + MenuItemGroup() { + MenuItem(this.customFocusDefault_0170()) + .onFocus(() => { + this.focusRecord.push('b') + }) + .onBlur(() => { + this.blurRecord.push('b') + }) + } + }.onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + Button('click to show menu') + .bindMenu(this.MyMenu) + .id('Button_1') + .onFocus(() => { + this.focusRecord.push('a') + }) + .onBlur(() => { + this.blurRecord.push('a') + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0180.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb447d6ad0729c2aeaabc2419b46aa5891e4b991 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0180.ets @@ -0,0 +1,82 @@ +@Entry +@Component +struct ActionEventCommoneventFocusDefault0180 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State select: boolean = true; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + @Builder + customFocusDefault_0180() { + Column() { + Text('MenuItem') + .fontSize(30) + .fontWeight(FontWeight.Bold) + }.id('box_2') + .width('100%') + } + + @Builder + MyMenu() { + Menu() { + MenuItemGroup() { + MenuItem(this.customFocusDefault_0180()) + .defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('b') + }) + .onBlur(() => { + this.blurRecord.push('b') + }) + MenuItem(this.customFocusDefault_0180()) + .onFocus(() => { + this.focusRecord.push('d') + }) + .onBlur(() => { + this.blurRecord.push('d') + }) + } + }.onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + Button('click to show menu') + .defaultFocus(true) + .bindMenu(this.MyMenu) + .id('Button_1') + .onFocus(() => { + this.focusRecord.push('a') + }) + .onBlur(() => { + this.blurRecord.push('a') + }) + Button('click to show menu') + .onFocus(() => { + this.focusRecord.push('c') + }) + .onBlur(() => { + this.blurRecord.push('c') + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .id('box_1') + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0190.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb13c0f9edcd87b093e17adb05c8682aeb3dc8f1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0190.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0190 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State isShow: boolean = false + @State isShow2: boolean = false + @State sheetHeight: number = 600; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + @Builder + myBuilder() { + Column() { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .onFocus(() => { + this.focusRecord.push('Input_2') + }) + .onBlur(() => { + this.blurRecord.push('Input_2') + }) + .customKeyboard(this.spaceBuilder()) + .id('Input_2') + Button("transition modal 2") + .onClick(() => { + this.isShow = false; + }) + .id('Button_2') + .fontSize(20) + .margin(10) + } + .padding({ + top: 50 + }) + .width('100%') + .height('100%') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + .customKeyboard(this.spaceBuilder()) + .id('Input_1') + Button("transition modal 1") + .onClick(() => { + this.isShow = true + }) + .id('Button_1') + .fontSize(20) + .margin(10) + .bindSheet($$this.isShow, this.myBuilder(), { + height: this.sheetHeight, + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .justifyContent(FlexAlign.Center) + .width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0200.ets new file mode 100644 index 0000000000000000000000000000000000000000..dc9dc879e6134dd47b84c02f0b8328c63159ec00 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0200.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0200 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State isShow: boolean = false + @State isShow2: boolean = false + @State sheetHeight: number = 600; + + @Builder + myBuilder() { + Column() {} + .padding({ + top: 50 + }) + .width('100%') + .height('100%') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + Button("transition modal 1") + .onClick(() => { + this.isShow = true + }) + .id('Button_1') + .fontSize(20) + .margin(10) + .bindSheet($$this.isShow, this.myBuilder(), { + height: this.sheetHeight, + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .justifyContent(FlexAlign.Center) + .width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0210.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb1c45203301e0a3539596b3353cd3c5bf9a819c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0210.ets @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0210 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State isShow: boolean = false + @State isShow2: boolean = false + @State sheetHeight: number = 600; + + @Builder + myBuilder() { + Column() { + Button("transition modal 2") + .onClick(() => { + this.isShow = false; + }) + .id('Button_2') + .fontSize(20) + .margin(10) + .defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('button_2') + }) + .onBlur(() => { + this.blurRecord.push('button_2') + }) + } + .padding({ + top: 50 + }) + .width('100%') + .height('100%') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + Button("transition modal 1") + .onClick(() => { + this.isShow = true + }) + .defaultFocus(true) + .id('Button_1') + .fontSize(20) + .margin(10) + .bindSheet($$this.isShow, this.myBuilder(), { + height: this.sheetHeight, + }) + .onFocus(() => { + this.focusRecord.push('button_1') + }) + .onBlur(() => { + this.blurRecord.push('button_1') + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .justifyContent(FlexAlign.Center) + .width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0220.ets new file mode 100644 index 0000000000000000000000000000000000000000..36a8332a446629c6aa617c3fda9891769f89dfdd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0220.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0220 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State isShow: boolean = false + @State isShow2: boolean = false + @State sheetHeight: number = 600; + + @Builder + myBuilder() { + Column() { + Button("transition modal 2") + .onClick(() => { + this.isShow = false; + }) + .id('Button_2') + .fontSize(20) + .margin(10) + .onFocus(() => { + this.focusRecord.push('button_2') + }) + .onBlur(() => { + this.blurRecord.push('button_2') + }) + } + .padding({ + top: 50 + }) + .width('100%') + .height('100%') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + Button("transition modal 1") + .onClick(() => { + this.isShow = true + }) + .id('Button_1') + .fontSize(20) + .margin(10) + .bindSheet($$this.isShow, this.myBuilder(), { + height: this.sheetHeight, + }) + .onFocus(() => { + this.focusRecord.push('button_1') + }) + .onBlur(() => { + this.blurRecord.push('button_1') + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .justifyContent(FlexAlign.Center) + .width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0230.ets new file mode 100644 index 0000000000000000000000000000000000000000..f874de246bf3cbef313eed5d81ded47e72db150b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0230.ets @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0230 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State isShow: boolean = false + @State isShow2: boolean = false + @State sheetHeight: number = 600; + + @Builder + myBuilder() { + Column() { + Button("transition modal 2") + .onClick(() => { + this.isShow = false; + }) + .defaultFocus(true) + .id('Button_2') + .fontSize(20) + .margin(10) + .onFocus(() => { + this.focusRecord.push('b') + }) + .onBlur(() => { + this.blurRecord.push('b') + }) + + Button("transition modal 4") + .fontSize(20) + .margin(10) + .onFocus(() => { + this.focusRecord.push('d') + }) + .onBlur(() => { + this.blurRecord.push('d') + }) + } + .padding({ + top: 50 + }) + .width('100%') + .height('100%') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + Button("transition modal 1") + .onClick(() => { + this.isShow = true + }) + .defaultFocus(true) + .id('Button_1') + .fontSize(20) + .margin(10) + .bindSheet($$this.isShow, this.myBuilder(), { + height: this.sheetHeight, + }) + .onFocus(() => { + this.focusRecord.push('a') + }) + .onBlur(() => { + this.blurRecord.push('a') + }) + + Button("transition modal 3") + .fontSize(20) + .margin(10) + .onFocus(() => { + this.focusRecord.push('c') + }) + .onBlur(() => { + this.blurRecord.push('c') + }) + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .justifyContent(FlexAlign.Center) + .width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0240.ets new file mode 100644 index 0000000000000000000000000000000000000000..c90161ee44ad1268b6bd7fb1592bb8a2e9ca101f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0240.ets @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0240 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State isShow: boolean = false; + @State isShow2: boolean = false; + @State sheetHeight: number = 600; + + @Builder + myBuilder() { + Column() { + Button("transition modal 2") + .onClick(() => { + this.isShow = false; + }) + .id('Button_2') + .fontSize(20) + .margin(10) + .onFocus(() => { + this.focusRecord.push('b') + }) + .onBlur(() => { + this.blurRecord.push('b') + }) + } + .padding({ + top: 50 + }) + .width('100%') + .height('100%') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } + + build() { + Column({ space: 10 }) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + Button("transition modal 1") + .onClick(() => { + this.isShow = true + }) + .id('Button_1') + .fontSize(20) + .margin(10) + .bindSheet($$this.isShow, this.myBuilder(), { + height: this.sheetHeight, + }) + .onFocus(() => { + this.focusRecord.push('a') + }) + .onBlur(() => { + this.blurRecord.push('a') + }) + + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + .justifyContent(FlexAlign.Center) + .width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0250.ets new file mode 100644 index 0000000000000000000000000000000000000000..c7cc203038a28f17ff4a931bd862536950cb4acd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0250.ets @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@Component +struct FocusDefault0250 { + @Consume('pageInfos') pageInfos: NavPathStack; + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + build() { + NavDestination() { + Column({ space: 10 }) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .onFocus(() => { + this.focusRecord.push('Input_2') + }) + .onBlur(() => { + this.blurRecord.push('Input_2') + }) + .customKeyboard(this.spaceBuilder()) + .width('100%') + .id('Input_2') + } + } + .title('Page_B') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0250 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + @Builder + PagesMap(name: string) { + FocusDefault0250({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }) + } + + build() { + Column({ space: 10 }) { + Navigation(this.pageInfos) { + Column({ space: 10 }) { + TextInput({ placeholder: '' }).height(60).width('90%').caretStyle({ + width: 0 + }) + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + .customKeyboard(this.spaceBuilder()) + .width('100%') + .id('Input_1') + + Button('Go Page_B') + .width('80%') + .onClick(() => { + this.pageInfos.pushPathByName('FocusDefault0250', ''); + }).id('Button_1') + } + } + .height('50%') + .mode(NavigationMode.Stack) + .titleMode(NavigationTitleMode.Mini) + .title('Page_A') + .navDestination(this.PagesMap) + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0260.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0260.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c95f35e3751fe01c827c8a3bf5a14aed5781983 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0260.ets @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@Component +struct FocusDefault0260 { + @Consume('pageInfos') pageInfos: NavPathStack; + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + build() { + NavDestination() {} + .title('Page_B') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0260 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + @Builder + PagesMap(name: string) { + FocusDefault0260({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }) + } + + build() { + Column({ space: 10 }) { + Navigation(this.pageInfos) { + Column({ space: 10 }) { + Button('Go Page_B') + .width('80%') + .onClick(() => { + this.pageInfos.pushPathByName('FocusDefault0260', ''); + }).id('Button_1') + } + } + .height('50%') + .mode(NavigationMode.Stack) + .titleMode(NavigationTitleMode.Mini) + .title('Page_A') + .navDestination(this.PagesMap) + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0270.ets new file mode 100644 index 0000000000000000000000000000000000000000..f161df697dec56150a1f5cc35c07791f73c98afc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0270.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@Component +struct FocusDefault0270 { + @Consume('pageInfos') pageInfos: NavPathStack; + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + build() { + NavDestination() { + Button('B') + .width('80%') + .id('Button_2').defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('B') + }) + .onBlur(() => { + this.blurRecord.push('B') + }) + } + .title('Page_B') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0270 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() {} + @Builder + PagesMap(name: string) { + FocusDefault0270({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }) + } + + build() { + Column({ space: 10 }) { + Navigation(this.pageInfos) { + Column({ space: 10 }) { + Button('A') + .width('80%') + .onClick(() => { + this.pageInfos.pushPathByName('FocusDefault0270', ''); + }).id('Button_1').defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('A') + }) + .onBlur(() => { + this.blurRecord.push('A') + }) + } + } + .height('50%') + .mode(NavigationMode.Stack) + .titleMode(NavigationTitleMode.Mini) + .title('Page_A') + .navDestination(this.PagesMap) + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0280.ets new file mode 100644 index 0000000000000000000000000000000000000000..2f638b163e10ab45189bf929ad8e2384b358b9a2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0280.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@Component +struct FocusDefault0280 { + @Consume('pageInfos') pageInfos: NavPathStack; + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + build() { + NavDestination() { + Button('B') + .width('80%') + .id('Button_2') + .onFocus(() => { + this.focusRecord.push('B') + }) + .onBlur(() => { + this.blurRecord.push('B') + }) + } + .title('Page_B') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0280 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + @Builder + PagesMap(name: string) { + FocusDefault0280({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }) + } + + build() { + Column({ space: 10 }) { + Navigation(this.pageInfos) { + Column({ space: 10 }) { + Button('A') + .width('80%') + .onClick(() => { + this.pageInfos.pushPathByName('FocusDefault0280', ''); + }).id('Button_1') + .onFocus(() => { + this.focusRecord.push('A') + }) + .onBlur(() => { + this.blurRecord.push('A') + }) + } + } + .height('50%') + .mode(NavigationMode.Stack) + .titleMode(NavigationTitleMode.Mini) + .title('Page_A') + .navDestination(this.PagesMap) + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0290.ets new file mode 100644 index 0000000000000000000000000000000000000000..7acbe7fa34501761a0be6ab871b3f1f76b79584e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0290.ets @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@Component +struct FocusDefault0290 { + @Consume('pageInfos') pageInfos: NavPathStack; + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + build() { + NavDestination() { + Button('B') + .width('80%') + .id('Button_2').defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('B') + }) + .onBlur(() => { + this.blurRecord.push('B') + }) + + Button('D') + .width('80%') + .id('Button_2').defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('D') + }) + .onBlur(() => { + this.blurRecord.push('D') + }) + } + .title('Page_B') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0290 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + @Builder + PagesMap(name: string) { + FocusDefault0290({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }) + } + + build() { + Column({ space: 10 }) { + Navigation(this.pageInfos) { + Column({ space: 10 }) { + Button('A') + .width('80%') + .onClick(() => { + this.pageInfos.pushPathByName('FocusDefault0290', ''); + }).id('Button_1').defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('A') + }) + .onBlur(() => { + this.blurRecord.push('A') + }) + + Button('C') + .width('80%') + .onClick(() => { + this.pageInfos.pushPathByName('FocusDefault0290', ''); + }).id('Button_1').defaultFocus(true) + .onFocus(() => { + this.focusRecord.push('C') + }) + .onBlur(() => { + this.blurRecord.push('C') + }) + } + } + .height('50%') + .mode(NavigationMode.Stack) + .titleMode(NavigationTitleMode.Mini) + .title('Page_A') + .navDestination(this.PagesMap) + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0300.ets new file mode 100644 index 0000000000000000000000000000000000000000..485dbbb867c0a3912ab012ae4ba68365f75ddb01 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0300.ets @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@Component +struct FocusDefault0300 { + @Consume('pageInfos') pageInfos: NavPathStack; + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + build() { + NavDestination() { + TextInput({ placeholder: '' }) + .height(60) + .width('90%') + .caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + + Button('B') + .width('80%') + .id('Button_2') + .onFocus(() => { + this.focusRecord.push('B') + }) + .onBlur(() => { + this.blurRecord.push('B') + }) + } + .title('Page_B') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0300 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + @Builder + PagesMap(name: string) { + FocusDefault0300({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }) + } + + build() { + Column({ space: 10 }) { + Navigation(this.pageInfos) { + Column({ space: 10 }) { + TextInput({ placeholder: '' }) + .height(60) + .width('90%') + .caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + + Button('A') + .width('80%') + .onClick(() => { + this.pageInfos.pushPathByName('FocusDefault0300', ''); + }) + .id('Button_1') + .onFocus(() => { + this.focusRecord.push('A') + }) + .onBlur(() => { + this.blurRecord.push('A') + }) + } + } + .height('50%') + .mode(NavigationMode.Stack) + .titleMode(NavigationTitleMode.Mini) + .title('Page_A') + .navDestination(this.PagesMap) + .onFocus(() => { + this.focusRecord.push('box_1') + }) + .onBlur(() => { + this.blurRecord.push('box_1') + }) + + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0310.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e989eec2eebe41b354fe9970234b1a8defc10a9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0310.ets @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@Component +struct FocusDefault0310 { + @Consume('pageInfos') pageInfos: NavPathStack; + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() {} + + build() { + NavDestination() { + TextInput({ placeholder: '' }) + .height(60) + .width('90%') + .caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + + Button('B') + .width('80%') + .id('Button_2') + .onFocus(() => { + this.focusRecord.push('B') + }) + .onBlur(() => { + this.blurRecord.push('B') + }) + } + .title('Page_B') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0310 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + @Builder + PagesMap(name: string) { + FocusDefault0310({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }) + } + + build() { + Column({ space: 10 }) { + Navigation(this.pageInfos) { + Column({ space: 10 }) { + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + TextInput({ placeholder: '' }) + .defaultFocus(true) + .height(60) + .width('90%') + .caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('A') + }) + .onBlur(() => { + this.blurRecord.push('A') + }) + + Button('取消获焦') + .width('80%') + .onClick(() => { + this.getUIContext().getFocusController().clearFocus(); + }) + .id('Button_1') + } + } + .height('50%') + .mode(NavigationMode.Stack) + .titleMode(NavigationTitleMode.Mini) + .title('Page_A') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0320.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0320.ets new file mode 100644 index 0000000000000000000000000000000000000000..6431762a1a4d5ee0372e32f47853dfbf1f89fe82 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0320.ets @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@Component +struct FocusDefault0320 { + @Consume('pageInfos') pageInfos: NavPathStack; + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() {} + + build() { + NavDestination() { + TextInput({ placeholder: '' }) + .height(60) + .width('90%') + .caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + + Button('B') + .width('80%') + .id('Button_2') + .onFocus(() => { + this.focusRecord.push('B') + }) + .onBlur(() => { + this.blurRecord.push('B') + }) + } + .title('Page_B') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0320 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + @Builder + PagesMap(name: string) { + FocusDefault0320({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }) + } + + build() { + Column({ space: 10 }) { + Navigation(this.pageInfos) { + Column({ space: 10 }) { + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + TextInput({ placeholder: '' }) + .defaultFocus(true) + .height(60) + .width('90%') + .caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('A') + }) + .onBlur(() => { + this.blurRecord.push('A') + }) + + Button('取消获焦') + .width('80%') + .onClick(() => { + this.getUIContext().getFocusController().clearFocus(); + }) + .id('Button_1') + } + } + .height('50%') + .mode(NavigationMode.Stack) + .titleMode(NavigationTitleMode.Mini) + .title('Page_A') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0330.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0330.ets new file mode 100644 index 0000000000000000000000000000000000000000..69427a98032d7fac1d670840f368468dc1f394b9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0330.ets @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@Component +struct FocusDefault0330 { + @Consume('pageInfos') pageInfos: NavPathStack; + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() {} + + build() { + NavDestination() { + TextInput({ placeholder: '' }) + .height(60) + .width('90%') + .caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + + Button('B') + .width('80%') + .id('Button_2') + .onFocus(() => { + this.focusRecord.push('B') + }) + .onBlur(() => { + this.blurRecord.push('B') + }) + } + .title('Page_B') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0330 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State inputDraggable: boolean = true; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() { + } + + @Builder + PagesMap(name: string) { + FocusDefault0330({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }) + } + + build() { + Column({ space: 10 }) { + Navigation(this.pageInfos) { + Column({ space: 10 }) { + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + TextInput({ placeholder: '' }) + .defaultFocus(true) + .height(60) + .width('90%') + .caretStyle({ + width: 0 + }) + .draggable(this.inputDraggable) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('A') + }) + .onBlur(() => { + this.blurRecord.push('A') + }) + + TextInput({ placeholder: '' }) + .defaultFocus(true) + .height(60) + .width('90%') + .caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('B') + }) + .onBlur(() => { + this.blurRecord.push('B') + }) + + Button('取消获焦') + .width('80%') + .onClick(() => { + this.inputDraggable = false; + }) + .id('Button_1') + } + } + .height('50%') + .mode(NavigationMode.Stack) + .titleMode(NavigationTitleMode.Mini) + .title('Page_A') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0340.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0340.ets new file mode 100644 index 0000000000000000000000000000000000000000..3114a5938f01859d9a2616ed8fe4943e1ac2a0ca --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0340.ets @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@Component +struct FocusDefault0340 { + @Consume('pageInfos') pageInfos: NavPathStack; + @Link focusRecord: string[]; + @Link blurRecord: string[]; + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + + @Builder + spaceBuilder() {} + + build() { + NavDestination() { + TextInput({ placeholder: '' }) + .height(60) + .width('90%') + .caretStyle({ + width: 0 + }) + .id('Input_1') + .onFocus(() => { + this.focusRecord.push('Input_1') + }) + .onBlur(() => { + this.blurRecord.push('Input_1') + }) + + Button('B') + .width('80%') + .id('Button_2') + .onFocus(() => { + this.focusRecord.push('B') + }) + .onBlur(() => { + this.blurRecord.push('B') + }) + } + .title('Page_B') + .onFocus(() => { + this.focusRecord.push('box_2') + }) + .onBlur(() => { + this.blurRecord.push('box_2') + }) + } +} + +@Entry +@Component +struct ActionEventCommoneventFocusDefault0340 { + @State focusRecord: string[] = []; + @State blurRecord: string[] = []; + @State inputDraggable: boolean = true; + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + @BuilderParam customKeyboard: CustomBuilder = this.spaceBuilder; + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + @Builder + spaceBuilder() { + } + + @Builder + PagesMap(name: string) { + FocusDefault0340({ + focusRecord: this.focusRecord, + blurRecord: this.blurRecord, + }) + } + aboutToAppear(): void { + + } + + build() { + Column({ space: 10 }) { + Navigation(this.pageInfos) { + Text(`focusRecord: ${this.focusRecord}`) + Text(`blurRecord: ${this.blurRecord}`) + + Button('取消获焦') + .width('80%') + .onClick(() => { + this.arr.shift(); + }) + .focusable(true) + .id('Button_1') + + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('' + item) + .defaultFocus(item === 0) + .focusable(true) + .width('100%').height(80).fontSize(16) + .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + .onBlur(() => { + this.blurRecord.push(item + '') + }) + }.padding(10) + }, (item: string) => item) + } + .listDirection(Axis.Vertical) // 排列方向 + .scrollBar(BarState.Off) + .friction(0.6) + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // 每行之间的分界线 + .edgeEffect(EdgeEffect.Spring) // 边缘效果设置为Spring + .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => {}) + .onScrollVisibleContentChange((start: VisibleListContentInfo, end: VisibleListContentInfo) => {}) + .onDidScroll((scrollOffset: number, scrollState: ScrollState) => {}) + .width('80%') + } + .backgroundColor(0xDCDCDC) + .height('50%') + .mode(NavigationMode.Stack) + .titleMode(NavigationTitleMode.Mini) + .title('Page_A') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0010.ets new file mode 100644 index 0000000000000000000000000000000000000000..774daadaca32cd7e55963522c3bfc1d343c7924c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0010.ets @@ -0,0 +1,118 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ +// xxx.ets +@Entry +@Component +struct AlphabetIndexerSample { + private arrayA: string[] = ['安'] + private arrayB: string[] = ['卜', '白', '包', '毕', '丙'] + private arrayC: string[] = ['曹', '成', '陈', '催'] + private arrayL: string[] = ['刘', '李', '楼', '梁', '雷', '吕', '柳', '卢'] + private value: string[] = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', + 'O', 'P', 'Q', 'R', 'S', 'T', 'U', + 'V', 'W', 'X', 'Y', 'Z'] + + build() { + Stack({ alignContent: Alignment.Start }) { + Row() { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arrayA, (item: string) => { + ListItem() { + Text(item) + .width('80%') + .height('5%') + .fontSize(30) + .textAlign(TextAlign.Center) + } + }, (item: string) => item) + + ForEach(this.arrayB, (item: string) => { + ListItem() { + Text(item) + .width('80%') + .height('5%') + .fontSize(30) + .textAlign(TextAlign.Center) + } + }, (item: string) => item) + + ForEach(this.arrayC, (item: string) => { + ListItem() { + Text(item) + .width('80%') + .height('5%') + .fontSize(30) + .textAlign(TextAlign.Center) + } + }, (item: string) => item) + + ForEach(this.arrayL, (item: string) => { + ListItem() { + Text(item) + .width('80%') + .height('5%') + .fontSize(30) + .textAlign(TextAlign.Center) + } + }, (item: string) => item) + } + .width('50%') + .height('100%') + + AlphabetIndexer({ arrayValue: this.value, selected: 0 }) + .autoCollapse(false) + .selectedColor(0xFFFFFF) // 选中项文本颜色 + .popupColor(0xFFFAF0) // 弹出框文本颜色 + .selectedBackgroundColor(0xCCCCCC) // 选中项背景颜色 + .popupBackground(0xD2B48C) // 弹出框背景颜色 + .usingPopup(true) // 是否显示弹出框 + .selectedFont({ size: 16, weight: FontWeight.Bolder }) // 选中项字体样式 + .popupFont({ size: 30, weight: FontWeight.Bolder }) // 弹出框内容的字体样式 + .itemSize(28) // 每一项的尺寸大小 + .alignStyle(IndexerAlign.Left) // 弹出框在索引条右侧弹出 + .popupItemBorderRadius(24) // 设置提示弹窗索引项背板圆角半径 + .itemBorderRadius(14) // 设置索引项背板圆角半径 + .popupBackgroundBlurStyle(BlurStyle.NONE) // 设置提示弹窗的背景模糊材质 + .popupTitleBackground(0xCCCCCC) // 设置提示弹窗首个索引项背板颜色 + .popupSelectedColor(0x00FF00) + .popupUnselectedColor(0x0000FF) + .popupItemFont({ size: 30, style: FontStyle.Normal }) + .popupItemBackgroundColor(0xCCCCCC) + .onSelect((index: number) => { + console.info(this.value[index] + ' Selected!') + }) + .onRequestPopupData((index: number) => { + if (this.value[index] == 'A') { + return this.arrayA // 当选中A时,弹出框里面的提示文本列表显示A对应的列表arrayA,选中B、C、L时也同样 + } else if (this.value[index] == 'B') { + return this.arrayB + } else if (this.value[index] == 'C') { + return this.arrayC + } else if (this.value[index] == 'L') { + return this.arrayL + } else { + return [] // 选中其余子母项时,提示文本列表为空 + } + }) + .onPopupSelect((index: number) => { + console.info('onPopupSelected:' + index) + }) + } + .width('100%') + .height('100%') + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ff73317107ba41e9b44d7487b58aab5fa98d008 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0020.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0020 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 15 }) { + ForEach(this.arr, (item: number) => { + Column({ space: 10 }) { + Text('item_' + item) + .width('80%') + .height(150) + .focusable(true) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + }, (item: string) => item) + }.width('100%').padding(10) + }.height(600) + .border({ + width: 2, + color: Color.Black + }) + + Button('删除item_2').onClick(() => { + this.arr.splice(1, 1) + }).id('FocuseventInteraction_001') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e53571398e5c42e13e05f209be4d23950d3a54a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0030.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0030 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 15 }) { + ForEach(this.arr, (item: number) => { + Column({ space: 10 }) { + Text('item_' + item) + .width('80%') + .height(150) + .focusable(true) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + }, (item: string) => item) + }.width('100%').padding(10) + }.height(600) + .border({ + width: 2, + color: Color.Black + }) + + Button('增加item_0').onClick(() => { + this.arr.unshift(0) + }).id('FocuseventInteraction_001') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..2778d12f265a41e0c5e8742f69e4f9ea622576c8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0040.ets @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +class FocuseventInteraction0040_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0040_DataSource extends FocuseventInteraction0040_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0040 { + @State arr: FocuseventInteraction0040_DataSource = new FocuseventInteraction0040_DataSource(); + + aboutToAppear(): void { + for (let i = 1; i <= 20; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 15 }) { + LazyForEach(this.arr, (item: number) => { + Column({ space: 10 }) { + Text('item_' + item) + .width('80%') + .height(150) + .focusable(true) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + }, (item: string) => item) + }.width('100%').padding(10) + }.height(600) + .border({ + width: 2, + color: Color.Black + }) + + Button('删除item_2').onClick(() => { + this.arr.deleteData(1) + }).id('FocuseventInteraction_001') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5bab4a0bc76feed92b0ffeb6c1063983f0338bd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0050.ets @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +class FocuseventInteraction0050_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0050_DataSource extends FocuseventInteraction0050_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0050 { + @State arr: FocuseventInteraction0050_DataSource = new FocuseventInteraction0050_DataSource(); + + aboutToAppear(): void { + for (let i = 1; i <= 20; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 15 }) { + LazyForEach(this.arr, (item: number) => { + Column({ space: 10 }) { + Text('item_' + item) + .width('80%') + .height(150) + .focusable(true) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + }, (item: string) => item) + }.width('100%').padding(10) + }.height(600) + .border({ + width: 2, + color: Color.Black + }) + + Button('增加item_0').onClick(() => { + this.arr.addData(0, '0') + }).id('FocuseventInteraction_001') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0060.ets new file mode 100644 index 0000000000000000000000000000000000000000..0ca4512b61fc85d87514a97edefe477b7f856e37 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0060.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0060 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable(item !== 5 ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .defaultFocus(item === 2 ? true : false) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(300) + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0070.ets new file mode 100644 index 0000000000000000000000000000000000000000..7aca4cfe34ab1f167b4704647243ba44383164fe --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0070.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0070 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable(item !== 5 ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .defaultFocus(item === 8 ? true : false) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(300) + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0080.ets new file mode 100644 index 0000000000000000000000000000000000000000..03ee8f82aeb2bbd08511f13d544f4783a8acddcf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0080.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0080 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable(item !== 5 ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .defaultFocus(item === 6 ? true : false) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(300) + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0090.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6b7cd1abe5c03ba50e06d2fc7fcffb9617ab642 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0090.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0090 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable(item !== 5 ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .defaultFocus(item === 4 ? true : false) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(300) + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0100.ets new file mode 100644 index 0000000000000000000000000000000000000000..69e2ac524727e53233c2b4dde2b5c2706dfa9636 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0100.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0100 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable((item !== 2 && item !== 3) ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .defaultFocus(item === 1 ? true : false) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0110.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b28891ee9bdfe0b0a3dd74377ec5901ca9b96da --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0110.ets @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0110 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + @State defaultFocusId: number = 1; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id('FocuseventInteraction0110_' + item) + .width(80) + .height(80) + .focusable((item !== 5 && item !== 9) ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction0110_13'); + }).id('FocuseventInteraction0110_0') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0120.ets new file mode 100644 index 0000000000000000000000000000000000000000..81ce951c2b033b53cfeda1fd462c54c6af6879a1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0120.ets @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0120_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0120_DataSource extends FocuseventInteraction0120_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0120 { + @State arr: FocuseventInteraction0120_DataSource = new FocuseventInteraction0120_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 4; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + LazyForEach(this.arr, (item: number) => { + Row() { + Button('item_' + item) + .id('ActionEventCommoneventFocuseventInteraction0120_'+item) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + .onDragStart(() => { + this.arr.pushData("21") + }) + .height(500) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0130.ets new file mode 100644 index 0000000000000000000000000000000000000000..a55bc7ca62399e39d3a6b1199118b92e5862deb4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0130.ets @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0130_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0130_DataSource extends FocuseventInteraction0130_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0130 { + @State arr: FocuseventInteraction0130_DataSource = new FocuseventInteraction0130_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 4; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + LazyForEach(this.arr, (item: number) => { + Row() { + Button('item_' + item) + .id('ActionEventCommoneventFocuseventInteraction0130_'+item) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + .onDragStart(() => { + this.arr.pushData("21") + }) + .height(500) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0140.ets new file mode 100644 index 0000000000000000000000000000000000000000..fce8195bcbfba38340e87b2d2ab39880bc1c6fc7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0140.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0140 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id('FocuseventInteraction0110_' + item) + .width(80) + .height(80) + .focusable(true) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction0110_12'); + }).id('FocuseventInteraction_0') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0150.ets new file mode 100644 index 0000000000000000000000000000000000000000..93bf9cd3212691687a7a736a9447a7eee862c1b1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0150.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0150 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id('FocuseventInteraction0110_' + item) + .width(80) + .height(80) + .focusable((item !== 12) ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction0110_11'); + }).id('FocuseventInteraction_0') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0160.ets new file mode 100644 index 0000000000000000000000000000000000000000..c791fd9a234011266777b12a5e36f42ca55dc07c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0160.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0150 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id('FocuseventInteraction0110_' + item) + .width(80) + .height(80) + .focusable((item !== 9) ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction0110_10'); + }).id('FocuseventInteraction_0') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0170.ets new file mode 100644 index 0000000000000000000000000000000000000000..58d71e6f585642aea88be710381c75da7099e51c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0170.ets @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0170 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id('FocuseventInteraction0110_' + item) + .width(80) + .height(80) + .focusable(true) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + + Button('行首').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction0110_5'); + }).id('FocuseventInteraction_0') + Button('行尾').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction0110_8'); + }).id('FocuseventInteraction_1') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0180.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1f3e9838c48104d954b58e305ae1198bf3487f2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0180.ets @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0180 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + @State focusState: string[] = []; + @State startDate: Date = new Date('2024'); + @State endDate: Date = new Date('2024'); + @State flag: boolean = true; + + build() { + Column({ space: 10 }) { + Button('上').onFocus(() => { + this.focusState.push('上'); + }).visibility(this.flag ? Visibility.Visible : Visibility.None) + Row() { + Button('左').onFocus(() => { + this.focusState.push('左'); + }).visibility(this.flag ? Visibility.Visible : Visibility.None) + DatePicker({ + start: this.startDate, + end: this.endDate, + }).width('70%').defaultFocus(true) + Button('右').onFocus(() => { + this.focusState.push('右'); + }).visibility(this.flag ? Visibility.Visible : Visibility.None) + } + Button('下').onFocus(() => { + this.focusState.push('下'); + }).visibility(this.flag ? Visibility.Visible : Visibility.None) + Button('更换结构').onClick(() => { + this.startDate = new Date('2014'); + this.endDate = new Date('2024'); + this.flag = !this.flag; + }).id('Interaction0180_001') + Text('四周按钮获焦情况onFocus:' + this.focusState) + .visibility(this.flag ? Visibility.Visible : Visibility.None) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0190.ets new file mode 100644 index 0000000000000000000000000000000000000000..95e870a31bab343d04031937da4f733d18e8d4a7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0190.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0190 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, ]; + + build() { + Column({ space: 10 }) { + Flex({ direction: FlexDirection.Column }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('100%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .onClick(() => { + this.arr.splice(item - 1, 1) + }) + }, (item: string) => item) + } + .height('80%') + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0200.ets new file mode 100644 index 0000000000000000000000000000000000000000..5807554dba092ce7d31597f5d0dabd087b41d7bc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0200.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0200 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, ]; + + build() { + Column({ space: 10 }) { + Flex({ direction: FlexDirection.Column }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('100%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .onClick(() => { + this.arr.splice(item - 1, 0, item + 0.5) + }) + }, (item: string) => item) + } + .height('80%') + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0210.ets new file mode 100644 index 0000000000000000000000000000000000000000..77c0801eb24f41e80f526ddd1b9120460917c035 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0210.ets @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +class FocuseventInteraction0210_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0210_DataSource extends FocuseventInteraction0210_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0210 { + @State arr:FocuseventInteraction0210_DataSource = new FocuseventInteraction0210_DataSource(); + aboutToAppear(): void { + for (let i = 1; i <= 8; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + build() { + Column({ space: 10 }) { + Flex({ direction: FlexDirection.Column }) { + LazyForEach(this.arr, (item: number) => { + Button('' + item).width('100%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .onClick(() => { + this.arr.deleteData(item - 1) + }) + }, (item: string) => item) + } + .height('80%') + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0220.ets new file mode 100644 index 0000000000000000000000000000000000000000..582b21c4d0ffde4b892206b4f3f2b9e92e13a99e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0220.ets @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +class FocuseventInteraction0220_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0220_DataSource extends FocuseventInteraction0220_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0220 { + @State arr:FocuseventInteraction0220_DataSource = new FocuseventInteraction0220_DataSource(); + aboutToAppear(): void { + for (let i = 1; i <= 8; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + build() { + Column({ space: 10 }) { + Flex({ direction: FlexDirection.Column }) { + LazyForEach(this.arr, (item: number) => { + Button('' + item).width('100%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .onClick(() => { + this.arr.addData(item - 1, 1.5 + '') + }) + }, (item: string) => item) + } + .height('80%') + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0230.ets new file mode 100644 index 0000000000000000000000000000000000000000..568bcef401324625e5f062bf1deee81daff3ea2f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0230.ets @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0230 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.WrapReverse , direction:FlexDirection.Row }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('33%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .focusable(item === 5 ? false : true) + }, (item: string) => item) + } + .height('80%') + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction_2'); + }).id('FocuseventInteraction_0') + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0240.ets new file mode 100644 index 0000000000000000000000000000000000000000..cae061b27891241fb6b68aab72ed56cc74472d31 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0240.ets @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0240 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.WrapReverse , direction:FlexDirection.Row }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('33%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .focusable(item === 5 ? false : true) + }, (item: string) => item) + } + .height('80%') + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction_8'); + }).id('FocuseventInteraction_0') + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0250.ets new file mode 100644 index 0000000000000000000000000000000000000000..fcdccdfbc6519bb7dafeddf73e0f557e0c15a31a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0250.ets @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0250 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.WrapReverse , direction:FlexDirection.Row }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('33%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .focusable(item === 5 ? false : true) + }, (item: string) => item) + } + .height('80%') + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction_4'); + }).id('FocuseventInteraction_0') + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0260.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0260.ets new file mode 100644 index 0000000000000000000000000000000000000000..1dda8dbe524c8b9bf44905bec38156abb1f5ca22 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0260.ets @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0260 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.WrapReverse , direction:FlexDirection.Row }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('33%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .focusable(item === 5 ? false : true) + }, (item: string) => item) + } + .height('80%') + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction_6'); + }).id('FocuseventInteraction_0') + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0270.ets new file mode 100644 index 0000000000000000000000000000000000000000..46f89c06c92d3dc271537a1c8efaf40f72314f6f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0270.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0270 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + @State focusText: number[] = []; + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.Wrap , direction:FlexDirection.Row }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('25%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .focusable(item === 2 || item === 3 ? false : true) + .onFocus(() => { + this.focusText.push(item) + }) + }, (item: string) => item) + } + .height(500) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Text('获焦记录:' + this.focusText) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0280.ets new file mode 100644 index 0000000000000000000000000000000000000000..d19dce7c8e443628a4027192483e321ad280dd6b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0280.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0280 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + @State focusText: number[] = []; + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.Wrap , direction:FlexDirection.Row }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('25%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .focusable(item === 5 || item === 9 ? false : true) + .onFocus(() => { + this.focusText.push(item) + }) + }, (item: string) => item) + } + .height(500) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Text('获焦记录:' + this.focusText) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0290.ets new file mode 100644 index 0000000000000000000000000000000000000000..698b1a48f5f356de02e18fca3b77b4b970724a46 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0290.ets @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0290_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0290_DataSource extends FocuseventInteraction0290_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0290 { + @State arr: FocuseventInteraction0290_DataSource = new FocuseventInteraction0290_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 4; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Flex() { + Column({ space: 10 }) { + LazyForEach(this.arr, (item: number) => { + Row() { + Button('item_' + item) + .id('ActionEventCommoneventFocuseventInteraction0290_'+item) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .onDragStart(()=>{ + this.arr.pushData("21") + }) + .height(500) + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0300.ets new file mode 100644 index 0000000000000000000000000000000000000000..4834bc1cdc27d58290a79919b81d06f58aa5e850 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0300.ets @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0300_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0300_DataSource extends FocuseventInteraction0300_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0300 { + @State arr: FocuseventInteraction0300_DataSource = new FocuseventInteraction0300_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 4; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Flex() { + Column({ space: 10 }) { + LazyForEach(this.arr, (item: number) => { + Row() { + Button('item_' + item) + .id('ActionEventCommoneventFocuseventInteraction0300_'+item) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .onDragStart(()=>{ + this.arr.pushData("21") + }) + .height(500) + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0310.ets new file mode 100644 index 0000000000000000000000000000000000000000..f993f4bbe2089d638258c49d7efdfd67d0ab2e90 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0310.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0310 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.Wrap , direction:FlexDirection.Row }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('25%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + }, (item: string) => item) + } + .height(500) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction_12'); + }).id('FocuseventInteraction_0').focusable(false) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0320.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0320.ets new file mode 100644 index 0000000000000000000000000000000000000000..988fae9c4decef1388e717e50d4d627b8830887e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0320.ets @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0320 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.Wrap , direction:FlexDirection.Row }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('25%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .focusable(item === 8 ? false : true) + }, (item: string) => item) + } + .height(500) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction_7'); + }).id('FocuseventInteraction_0').focusable(false) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0330.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0330.ets new file mode 100644 index 0000000000000000000000000000000000000000..178bff48c0765692027b1bd5c379637eecf507b4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0330.ets @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0330 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.Wrap , direction:FlexDirection.Row }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('25%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + .focusable(item === 5 ? false : true) + }, (item: string) => item) + } + .height(500) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Button('初始获焦').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction_6'); + }).id('FocuseventInteraction_0').focusable(false) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0340.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0340.ets new file mode 100644 index 0000000000000000000000000000000000000000..2f259bc8ebbcb1b7543c7892ba8262792f968c03 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0340.ets @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0340 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.Wrap , direction:FlexDirection.Row }) { + ForEach(this.arr, (item: number) => { + Button('' + item).width('25%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + }, (item: string) => item) + } + .height(500) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Row({space: 20}) { + Button('初始获焦_5').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction_5'); + }).id('FocuseventInteraction_001').focusable(false) + Button('初始获焦_4').onClick(() => { + this.getUIContext().getFocusController().requestFocus('FocuseventInteraction_4'); + }).id('FocuseventInteraction_002').focusable(false) + } + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0350.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0350.ets new file mode 100644 index 0000000000000000000000000000000000000000..7e271474c157f539fe141dbd52a3a09b211c0fde --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0350.ets @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0350 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + ForEach(this.arr, (item: number) => { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .id('ActionEventCommoneventFocuseventInteraction0350_' + item) + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0360.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0360.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9b0575afb3fa428d9e292086e63bed7cd93ca62 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0360.ets @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0360 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + ForEach(this.arr, (item: number) => { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .id('ActionEventCommoneventFocuseventInteraction0360_' + item) + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0370.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0370.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b36fd949710953cfd6e003fae66058a4b844a8e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0370.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0370 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Flex({ direction: FlexDirection.Column }) { + ForEach(this.arr, (item: number) => { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .id('ActionEventCommoneventFocuseventInteraction0370_' + item) + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0380.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0380.ets new file mode 100644 index 0000000000000000000000000000000000000000..b6152a1d70b3f44f593dd17e0d608e15e25f46d3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0380.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0380 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Flex({ direction: FlexDirection.Column }) { + ForEach(this.arr, (item: number) => { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .id('ActionEventCommoneventFocuseventInteraction0380_' + item) + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0390.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0390.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa3296241200a1436e05c32178ede985d91c393c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0390.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0390 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .id('ActionEventCommoneventFocuseventInteraction0390_' + item) + } + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0400.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0400.ets new file mode 100644 index 0000000000000000000000000000000000000000..a85ecae2db249b80c257666fdcfb034b73f8fcf4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0400.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0400 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .id('ActionEventCommoneventFocuseventInteraction0400_' + item) + } + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0410.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0410.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b1058c1ff16bb9ec89f5597e5912e91882a073b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0410.ets @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0410 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .id('ActionEventCommoneventFocuseventInteraction0410_' + item) + } + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0420.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0420.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3d67698780779fa6fda8a142840d1aec8f76de2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0420.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0420 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .id('ActionEventCommoneventFocuseventInteraction0420_' + item) + } + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0430.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0430.ets new file mode 100644 index 0000000000000000000000000000000000000000..213a35ad7fe5ab00a5eba695fdb207806d32c92a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0430.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0430 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Row() { + ForEach(this.arr, (item: number) => { + Button(item.toString()) + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .id('ActionEventCommoneventFocuseventInteraction0430_' + item) + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0440.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0440.ets new file mode 100644 index 0000000000000000000000000000000000000000..1bfb2bce99e5bf3ba0701599654fcb33df12afca --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0440.ets @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0440 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Row() { + ForEach(this.arr, (item: number) => { + Button(item.toString()) + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .id('ActionEventCommoneventFocuseventInteraction0440_' + item) + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0450.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0450.ets new file mode 100644 index 0000000000000000000000000000000000000000..7cbf53c3a3e958d28e609c33dae9ef48128e0275 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0450.ets @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0450 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + WaterFlow() { + ForEach(this.arr, (item: number) => { + FlowItem() { + Button(item.toString()) + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + .id('ActionEventCommoneventFocuseventInteraction0450_' + item) + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0460.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0460.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e8acae90dc6c1d6ae9bf76caa81167772fe40e6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0460.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0460 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + WaterFlow() { + ForEach(this.arr, (item: number) => { + FlowItem() { + Button(item.toString()) + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + .id('ActionEventCommoneventFocuseventInteraction0460_' + item) + }, (item: string) => item) + }.onDragStart(() => { + this.arr.unshift(11) + }) + .margin({ top: 10, left: 20 }) + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0470.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0470.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a51a179c1d78a0a5556863e2a77953132c3df31 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0470.ets @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0470 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable(true) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(300) + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + + Row({space: 20}) { + Button('增加2').onClick(() => { + this.arr.splice(1, 1) + }).id('FocuseventInteraction_001').focusable(false) + } + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0480.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0480.ets new file mode 100644 index 0000000000000000000000000000000000000000..0aaa0e526765c56b4d9be741c4c75e2db2ae513f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0480.ets @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0480 { + @State arr: number[] = [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable(true) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(300) + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + + Row({space: 20}) { + Button('增加2').onClick(() => { + this.arr.splice(1, 0, 2) + }).id('FocuseventInteraction_001').focusable(false) + } + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0490.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0490.ets new file mode 100644 index 0000000000000000000000000000000000000000..5969c1964a7900729f579a8efe9b388e014ca6eb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0490.ets @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +class FocuseventInteraction0490_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0490_DataSource extends FocuseventInteraction0490_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0490 { + @State arr:FocuseventInteraction0490_DataSource = new FocuseventInteraction0490_DataSource(); + + aboutToAppear(): void { + for (let i = 1; i <= 14; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.Wrap , direction:FlexDirection.Row }) { + LazyForEach(this.arr, (item: number) => { + Button('' + item).width('25%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + }, (item: string) => item) + } + .height(500) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Row({space: 20}) { + Button('删除2').onClick(() => { + this.arr.deleteData(1); + }).id('FocuseventInteraction_001').focusable(false) + } + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0500.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0500.ets new file mode 100644 index 0000000000000000000000000000000000000000..49b657226de6bb7d018fe9d5900179406c665c14 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0500.ets @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +class FocuseventInteraction0500_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0500_DataSource extends FocuseventInteraction0500_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0500 { + @State arr:FocuseventInteraction0500_DataSource = new FocuseventInteraction0500_DataSource(); + + aboutToAppear(): void { + for (let i = 1; i <= 14; i++) { + if(i != 2) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + } + + build() { + Column({ space: 10 }) { + Flex({ wrap: FlexWrap.Wrap , direction:FlexDirection.Row }) { + LazyForEach(this.arr, (item: number) => { + Button('' + item).width('25%').height(100).margin({ + bottom: 10 + }).id('FocuseventInteraction_' + item) + }, (item: string) => item) + } + .height(500) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + Row({space: 20}) { + Button('增加2').onClick(() => { + this.arr.addData(1, '2'); + }).id('FocuseventInteraction_001').focusable(false) + } + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0510.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0510.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd2096744a784452642d57eac67a82e3df04e4ef --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0510.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0510 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable(item !== 5 ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .defaultFocus(item === 2 ? true : false) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(300) + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0520.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0520.ets new file mode 100644 index 0000000000000000000000000000000000000000..572aec2b8eb07dbfdd1e22fe47bd3f8bc3fdcfeb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0520.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0520 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable(item !== 5 ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .defaultFocus(item === 8 ? true : false) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(300) + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0530.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0530.ets new file mode 100644 index 0000000000000000000000000000000000000000..ffc96873e96f00dfb2151d44c79a733a92baad4e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0530.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0530 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable(item !== 5 ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .defaultFocus(item === 6 ? true : false) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(300) + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0540.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0540.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9048382af11c47bdb5c4a3b2b9a3b71581e01ee --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0540.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0540 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable(item !== 5 ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .defaultFocus(item === 4 ? true : false) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(300) + .columnsTemplate('1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0550.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0550.ets new file mode 100644 index 0000000000000000000000000000000000000000..b72c27c6c3e0196fde58e96c7ad54de68bbfa4e0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0550.ets @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0550 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .width(80) + .height(80) + .focusable((item !== 2 && item !== 3) ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .defaultFocus(item === 1 ? true : false) + .onFocus(() => { + this.focusRecord.push(item) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0560.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0560.ets new file mode 100644 index 0000000000000000000000000000000000000000..254968d2ae7010893d3f7d877dcd7262d153889f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0560.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0560 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id(`${item}`) + .width(80) + .height(80) + .focusable((item !== 5 && item !== 9) ? true : false) + .textAlign(TextAlign.Center) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + Row({ space: 10 }) { + Button('获焦_13').onClick((event: ClickEvent) => { + this.getUIContext().getFocusController().requestFocus('13') + }).id('FocuseventInteraction_001') + } + + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0570.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0570.ets new file mode 100644 index 0000000000000000000000000000000000000000..4665c15bdb307102dce34d0fa64b8d1ff41e94cc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0570.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0570 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2] + + build() { + Column() { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }.columnStart(1) + .columnEnd(4) + }, (item: string) => item) + } + .margin({ top: 10, left: 20 }) + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0580.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0580.ets new file mode 100644 index 0000000000000000000000000000000000000000..210f6a809ed0d4ab9e1648cadb2a8ebc745d925e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0580.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0580 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2] + + build() { + Column() { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }.rowStart(1) + .rowEnd(4) + }, (item: string) => item) + } + .margin({ top: 10, left: 20 }) + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0590.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0590.ets new file mode 100644 index 0000000000000000000000000000000000000000..2a8ec23b7aa27a46b89c6057a161f7f50e6da5e4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0590.ets @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0590_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0590_DataSource extends FocuseventInteraction0590_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0590 { + @State arr: FocuseventInteraction0590_DataSource = new FocuseventInteraction0590_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 4; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Grid() { + LazyForEach(this.arr, (item: number) => { + GridItem() { + Button('item_' + item) + .id('ActionEventCommoneventFocuseventInteraction0590_'+item) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + }.width('100%') + }, (item: string) => item) + }.onDragStart(()=>{ + this.arr.pushData("21") + }) + } + .height(500) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0600.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0600.ets new file mode 100644 index 0000000000000000000000000000000000000000..d4b977a90e2702606f3f9f77e3874a3ecb13d1c9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0600.ets @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0600_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0600_DataSource extends FocuseventInteraction0600_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0600 { + @State arr: FocuseventInteraction0600_DataSource = new FocuseventInteraction0600_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 4; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Grid() { + LazyForEach(this.arr, (item: number) => { + GridItem() { + Button('item_' + item) + .id('ActionEventCommoneventFocuseventInteraction0600_'+item) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + }.width('100%') + }, (item: string) => item) + }.onDragStart(()=>{ + this.arr.pushData("21") + }) + } + .height(500) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0610.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0610.ets new file mode 100644 index 0000000000000000000000000000000000000000..a37fdb02a8fed3fc20339deeaba6a9d4cd0b943a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0610.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0610 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id(`${item}`) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(true) + .defaultFocus(item === 12 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0620.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0620.ets new file mode 100644 index 0000000000000000000000000000000000000000..91e98e0d1f156d9a98e58230e82b6710407acef1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0620.ets @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0620 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id(`${item}`) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(200) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0630.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0630.ets new file mode 100644 index 0000000000000000000000000000000000000000..16b7838c3ecaec4d0b98de5b87edaa68fddbc8cc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0630.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0630 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id(`${item}`) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(item === 4 ? false : true) + .defaultFocus(item === 3 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0640.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0640.ets new file mode 100644 index 0000000000000000000000000000000000000000..acae50161f3a2af390965906837c25ee5af785e0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0640.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0640 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id(`${item}`) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(item === 5 ? false : true) + .defaultFocus(item === 6 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0650.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0650.ets new file mode 100644 index 0000000000000000000000000000000000000000..2cf8e2d9ce71b49b5fa81dee2c42f578aeb5d50c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0650.ets @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0650 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Grid() { + ForEach(this.arr, (item: number) => { + GridItem() { + Column({ space: 10 }) { + Text('item_' + item) + .id(`${item}`) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + } + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .columnsTemplate('1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .border({ + width: 2, + color: Color.Black + }) + Row({space: 10}) { + Button('获焦_5').onClick((event: ClickEvent) => { + this.getUIContext().getFocusController().requestFocus('5') + }).id('FocuseventInteraction_001') + + Button('获焦_8').onClick((event: ClickEvent) => { + this.getUIContext().getFocusController().requestFocus('8') + }).id('FocuseventInteraction_002') + } + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0660.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0660.ets new file mode 100644 index 0000000000000000000000000000000000000000..162c6619ad7b78bb785fe92fbf0e865cb1fe4e91 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0660.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0660 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(item === 5 ? false : true) + .defaultFocus(item !== 8 ? false : true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .lanes(3, 20) + .border({ + width: 2, + color: Color.Black + }) + + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0670.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0670.ets new file mode 100644 index 0000000000000000000000000000000000000000..239f2a2ba2bd490af11ec53b2b9884fe6e728dbd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0670.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0670 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(item === 5 ? false : true) + .defaultFocus(item !== 2 ? false : true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .lanes(3, 20) + .border({ + width: 2, + color: Color.Black + }) + + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0680.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0680.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1a86fd2ac9f931a78025e6295d63bde55bc4b85 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0680.ets @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0680 { + scroller: Scroller = new Scroller() + @State arr: number[] = [1] + + build() { + Column() { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Button('1') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('2') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('3') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('4') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('5') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }.focusable(false) + ListItem() { + Button('6') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('7') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('8') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('9') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + + }, (item: string) => item) + } + .lanes(3) + .margin({ top: 10, left: 20 }) + + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0690.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0690.ets new file mode 100644 index 0000000000000000000000000000000000000000..deba2fe84f9ff9b4777104b52edf8ed7de8a65d1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0690.ets @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0690 { + scroller: Scroller = new Scroller() + @State arr: number[] = [1] + + build() { + Column() { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Button('1') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('2') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('3') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('4') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('5') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }.focusable(false) + ListItem() { + Button('6') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('7') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('8') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('9') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + + }, (item: string) => item) + } + .lanes(3) + .margin({ top: 10, left: 20 }) + + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0700.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0700.ets new file mode 100644 index 0000000000000000000000000000000000000000..e77ed641d586d2c592dc9d4c26144115a8376986 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0700.ets @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0700 { + scroller: Scroller = new Scroller() + @State arr: number[] = [1] + + build() { + Column() { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Button('1') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }.focusable(false) + ListItem() { + Button('2') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }.focusable(false) + ListItem() { + Button('3') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('4') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('5') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('6') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('7') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('8') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('9') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + + }, (item: string) => item) + } + .lanes(3) + .margin({ top: 10, left: 20 }) + + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0710.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0710.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ba503ddb5b02d681744ce4a2fb85e7f8f45b249 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0710.ets @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0710 { + scroller: Scroller = new Scroller() + @State arr: number[] = [1] + + build() { + Column() { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Button('1') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }.focusable(false) + ListItem() { + Button('2') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('3') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('4') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }.focusable(false) + ListItem() { + Button('5') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('6') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('7') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('8') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + ListItem() { + Button('9') + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + + }, (item: string) => item) + } + .lanes(3) + .margin({ top: 10, left: 20 }) + + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0720.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0720.ets new file mode 100644 index 0000000000000000000000000000000000000000..5fe090827482b3c335b24c88701e4f1c7df1fb75 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0720.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0720 { + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + Row() { + Button('删除子组件') + .id('ActionEventCommoneventFocuseventInteraction0720_001') + .onClick(() => { + this.arr.shift() + }) + } + + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('' + item) + .width('100%') + .height(100) + .fontSize(16) + .textAlign(TextAlign.Center) + .borderRadius(10) + .backgroundColor(0xFFFFFF) + } + + }, (item: string) => item) + }.width('90%') + }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0730.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0730.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6ddfa871747f832ca8620dd4a7f6039682120a1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0730.ets @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0730 { + scroller: Scroller = new Scroller() + @State arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + Button('增加list').onClick(() => { + this.arr.unshift(11) + }).id('ActionEventCommoneventFocuseventInteraction0730_1') + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Button(item.toString()) + .width('50%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + } + + }, (item: string) => item) + } + .margin({ top: 10, left: 20 }) + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0740.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0740.ets new file mode 100644 index 0000000000000000000000000000000000000000..ce89acfe56dc261b633ffa7129cb06bd860bc499 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0740.ets @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0740_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0740_DataSource extends FocuseventInteraction0740_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0740 { + @State arr: FocuseventInteraction0740_DataSource = new FocuseventInteraction0740_DataSource(); + @State focusRecord: number[] = []; + @State focusableValue: boolean = true + + aboutToAppear(): void { + for (let i = 1; i <= 9; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + scroller: Scroller = new Scroller() + + build() { + Column({ space: 10 }) { + List() { + LazyForEach(this.arr, (item: number) => { + ListItem() { + Button('item_' + item) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .focusable(item == 5 ? false : true) + } + }, (item: string) => item) + } + .lanes(3) + .margin({ top: 10, left: 20 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0750.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0750.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a087b5b4a7b28393be7868c01c12542f1b7bc0e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0750.ets @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0750_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0750_DataSource extends FocuseventInteraction0750_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0750 { + @State arr: FocuseventInteraction0750_DataSource = new FocuseventInteraction0750_DataSource(); + @State focusRecord: number[] = []; + @State focusableValue: boolean = true + + aboutToAppear(): void { + for (let i = 1; i <= 9; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + scroller: Scroller = new Scroller() + + build() { + Column({ space: 10 }) { + List() { + LazyForEach(this.arr, (item: number) => { + ListItem() { + Button('item_' + item) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .focusable(item == 5 ? false : true) + } + }, (item: string) => item) + } + .lanes(3) + .margin({ top: 10, left: 20 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0760.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0760.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ab20b150e5d111dc32dda31386f9e5a1bab915a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0760.ets @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0760_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0760_DataSource extends FocuseventInteraction0760_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0760 { + @State arr: FocuseventInteraction0760_DataSource = new FocuseventInteraction0760_DataSource(); + @State focusRecord: number[] = []; + @State focusableValue: boolean = true + + aboutToAppear(): void { + for (let i = 1; i <= 9; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + scroller: Scroller = new Scroller() + + build() { + Column({ space: 10 }) { + List() { + LazyForEach(this.arr, (item: number) => { + ListItem() { + Button('item_' + item) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .focusable(item == 5 ? false : true) + } + }, (item: string) => item) + } + .lanes(3) + .margin({ top: 10, left: 20 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0770.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0770.ets new file mode 100644 index 0000000000000000000000000000000000000000..927ad49acd655baad02159ab3278995326d559d5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0770.ets @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0770_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0770_DataSource extends FocuseventInteraction0770_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0770 { + @State arr: FocuseventInteraction0770_DataSource = new FocuseventInteraction0770_DataSource(); + @State focusRecord: number[] = []; + @State focusableValue: boolean = true + + aboutToAppear(): void { + for (let i = 1; i <= 9; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + scroller: Scroller = new Scroller() + + build() { + Column({ space: 10 }) { + List() { + LazyForEach(this.arr, (item: number) => { + ListItem() { + Button('item_' + item) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .focusable(item == 5 ? false : true) + } + }, (item: string) => item) + } + .lanes(3) + .margin({ top: 10, left: 20 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0780.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0780.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d3e8d469add66b0a930c129ab91f3e3159f638c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0780.ets @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0780_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0780_DataSource extends FocuseventInteraction0780_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0780 { + @State arr: FocuseventInteraction0780_DataSource = new FocuseventInteraction0780_DataSource(); + @State focusRecord: number[] = []; + @State focusableValue: boolean = true + + aboutToAppear(): void { + for (let i = 1; i <= 9; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + scroller: Scroller = new Scroller() + + build() { + Column({ space: 10 }) { + List() { + LazyForEach(this.arr, (item: number) => { + ListItem() { + Button('item_' + item) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .focusable(item == 1 || item == 2 ? false : true) + } + }, (item: string) => item) + } + .lanes(3) + .margin({ top: 10, left: 20 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0790.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0790.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb53635d5ccca457ae1818e2bde3e0f7cbb58a9a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0790.ets @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0790_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0790_DataSource extends FocuseventInteraction0790_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0790 { + @State arr: FocuseventInteraction0790_DataSource = new FocuseventInteraction0790_DataSource(); + @State focusRecord: number[] = []; + @State focusableValue: boolean = true + + aboutToAppear(): void {1 + for (let i = 1; i <= 9; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + scroller: Scroller = new Scroller() + + build() { + Column({ space: 10 }) { + List() { + LazyForEach(this.arr, (item: number) => { + ListItem() { + Button('item_' + item) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .focusable(item == 2 || item == 5 ? false : true) + } + }, (item: string) => item) + } + .lanes(3) + .margin({ top: 10, left: 20 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0800.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0800.ets new file mode 100644 index 0000000000000000000000000000000000000000..f89da102b07b216becd680fc04c176547d43a7a7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0800.ets @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { LengthMetrics } from '@ohos.arkui.node'; + +class FocuseventInteraction0800_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0800_DataSource extends FocuseventInteraction0800_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0800 { + @State arr: FocuseventInteraction0800_DataSource = new FocuseventInteraction0800_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 3; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 10 }) { + LazyForEach(this.arr, (item: number) => { + Row() { + Button('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .height(500) + + Button('减少item_2').onClick(() => { + this.arr.deleteData(1) + }).id('ActionEventCommoneventFocuseventInteraction0800_001') + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0810.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0810.ets new file mode 100644 index 0000000000000000000000000000000000000000..044b7752f59952fbc30792d2a4267be8c4ff865a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0810.ets @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { LengthMetrics } from '@ohos.arkui.node'; + +class FocuseventInteraction0810_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0810_DataSource extends FocuseventInteraction0810_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0810 { + @State arr: FocuseventInteraction0810_DataSource = new FocuseventInteraction0810_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 3; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 10 }) { + LazyForEach(this.arr, (item: number) => { + Row() { + Button('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .height(500) + + Button('增加item_21').onClick(() => { + this.arr.pushData('21') + }).id('ActionEventCommoneventFocuseventInteraction0810_001') + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0820.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0820.ets new file mode 100644 index 0000000000000000000000000000000000000000..22efe7009e3f5cf78072a3bc46ca2afa41cd45ee --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0820.ets @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction0820_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0820_DataSource extends FocuseventInteraction0820_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0820 { + @State arr: FocuseventInteraction0820_DataSource = new FocuseventInteraction0820_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 4; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + List() { + LazyForEach(this.arr, (item: number) => { + ListItem() { + Button('item_' + item) + .id('ActionEventCommoneventFocuseventInteraction0820_'+item) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + }.width('100%') + }, (item: string) => item) + }.onDragStart(()=>{ + this.arr.pushData("21") + }) + } + .height(500) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0830.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0830.ets new file mode 100644 index 0000000000000000000000000000000000000000..41aaaf33ec14b21015a412eff690cb8c97268545 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0830.ets @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +class FocuseventInteraction0830_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0830_DataSource extends FocuseventInteraction0830_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0830 { + @State arr: FocuseventInteraction0830_DataSource = new FocuseventInteraction0830_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 3; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + List({ space: 10, initialIndex: 0 }) { + LazyForEach(this.arr, (item: number) => { + ListItemGroup({ + space: 4 + }) + ListItem() { + Button('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .id('ActionEventCommoneventFocuseventInteraction0830_'+item) + .onDragStart(()=>{ + this.arr.pushData('21') + }) + }, (item: string) => item) + } + }.height(500) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0840.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0840.ets new file mode 100644 index 0000000000000000000000000000000000000000..f92239141de2739d75a6388a547d0f302f7f2882 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0840.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0840 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(true) + .defaultFocus(item !== 9 ? false : true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .lanes(3, 20) + .border({ + width: 2, + color: Color.Black + }) + + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0850.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0850.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d554213281462a31fed8e86833e058b2d79fb33 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0850.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0850 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + List({ space: 20 }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('item_' + item) + .id(`${item}`) + .margin({ + top: 10 + }) + .width('90%') + .height(80) + .textAlign(TextAlign.Center) + .focusable(true) + + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + } + .listDirection(Axis.Horizontal) + .height(100) + }.height(120) + .align(Alignment.Center) + .border({ + width: 2, + color: Color.Black + }) + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0860.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0860.ets new file mode 100644 index 0000000000000000000000000000000000000000..7370d10f42ea109616878de75ac95356dcc2152b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0860.ets @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0860 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + List({ space: 20 }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('item_' + item) + .id(`${item}`) + .margin({ + top: 10 + }) + .width('90%') + .height(80) + .textAlign(TextAlign.Center) + .focusable(true) + + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + } + .height(100) + }.height(120) + .align(Alignment.Center) + .border({ + width: 2, + color: Color.Black + }) + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0870.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0870.ets new file mode 100644 index 0000000000000000000000000000000000000000..f82b1321f876c155f43ac26c65d033fa24ba73e4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0870.ets @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0870 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(item !== 9 ? true : false) + .defaultFocus(item !== 8 ? false : true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(430) + .padding(10) + .lanes(3, 20) + .border({ + width: 2, + color: Color.Black + }) + + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0880.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0880.ets new file mode 100644 index 0000000000000000000000000000000000000000..188ce362022ae5f624f3fa4aafe2e8077ff061d3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0880.ets @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0880 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('item_' + item) + .id(`${item}`) + .margin(20) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(item !== 4 ? true : false) + .defaultFocus(item !== 5 ? false : true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + + .lanes(3, 20) + + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0890.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0890.ets new file mode 100644 index 0000000000000000000000000000000000000000..425530021d9866a256efafdaca103d7b9211de87 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0890.ets @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0890 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + List() { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('item_' + item) + .id(`${item}`) + .margin(20) + .width(80) + .height(80) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + } + }, (item: string) => item) + }.height(380) + .lanes(3, 20) + + Row({space: 10}) { + Button('获焦_3').onClick((event: ClickEvent) => { + this.getUIContext().getFocusController().requestFocus('3') + }).id('FocuseventInteraction_001') + + Button('获焦_4').onClick((event: ClickEvent) => { + this.getUIContext().getFocusController().requestFocus('4') + }).id('FocuseventInteraction_002') + } + + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0900.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0900.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ef9047da10abb9805133d3feb3021459ecc2c91 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0900.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class A { + text: string = '' + num: number = 0 +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0900 { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + @State currentIndex: number = 0 + + @Builder NavigationTitle() { + Column() { + Text('Title') + .fontColor('#182431') + .fontSize(30) + .lineHeight(41) + .fontWeight(700) + Text('subtitle') + .fontColor('#182431') + .fontSize(14) + .lineHeight(19) + .opacity(0.4) + .margin({ top: 2, bottom: 20 }) + }.alignItems(HorizontalAlign.Start) + } + + build() { + Column() { + Navigation() { + List({ space: 12, initialIndex: 0 }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Button(item.toString()) + .width('90%') + .height(72) + .backgroundColor(Color.Blue + ) + .borderRadius(24) + .fontSize(16) + .fontWeight(500) + } + }, (item: number) => item.toString()) + }.lanes(2) + .height(324) + .width('100%') + .margin({ top: 12, left: '10%' }) + } + .title(this.NavigationTitle) + .titleMode(NavigationTitleMode.Full) + + .hideTitleBar(false) + .hideToolBar(false) + .onTitleModeChange((titleModel: NavigationTitleMode) => { + console.info('titleMode' + titleModel) + }) + }.width('100%').height('100%').backgroundColor('#F1F3F5') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0910.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0910.ets new file mode 100644 index 0000000000000000000000000000000000000000..890666a743f753632b0b21be757315674570000f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0910.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0910 { + @State rating: number = 3 + @State focusRecord: string[] = [] + + build() { + Row({ space: 10 }) { + Button('左').onFocus(()=>{ + this.focusRecord.push('左'); + }) + Column({ space: 10 }) { + Button('上').onFocus(()=>{ + this.focusRecord.push('上'); + }) + Rating({ rating: this.rating, indicator: false }) + .stars(3) + .stepSize(3) + .defaultFocus(true) + .onFocus(()=>{ + this.focusRecord.push('Rating'); + }) + Button('下').onFocus(()=>{ + this.focusRecord.push('下'); + }) + Text(`focusRecord: ${this.focusRecord}`) + }.width(250).height(150) + Button('右').onFocus(()=>{ + this.focusRecord.push('右'); + }) + }.width('100%').height('100%').backgroundColor('#F1F3F5').justifyContent(FlexAlign.Center) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0920.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0920.ets new file mode 100644 index 0000000000000000000000000000000000000000..25fe1f3798206d56a67d7ca14830654bb92916a0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0920.ets @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0920 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .height(500) + + Button('删除item_2').onClick(() => { + this.arr.splice(1, 1) + }).id('FocuseventInteraction_001') + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0930.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0930.ets new file mode 100644 index 0000000000000000000000000000000000000000..aeb7be1c2595d709139e7bc6f51e8f8021b55238 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0930.ets @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0930 { + @State arr: number[] = [1, 3, 4, 5, 6, 7, 8, 9]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .height(500) + + Button('增加item_2').onClick(() => { + this.arr.splice(1, 0, 2) + }).id('FocuseventInteraction_001') + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0940.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0940.ets new file mode 100644 index 0000000000000000000000000000000000000000..98339480a0684257c49a6629e1651497e9f97539 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0940.ets @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +class FocuseventInteraction0940_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0940_DataSource extends FocuseventInteraction0940_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0940 { + @State arr: FocuseventInteraction0940_DataSource = new FocuseventInteraction0940_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 14; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 10 }) { + LazyForEach(this.arr, (item: number) => { + Row() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .height(500) + Button('减少item_2').onClick(() => { + this.arr.deleteData(1) + }).id('FocuseventInteraction_001') + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0950.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0950.ets new file mode 100644 index 0000000000000000000000000000000000000000..21d6e7f6e1116ed9fe1586bad3144567bbb7076e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0950.ets @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +class FocuseventInteraction0940_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction0940_DataSource extends FocuseventInteraction0940_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0940 { + @State arr: FocuseventInteraction0940_DataSource = new FocuseventInteraction0940_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 14; i++) { + if(i!== 2) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + } + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 10 }) { + LazyForEach(this.arr, (item: number) => { + Row() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .height(500) + Button('增加item_2').onClick(() => { + this.arr.addData(1, '2') + }).id('FocuseventInteraction_001') + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0960.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0960.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d5cf5ca1c91e91778cc7be81e5ce19cfca88248 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0960.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0960 { + @State arr: number[] = [1, 2 ,3]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + ForEach(this.arr, (e: number) => { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + (item + (e-1) * 3)) + .id((item + (e-1) * 3) + '') + .margin({ + bottom: 20 + }) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .focusable((item + (e-1) * 3) !== 5 ? true : false) + .defaultFocus((item + (e-1) * 3) === 2 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .padding(10) + .width('30%') + .height(100) + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + }.width('100%') + }, (e: string) => e) + Text(`focusRecord: ${this.focusRecord}`) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0970.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0970.ets new file mode 100644 index 0000000000000000000000000000000000000000..64bb16da907e8a7c2e3a1333997d61974a02ca03 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0970.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0970 { + @State arr: number[] = [1, 2 ,3]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + ForEach(this.arr, (e: number) => { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + (item + (e-1) * 3)) + .id((item + (e-1) * 3) + '') + .margin({ + bottom: 20 + }) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .focusable((item + (e-1) * 3) !== 5 ? true : false) + .defaultFocus((item + (e-1) * 3) === 8 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .padding(10) + .width('30%') + .height(100) + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + }.width('100%') + }, (e: string) => e) + Text(`focusRecord: ${this.focusRecord}`) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0980.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0980.ets new file mode 100644 index 0000000000000000000000000000000000000000..cbad8fdea384958fb6145e096ed27bc38163c008 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0980.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0980 { + @State arr: number[] = [1, 2 ,3]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + ForEach(this.arr, (e: number) => { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + (item + (e-1) * 3)) + .id((item + (e-1) * 3) + '') + .margin({ + bottom: 20 + }) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .focusable((item + (e-1) * 3) !== 5 ? true : false) + .defaultFocus((item + (e-1) * 3) === 6 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .padding(10) + .width('30%') + .height(100) + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + }.width('100%') + }, (e: string) => e) + Text(`focusRecord: ${this.focusRecord}`) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0990.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0990.ets new file mode 100644 index 0000000000000000000000000000000000000000..5186f69cb7f7b89c07e6a269fe417d35bb83a407 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0990.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction0990 { + @State arr: number[] = [1, 2 ,3]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + ForEach(this.arr, (e: number) => { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + (item + (e-1) * 3)) + .id((item + (e-1) * 3) + '') + .margin({ + bottom: 20 + }) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .focusable((item + (e-1) * 3) !== 5 ? true : false) + .defaultFocus((item + (e-1) * 3) === 4 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .padding(10) + .width('30%') + .height(100) + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + }.width('100%') + }, (e: string) => e) + Text(`focusRecord: ${this.focusRecord}`) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1000.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1000.ets new file mode 100644 index 0000000000000000000000000000000000000000..08e553e7a46d27b567c47532af254e8f38982b5b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1000.ets @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1000 { + @State arr: number[] = [1, 2 ,3, 4]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + ForEach(this.arr, (e: number) => { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + (item + (e-1) * 4)) + .id((item + (e-1) * 4) + '') + .margin({ + bottom: 20 + }) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .focusable((item + (e-1) * 4) !== 2 && (item + (e-1) * 4) !== 3 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .padding(10) + .width('22%') + .height(100) + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + }.width('100%') + }, (e: string) => e) + Text(`focusRecord: ${this.focusRecord}`) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1010.ets new file mode 100644 index 0000000000000000000000000000000000000000..311bdcaaa9f08deb654eda0527eba1c85406cf25 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1010.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1010 { + @State arr: number[] = [1, 2 ,3, 4]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + ForEach(this.arr, (e: number) => { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + (item + (e-1) * 4)) + .id((item + (e-1) * 4) + '') + .margin({ + bottom: 20 + }) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .focusable((item + (e-1) * 4) !== 5 && (item + (e-1) * 4) !== 9 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .padding(10) + .width('22%') + .height(100) + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + }.width('100%') + }, (e: string) => e) + Button('获焦_13').onClick(() => { + this.getUIContext().getFocusController().requestFocus('13') + }).id('Interaction0180_001') + Text(`focusRecord: ${this.focusRecord}`) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1020.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4f846c9461d82f2a264370f6f07116815e75eb5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1020.ets @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction1020_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction1020_DataSource extends FocuseventInteraction1020_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1020 { + @State arr: FocuseventInteraction1020_DataSource = new FocuseventInteraction1020_DataSource(); + @State focusRecord: number[] = []; + @State focusableValue: boolean = true + + aboutToAppear(): void { + for (let i = 1; i <= 9; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + scroller: Scroller = new Scroller() + + build() { + Row({ space: 10 }) { + List() { + LazyForEach(this.arr, (item: number) => { + ListItem() { + Button('item_' + item) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .focusable(item == 5 ? false : true) + }.id('ActionEventCommoneventFocuseventInteraction1020_'+item) + }, (item: string) => item) + } + .lanes(3) + .onDragStart(()=>{ + this.arr.pushData('21') + }) + .margin({ top: 10, left: 20 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1030.ets new file mode 100644 index 0000000000000000000000000000000000000000..db5682c3f8c78deb022c009023a4c64bf7af4a31 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1030.ets @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +class FocuseventInteraction1030_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction1030_DataSource extends FocuseventInteraction1030_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1030 { + @State arr: FocuseventInteraction1030_DataSource = new FocuseventInteraction1030_DataSource(); + @State focusRecord: number[] = []; + + aboutToAppear(): void { + for (let i = 1; i <= 14; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 10 }) { + LazyForEach(this.arr, (item: number) => { + Row() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.id('ActionEventCommoneventFocuseventInteraction1030_001') + .draggable(true) + .onDragStart(() => { + this.arr.deleteData(1) + }) + .width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .height(500) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1040.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c6f187f5465a5387dbf75f0c23ab510cadca0dc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1040.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1040 { + @State arr: number[] = [1, 2 ,3, 4]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + ForEach(this.arr, (e: number) => { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + (item + (e-1) * 4)) + .id((item + (e-1) * 4) + '') + .margin({ + bottom: 20 + }) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .focusable(true) + .defaultFocus((item + (e-1) * 4) === 12 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .visibility((item + (e-1) * 4) > 14 ? Visibility.None : Visibility.Visible) + .padding(10) + .width('22%') + .height(100) + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + }.width('100%') + }, (e: string) => e) + + Text(`focusRecord: ${this.focusRecord}`) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1050.ets new file mode 100644 index 0000000000000000000000000000000000000000..87800b44af5646062484495bf8928c6d1f233485 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1050.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1050 { + @State arr: number[] = [1, 2 ,3, 4]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + ForEach(this.arr, (e: number) => { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + (item + (e-1) * 4)) + .id((item + (e-1) * 4) + '') + .margin({ + bottom: 20 + }) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .focusable((item + (e-1) * 4) !== 12 ? true : false) + .defaultFocus((item + (e-1) * 4) === 11 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .visibility((item + (e-1) * 4) > 14 ? Visibility.None : Visibility.Visible) + .padding(10) + .width('22%') + .height(100) + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + }.width('100%') + }, (e: string) => e) + + Text(`focusRecord: ${this.focusRecord}`) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1060.ets new file mode 100644 index 0000000000000000000000000000000000000000..f57266af2bfc4ae5840376a89a2972a73ffe3cea --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1060.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1060 { + @State arr: number[] = [1, 2 ,3, 4]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + ForEach(this.arr, (e: number) => { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + (item + (e-1) * 4)) + .id((item + (e-1) * 4) + '') + .margin({ + bottom: 20 + }) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .focusable((item + (e-1) * 4) !== 5 ? true : false) + .defaultFocus((item + (e-1) * 4) === 6 ? true : false) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .visibility((item + (e-1) * 4) > 14 ? Visibility.None : Visibility.Visible) + .padding(10) + .width('22%') + .height(100) + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + }.width('100%') + }, (e: string) => e) + + Text(`focusRecord: ${this.focusRecord}`) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1070.ets new file mode 100644 index 0000000000000000000000000000000000000000..32e2351144270be2ce323de85a606c249827f177 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1070.ets @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1070 { + @State arr: number[] = [1, 2 ,3, 4]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + ForEach(this.arr, (e: number) => { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + (item + (e-1) * 4)) + .id((item + (e-1) * 4) + '') + .margin({ + bottom: 20 + }) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .padding(10) + .width('22%') + .height(100) + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + }.width('100%') + }, (e: string) => e) + Row({ space: 10 }) { + Button('获焦_4').onClick(() => { + this.getUIContext().getFocusController().requestFocus('4'); + }).id('Interaction_001') + + Button('获焦_5').onClick(() => { + this.getUIContext().getFocusController().requestFocus('5'); + }).id('Interaction_002') + } + Text(`focusRecord: ${this.focusRecord}`) + }.width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1080.ets new file mode 100644 index 0000000000000000000000000000000000000000..809df2617c52daae0a6ca371b47945d1fe2c97c0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1080.ets @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1080 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Scroll() { + Column({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .height(500) + + Row({ space: 10 }) { + Button('获焦_4').onClick(() => { + this.getUIContext().getFocusController().requestFocus('4'); + }).id('Interaction_001') + + Button('获焦_2').onClick(() => { + this.getUIContext().getFocusController().requestFocus('2'); + }).id('Interaction_002') + } + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1090.ets new file mode 100644 index 0000000000000000000000000000000000000000..03b0171b047ad974f63a4f2b0f4811d7cb403e7e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1090.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1080 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Scroll() { + Flex({ space: { + cross: LengthMetrics.vp(10) + },direction: FlexDirection.Column }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + } + .height(500) + + Row({ space: 10 }) { + Button('获焦_4').onClick(() => { + this.getUIContext().getFocusController().requestFocus('4'); + }).id('Interaction_001') + + Button('获焦_2').onClick(() => { + this.getUIContext().getFocusController().requestFocus('2'); + }).id('Interaction_002') + } + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1100.ets new file mode 100644 index 0000000000000000000000000000000000000000..29f17a4f6c914d2dbeef1edb493fd2910eafd285 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1100.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { LengthMetrics } from '@ohos.arkui.node'; + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1100 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]; + @State focusRecord: number[] = []; + + build() { + Column({ space: 10 }) { + Scroll() { + Row({ space: 10 }) { + ForEach(this.arr, (item: number) => { + Row() { + Text('item_' + item) + .id(`${item}`) + .margin({ + bottom: 20 + }) + .width('80%') + .height(100) + .textAlign(TextAlign.Center) + .focusable(true) + .focusBox({ + margin: LengthMetrics.vp(4) + }) + .onFocus(() => { + this.focusRecord.push(item) + }) + .border({ + width: 2, + color: Color.Red + }) + }.width('100%') + .justifyContent(FlexAlign.Center) + }, (item: string) => item) + } + }.scrollable(ScrollDirection.Horizontal) + .height(500) + + Text(`focusRecord: ${this.focusRecord}`) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1110.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ebce8012811141a9b30ef1f293e27e654e65852 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1110.ets @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1110 { + normalIcon: Resource = $r("app.media.icon"); + selectedIcon: Resource = $r("app.media.icon"); + @State arr: number[] = [1, 2]; + @State current: number = 1; + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Button('上').onFocus(() => { + this.focusRecord.push('上'); + }) + Row({ space: 10 }) { + Button('左').onFocus(() => { + this.focusRecord.push('左'); + }) + + SideBarContainer(SideBarContainerType.Embed) { + Column() { + ForEach(this.arr, (item: number) => { + Column({ space: 5 }) { + Image(this.current === item ? this.selectedIcon : this.normalIcon).width(64).height(64) + Text("Index0" + item) + .fontSize(25) + .fontColor(this.current === item ? '#0A59F7' : '#999') + .fontFamily('source-sans-pro,cursive,sans-serif') + } + .onClick(() => { + this.current = item + }) + }, (item: string) => item) + }.width('100%') + .justifyContent(FlexAlign.SpaceEvenly) + .backgroundColor('#19000000') + } + .controlButton({ + icons: { + hidden: $r('app.media.icon'), + shown: $r('app.media.icon'), + switching: $r('app.media.icon') + } + }) + .sideBarWidth(150) + .minSideBarWidth(50) + .maxSideBarWidth(300) + .minContentWidth(0) + .onFocus(() => { + this.focusRecord.push('SideBarContainer'); + }) + .defaultFocus(true) + .border({ + width: 2, + color: Color.Red + }) + .divider({ strokeWidth: '1vp', color: Color.Gray, startMargin: '4vp', endMargin: '4vp' }) + + Button('右').onFocus(() => { + this.focusRecord.push('右'); + }) + }.width('70%').height('60%') + + Button('下').onFocus(() => { + this.focusRecord.push('下'); + }) + Text(`focusRecord: ${this.focusRecord}`) + }.width('80%').height('70%') + + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1120.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b4dbbd1678c6e25d0460226ca8681bdbddde4b0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1120.ets @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1120 { + @State fontColor: string = '#182431' + @State selectedFontColor: string = '#007DFF' + @State arr: number[] = [1, 2]; + @State currentIndex: number = 0; + @State focusRecord: string[] = []; + private tabsController: TabsController = new TabsController(); + + @Builder tabBuilder(index: number, name: string) { + Column() { + Text(name) + .fontColor(this.currentIndex === index ? this.selectedFontColor : this.fontColor) + .fontSize(16) + .fontWeight(this.currentIndex === index ? 500 : 400) + .lineHeight(22) + .margin({ top: 17, bottom: 7 }) + Divider() + .strokeWidth(2) + .color('#007DFF') + .opacity(this.currentIndex === index ? 1 : 0) + }.width('40%').height(300) + } + + build() { + Column({ space: 10 }) { + Button('上').onFocus(() => { + this.focusRecord.push('上'); + }) + Row({ space: 10 }) { + Button('左').onFocus(() => { + this.focusRecord.push('左'); + }) + + Tabs({ barPosition: BarPosition.Start, controller: this.tabsController }) { + ForEach(this.arr, (index: number) =>{ + TabContent().tabBar(this.tabBuilder(index, '页签 ' + this.arr[index - 1])) + }) + } + .onTabBarClick((index: number) => { + this.currentIndex = index + }) + .barMode(BarMode.Scrollable) + .backgroundColor('#F1F3F5') + .height(300) + .width('100%') + .onFocus(() => { + this.focusRecord.push('Tabs'); + }) + .defaultFocus(true) + .border({ + width: 2, + color: Color.Red + }) + + Button('右').onFocus(() => { + this.focusRecord.push('右'); + }) + }.width('70%') + + Button('下').onFocus(() => { + this.focusRecord.push('下'); + }) + Text(`focusRecord: ${this.focusRecord}`) + }.width('80%').height('70%') + + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1130.ets new file mode 100644 index 0000000000000000000000000000000000000000..32acb0c99c94c6812169db50c93ca26388ca02f3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1130.ets @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1130 { + @State isMilitaryTime: boolean = false + private selectedTime: Date = new Date('2022-07-22T08:00:00') + + build() { + Column() { + Button('切换12小时制/24小时制') + .margin(30) + .onClick(() => { + this.isMilitaryTime = !this.isMilitaryTime + }) + TimePicker({ + selected: this.selectedTime, + }) + .useMilitaryTime(this.isMilitaryTime) + .onChange((value: TimePickerResult) => { + if(value.hour >= 0) { + this.selectedTime.setHours(value.hour, value.minute) + console.info('select current date is: ' + JSON.stringify(value)) + } + }) + .disappearTextStyle({color: Color.Red, font: {size: 15, weight: FontWeight.Lighter}}) + .textStyle({color: Color.Black, font: {size: 20, weight: FontWeight.Normal}}) + .selectedTextStyle({color: Color.Blue, font: {size: 30, weight: FontWeight.Bolder}}) + }.width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1140.ets new file mode 100644 index 0000000000000000000000000000000000000000..a1ca6402c592d976e60aa5d2ff72e85ab579a155 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1140.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1140 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + @State dataSource: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + ForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item) + .fontSize(12) + .width('100%') + .height('100%') + .focusable(true) + .textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + Image('res/waterFlowTest(' + item % 5 + ').jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .onAppear(() => { + + }) + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(300) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + + Button('增加item').onClick(() => { + this.dataSource.shift() + }).id('ActionEventCommoneventFocuseventInteraction1140_001') + }.width('80%').height('70%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1150.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d7e6bebc0f5bc9fd78a0a765c6de9b659e1daf5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1150.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1150 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + @State dataSource: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + ForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item) + .fontSize(12) + .width('100%') + .height('100%') + .focusable(true) + .textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + Image('res/waterFlowTest(' + item % 5 + ').jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .onAppear(() => { + + }) + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(300) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + + Button('增加item').onClick(() => { + this.dataSource.unshift(0) + }).id('ActionEventCommoneventFocuseventInteraction1150_001') + }.width('80%').height('70%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1160.ets new file mode 100644 index 0000000000000000000000000000000000000000..4be87e28b1280d32c93012bb103aff6036db27f9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1160.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { WaterFlowDataSource } from './WaterFlowDataSource' +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1160 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + dataSource: WaterFlowDataSource = new WaterFlowDataSource() + private itemWidthArray: number[] = []; + private itemHeightArray: number[] = []; + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%').focusable(true).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + Image('res/waterFlowTest(' + item % 5 + ').jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .onAppear(() => { + + }) + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(300) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + Text(`focusRecord: ${this.focusRecord}`) + Button('减少item').onClick(() => { + this.dataSource.deleteLastItem() + }).id('ActionEventCommoneventFocuseventInteraction1160_001') + }.width('80%').height('70%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1170.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f49d7db786d7f6084bf1f4add2595632c8c39a0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1170.ets @@ -0,0 +1,197 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class Interaction_1170 implements IDataSource { + private dataArray: number[] = []; + private listeners: DataChangeListener[] = []; + + constructor() { + for (let i = 0; i < 10; i++) { + this.dataArray.push(i); + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index]; + } + + // 通知控制器数据重新加载 + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + // 通知控制器数据增加 + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + // 通知控制器数据变化 + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + // 通知控制器数据删除 + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + // 通知控制器数据位置变化 + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length; + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener); + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener) + if (pos >= 0) { + this.listeners.splice(pos, 1); + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length); + this.notifyDataAdd(0); + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); + this.notifyDataAdd(this.dataArray.length - 1); + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length); + this.notifyDataAdd(index); + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1); + this.notifyDataDelete(0); + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1); + this.notifyDataDelete(1); + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1); + this.notifyDataDelete(this.dataArray.length); + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1); + this.dataArray.splice(3, 2); + this.notifyDataReload(); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1170 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + dataSource: Interaction_1170 = new Interaction_1170(); + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%').focusable(true).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + Image('res/waterFlowTest1.jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .onReachEnd(() => { + for (let i = this.dataSource.totalCount() + 1; i < 100; i++) { + this.dataSource.addLastItem() + } + }) + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(300) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + Text(`focusRecord: ${this.focusRecord}`) + }.width('80%').height('70%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1180.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c57aaaf2bf4dcb7f8eedf71c9c0a56296a7b9cb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1180.ets @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class Interaction_1180 implements IDataSource { + private dataArray: number[] = []; + private listeners: DataChangeListener[] = []; + + constructor() { + for (let i = 0; i < 9; i++) { + this.dataArray.push(i); + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index]; + } + + // 通知控制器数据重新加载 + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + // 通知控制器数据增加 + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + // 通知控制器数据变化 + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + // 通知控制器数据删除 + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + // 通知控制器数据位置变化 + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length; + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener); + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + this.listeners.splice(pos, 1); + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length); + this.notifyDataAdd(0); + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); + this.notifyDataAdd(this.dataArray.length - 1); + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length); + this.notifyDataAdd(index); + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1); + this.notifyDataDelete(0); + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1); + this.notifyDataDelete(1); + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1); + this.notifyDataDelete(this.dataArray.length); + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1); + this.dataArray.splice(3, 2); + this.notifyDataReload(); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1180 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + dataSource: Interaction_1180 = new Interaction_1180(); + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%') + .focusable(item !== 4 ? true : false).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + .defaultFocus(item === 1 ? true : false) + Image('res/waterFlowTest1.jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(320) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + Text(`focusRecord: ${this.focusRecord}`) + }.width('80%').height('70%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1190.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e7574e4827c90b3ee595dc6e5f6821e52335c5a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1190.ets @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class Interaction_1190 implements IDataSource { + private dataArray: number[] = []; + private listeners: DataChangeListener[] = []; + + constructor() { + for (let i = 0; i < 9; i++) { + this.dataArray.push(i); + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index]; + } + + // 通知控制器数据重新加载 + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + // 通知控制器数据增加 + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + // 通知控制器数据变化 + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + // 通知控制器数据删除 + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + // 通知控制器数据位置变化 + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length; + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener); + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + this.listeners.splice(pos, 1); + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length); + this.notifyDataAdd(0); + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); + this.notifyDataAdd(this.dataArray.length - 1); + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length); + this.notifyDataAdd(index); + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1); + this.notifyDataDelete(0); + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1); + this.notifyDataDelete(1); + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1); + this.notifyDataDelete(this.dataArray.length); + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1); + this.dataArray.splice(3, 2); + this.notifyDataReload(); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1190 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + dataSource: Interaction_1190 = new Interaction_1190(); + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%') + .focusable(item !== 4 ? true : false).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + .defaultFocus(item === 7 ? true : false) + Image('res/waterFlowTest1.jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(320) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + Text(`focusRecord: ${this.focusRecord}`) + }.width('80%').height('70%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1200.ets new file mode 100644 index 0000000000000000000000000000000000000000..80fcfa40ca5008cba15df7fba91701c1bcae208a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1200.ets @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class Interaction_1200 implements IDataSource { + private dataArray: number[] = []; + private listeners: DataChangeListener[] = []; + + constructor() { + for (let i = 0; i < 9; i++) { + this.dataArray.push(i); + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index]; + } + + // 通知控制器数据重新加载 + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + // 通知控制器数据增加 + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + // 通知控制器数据变化 + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + // 通知控制器数据删除 + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + // 通知控制器数据位置变化 + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length; + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener); + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + this.listeners.splice(pos, 1); + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length); + this.notifyDataAdd(0); + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); + this.notifyDataAdd(this.dataArray.length - 1); + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length); + this.notifyDataAdd(index); + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1); + this.notifyDataDelete(0); + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1); + this.notifyDataDelete(1); + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1); + this.notifyDataDelete(this.dataArray.length); + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1); + this.dataArray.splice(3, 2); + this.notifyDataReload(); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1200 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + dataSource: Interaction_1200 = new Interaction_1200(); + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%') + .focusable(item !== 4 ? true : false).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + .defaultFocus(item === 5 ? true : false) + Image('res/waterFlowTest1.jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(320) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + Text(`focusRecord: ${this.focusRecord}`) + }.width('80%').height('70%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1210.ets new file mode 100644 index 0000000000000000000000000000000000000000..61566327b99cb5785b81ffcf70e079baee36cac3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1210.ets @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class Interaction_1210 implements IDataSource { + private dataArray: number[] = []; + private listeners: DataChangeListener[] = []; + + constructor() { + for (let i = 0; i < 9; i++) { + this.dataArray.push(i); + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index]; + } + + // 通知控制器数据重新加载 + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + // 通知控制器数据增加 + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + // 通知控制器数据变化 + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + // 通知控制器数据删除 + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + // 通知控制器数据位置变化 + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length; + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener); + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + this.listeners.splice(pos, 1); + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length); + this.notifyDataAdd(0); + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); + this.notifyDataAdd(this.dataArray.length - 1); + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length); + this.notifyDataAdd(index); + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1); + this.notifyDataDelete(0); + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1); + this.notifyDataDelete(1); + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1); + this.notifyDataDelete(this.dataArray.length); + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1); + this.dataArray.splice(3, 2); + this.notifyDataReload(); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1210 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + dataSource: Interaction_1210 = new Interaction_1210(); + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%') + .focusable(item !== 4 ? true : false).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + .defaultFocus(item === 3 ? true : false) + Image('res/waterFlowTest1.jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(320) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + Text(`focusRecord: ${this.focusRecord}`) + }.width('80%').height('70%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1220.ets new file mode 100644 index 0000000000000000000000000000000000000000..fe314ed331d807c0fd7bf187829f32b87cb8128f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1220.ets @@ -0,0 +1,212 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class Interaction_1220 implements IDataSource { + private dataArray: number[] = []; + private listeners: DataChangeListener[] = []; + + constructor() { + for (let i = 0; i < 16; i++) { + this.dataArray.push(i); + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index]; + } + + // 通知控制器数据重新加载 + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + // 通知控制器数据增加 + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + // 通知控制器数据变化 + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + // 通知控制器数据删除 + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + // 通知控制器数据位置变化 + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length; + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener); + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + this.listeners.splice(pos, 1); + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length); + this.notifyDataAdd(0); + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); + this.notifyDataAdd(this.dataArray.length - 1); + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length); + this.notifyDataAdd(index); + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1); + this.notifyDataDelete(0); + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1); + this.notifyDataDelete(1); + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1); + this.notifyDataDelete(this.dataArray.length); + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1); + this.dataArray.splice(3, 2); + this.notifyDataReload(); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1220 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + dataSource: Interaction_1220 = new Interaction_1220(); + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Button('上').onFocus(() => { + this.focusRecord.push('上'); + }) + Row({ space: 10 }) { + Button('左').onFocus(() => { + this.focusRecord.push('左'); + }) + WaterFlow() { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%') + .focusable(true).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + .id(item + '') + .defaultFocus(item === 3 ? true : false) + Image('res/waterFlowTest1.jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(420) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + Button('右').onFocus(() => { + this.focusRecord.push('右'); + }) + }.width('70%') + Button('下').onFocus(() => { + this.focusRecord.push('下'); + }) + Text(`focusRecord: ${this.focusRecord}`) + Row({space: 10}) { + Button('获焦_15').onClick(() => { + this.getUIContext().getFocusController().requestFocus('15') + }).id('FocuseventInteraction_001') + } + }.width('80%').height('70%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1230.ets new file mode 100644 index 0000000000000000000000000000000000000000..bdc3184d5181e6c736824c1a575389f4985ca6a7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1230.ets @@ -0,0 +1,195 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class Interaction_1230 implements IDataSource { + private dataArray: number[] = []; + private listeners: DataChangeListener[] = []; + + constructor() { + for (let i = 0; i < 16; i++) { + this.dataArray.push(i); + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index]; + } + + // 通知控制器数据重新加载 + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + // 通知控制器数据增加 + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + // 通知控制器数据变化 + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + // 通知控制器数据删除 + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + // 通知控制器数据位置变化 + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length; + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener); + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + this.listeners.splice(pos, 1); + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length); + this.notifyDataAdd(0); + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); + this.notifyDataAdd(this.dataArray.length - 1); + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length); + this.notifyDataAdd(index); + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1); + this.notifyDataDelete(0); + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1); + this.notifyDataDelete(1); + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1); + this.notifyDataDelete(this.dataArray.length); + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1); + this.dataArray.splice(3, 2); + this.notifyDataReload(); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1230 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + dataSource: Interaction_1230 = new Interaction_1230(); + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%') + .focusable(item !== 1 && item !== 2 ? true : false).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + .id(item + '') + .defaultFocus(item === 0 ? true : false) + Image('res/waterFlowTest1.jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(420) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + Text(`focusRecord: ${this.focusRecord}`) + }.width('80%').height('70%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1240.ets new file mode 100644 index 0000000000000000000000000000000000000000..d0127ab77fd5555d4ae018fcb0d0b4e5b67649b5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1240.ets @@ -0,0 +1,198 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class Interaction_1240 implements IDataSource { + private dataArray: number[] = []; + private listeners: DataChangeListener[] = []; + + constructor() { + for (let i = 0; i < 16; i++) { + this.dataArray.push(i); + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index]; + } + + // 通知控制器数据重新加载 + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + // 通知控制器数据增加 + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + // 通知控制器数据变化 + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + // 通知控制器数据删除 + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + // 通知控制器数据位置变化 + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length; + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener); + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + this.listeners.splice(pos, 1); + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length); + this.notifyDataAdd(0); + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); + this.notifyDataAdd(this.dataArray.length - 1); + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length); + this.notifyDataAdd(index); + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1); + this.notifyDataDelete(0); + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1); + this.notifyDataDelete(1); + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1); + this.notifyDataDelete(this.dataArray.length); + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1); + this.dataArray.splice(3, 2); + this.notifyDataReload(); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1240 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + dataSource: Interaction_1240 = new Interaction_1240(); + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%') + .focusable(item !== 1 && item !== 2 ? true : false).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + .id(item + '') + .defaultFocus(item === 0 ? true : false) + Image('res/waterFlowTest1.jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(420) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + Text(`focusRecord: ${this.focusRecord}`) + Button('获焦_12').onClick((event: ClickEvent) => { + this.getUIContext().getFocusController().requestFocus('12'); + }).id('FocuseventInteraction_001') + }.width('80%').height('70%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1250.ets new file mode 100644 index 0000000000000000000000000000000000000000..01f0a0ce32be9f516613421fbe63129aa9007d5d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1250.ets @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction1250_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction1250_DataSource extends FocuseventInteraction1250_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1250 { + @State arr: FocuseventInteraction1250_DataSource = new FocuseventInteraction1250_DataSource(); + @State focusRecord: number[] = []; + @State focusableValue: boolean = true + + aboutToAppear(): void { + for (let i = 1; i <= 3; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + scroller: Scroller = new Scroller() + + build() { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.arr, (item: number) => { + FlowItem() { + Button('item_' + item) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .focusable(item == 5 ? false : true) + }.id('ActionEventCommoneventFocuseventInteraction1250_'+item) + }, (item: string) => item) + } + + .onDragStart(()=>{ + this.arr.pushData('21') + }) + .margin({ top: 10, left: 20 }) + + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1260.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1260.ets new file mode 100644 index 0000000000000000000000000000000000000000..9158d05e3ee53930b795e92f6d78011f8db3d3f5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1260.ets @@ -0,0 +1,141 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class FocuseventInteraction1260_BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + private originDataArray: string[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): string { + return this.originDataArray[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class FocuseventInteraction1260_DataSource extends FocuseventInteraction1260_BasicDataSource { + private dataArray: string[] = []; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): string { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public deleteData(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1260 { + @State arr: FocuseventInteraction1260_DataSource = new FocuseventInteraction1260_DataSource(); + @State focusRecord: number[] = []; + @State focusableValue: boolean = true + + aboutToAppear(): void { + for (let i = 1; i <= 3; i++) { + let j = i + ''; + this.arr.pushData(`${j}`) + } + } + + scroller: Scroller = new Scroller() + + build() { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.arr, (item: number) => { + FlowItem() { + Button('item_' + item) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + .focusable(item == 5 ? false : true) + }.id('ActionEventCommoneventFocuseventInteraction1260_'+item) + }, (item: string) => item) + } + + .onDragStart(()=>{ + this.arr.pushData('21') + }) + .margin({ top: 10, left: 20 }) + + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1270.ets new file mode 100644 index 0000000000000000000000000000000000000000..83765350ee57dc050913abfd192e223cc571c80f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1270.ets @@ -0,0 +1,195 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +class Interaction_1270 implements IDataSource { + private dataArray: number[] = []; + private listeners: DataChangeListener[] = []; + + constructor() { + for (let i = 0; i < 15; i++) { + this.dataArray.push(i); + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index]; + } + + // 通知控制器数据重新加载 + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + // 通知控制器数据增加 + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + // 通知控制器数据变化 + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + // 通知控制器数据删除 + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + // 通知控制器数据位置变化 + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length; + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener); + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + this.listeners.splice(pos, 1); + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length); + this.notifyDataAdd(0); + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length); + this.notifyDataAdd(this.dataArray.length - 1); + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length); + this.notifyDataAdd(index); + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1); + this.notifyDataDelete(0); + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1); + this.notifyDataDelete(1); + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1); + this.notifyDataDelete(this.dataArray.length); + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1); + this.notifyDataDelete(index); + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1); + this.dataArray.splice(3, 2); + this.notifyDataReload(); + } +} + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1270 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + dataSource: Interaction_1270 = new Interaction_1270(); + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + LazyForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%') + .focusable(item !== 1 && item !== 2 ? true : false).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + .id(item + '') + .defaultFocus(item === 11 ? true : false) + Image('res/waterFlowTest1.jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(420) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + Text(`focusRecord: ${this.focusRecord}`) + }.width('80%').height('70%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1280.ets new file mode 100644 index 0000000000000000000000000000000000000000..adc5eef392d45e5244bf116d164b420bd3295dbb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1280.ets @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1280 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + @State dataSource: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + ForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item) + .fontSize(12) + .width('100%') + .height('100%') + .focusable(true) + .textAlign(TextAlign.Center) + .id('1') + .onFocus(() => { + this.focusRecord.push(item + '') + }) + Image('res/waterFlowTest(' + item % 5 + ').jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .onAppear(() => { + + }) + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(300) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + .onScrollFrameBegin((offset: number, state: ScrollState) => { + console.info('waterFlow scrollFrameBegin offset: ' + offset + ' state: ' + state.toString()) + return { offsetRemain: offset } + }) + }.width('70%') + }.width('80%').height('70%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1290.ets new file mode 100644 index 0000000000000000000000000000000000000000..a9795f12222944b34ac10fcfa4bf6e76b42cb8df --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1290.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1290 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + @State dataSource :number[] = [1, 2]; + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Row({ space: 10 }) { + WaterFlow() { + ForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item).fontSize(12).width('100%').height('100%').focusable(true).textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + Image('res/waterFlowTest(' + item % 5 + ').jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .onAppear(() => { + + }) + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(300) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + Text(`focusRecord: ${this.focusRecord}`) + }.width('80%').height('70%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1300.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5c71100c9bf3ed15eb4eb98ad7bbb5502f9dc9c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1300.ets @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1300 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + @State dataSource: number[] = [1, 2]; + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Text(`focusRecord: ${this.focusRecord}`) + Row({ space: 10 }) { + + WaterFlow() { + ForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item) + .fontSize(12) + .width('100%') + .height('100%') + .focusable(true) + .textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + Image('res/waterFlowTest(' + item % 5 + ').jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .onAppear(() => { + + }) + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(300) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + }.width('80%').height('70%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1310.ets new file mode 100644 index 0000000000000000000000000000000000000000..014799cacf20ef070543da0da8b6d30fc0767967 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1310.ets @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1310 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + @State dataSource: number[] = [1, 2]; + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Text(`focusRecord: ${this.focusRecord}`) + Row({ space: 10 }) { + + WaterFlow() { + ForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item) + .fontSize(12) + .width('100%') + .height('100%') + .focusable(true) + .textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + Image('res/waterFlowTest(' + item % 5 + ').jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .onAppear(() => { + + }) + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(300) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + }.width('80%').height('70%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1380.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1380.ets new file mode 100644 index 0000000000000000000000000000000000000000..0a466e317aed379fb0127bc155faef3ed3bef682 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1380.ets @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1380 { + @State numbers: String[] = ['0', '1', '2', '3', '4'] + scroller: Scroller = new Scroller() + @State gridPosition: number = 0 //0代表滚动到grid顶部,1代表中间值,2代表滚动到grid底部。 + + build() { + Column({ space: 5 }) { + Text('scroll').fontColor(0xCCCCCC).fontSize(9).width('90%') + Grid(this.scroller) { + ForEach(this.numbers, (day: string) => { + ForEach(this.numbers, (day: string) => { + GridItem() { + Button(day) + .fontSize(16) + .backgroundColor(0xF9CF93) + .width('100%') + .height(80) + }.focusable(true) + }, (day: string) => day) + }, (day: string) => day) + }.focusable(true) + .columnsTemplate('1fr 1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .friction(0.6) + .enableScrollInteraction(true) + .supportAnimation(false) + .multiSelectable(false) + .edgeEffect(EdgeEffect.Spring) + .scrollBar(BarState.On) + .scrollBarColor(Color.Grey) + .scrollBarWidth(4) + .width('90%') + .backgroundColor(0xFAEEE0) + .height(300) + .onScrollIndex((first: number, last: number) => { + console.info(first.toString()) + console.info(last.toString()) + }) + .onScrollBarUpdate((index: number, offset: number) => { + console.info("XXX" + 'Grid onScrollBarUpdate,index : ' + index.toString() + ",offset" + offset.toString()) + return { totalOffset: (index / 5) * (80 + 10) - offset, totalLength: 80 * 5 + 10 * 4 } + }) //只适用于当前示例代码数据源,如果数据源有变化,则需要修改该部分代码,或者删掉此属性 + .onDidScroll((scrollOffset: number, scrollState: ScrollState) => { + console.info(scrollOffset.toString()) + console.info(scrollState.toString()) + }) + .onScrollStart(() => { + console.info("XXX" + "Grid onScrollStart") + }) + .onScrollStop(() => { + console.info("XXX" + "Grid onScrollStop") + }) + .onReachStart(() => { + this.gridPosition = 0 + console.info("XXX" + "Grid onReachStart") + }) + .onReachEnd(() => { + this.gridPosition = 2 + console.info("XXX" + "Grid onReachEnd") + }) + Button('next page') + .onClick(() => { + this.scroller.scrollPage({ next: true }) + }).id('ActionEventCommoneventFocuseventInteraction1380_001') + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1390.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1390.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d0e89b53fc06149ef570c9b87499fd172ada9dc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1390.ets @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1390 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + private listScroller: ListScroller = new ListScroller(); + @State flag: boolean = false; + + build() { + Column() { + List({ space: 10, scroller: this.listScroller }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Button('item_' + item) + .width('100%') + .height(100) + .backgroundColor(Color.Blue) + } + }, (item: string) => item) + } + .padding(10) + .backgroundColor(Color.Yellow) + .height(500) + .scrollSnapAlign(this.flag ? ScrollSnapAlign.CENTER : ScrollSnapAlign.START) + + Row({ space: 20 }) { + Button('下一页').onClick((event: ClickEvent) => { + this.listScroller.scrollBy(0, 100) + }).id('ActionEventCommoneventFocuseventInteraction1390_001') + Button('指定位置1').onClick((event: ClickEvent) => { + this.listScroller.scrollToIndex(0) + }).id('ActionEventCommoneventFocuseventInteraction1390_002') + }.height('50%') + } + .backgroundColor(0xDCDCDC) + .width('100%') + .height('100%') + } +} + + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1400.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1400.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec6782f2bf1c405234cfd2504ffabeb188e2658b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1400.ets @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1400 { + scroller: Scroller = new Scroller() + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Column() { + ForEach(this.arr, (item: number) => { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }, (item: string) => item) + }.width('100%') + .height(500) + } + .scrollable(ScrollDirection.Vertical) // 滚动方向纵向 + .scrollBar(BarState.On) // 滚动条常驻显示 + .scrollBarColor(Color.Gray) // 滚动条颜色 + + .scrollBarWidth(10) // 滚动条宽度 + .friction(0.6) + .edgeEffect(EdgeEffect.None) + .onWillScroll((xOffset: number, yOffset: number, scrollState: ScrollState) => { + console.info(xOffset + ' ' + yOffset) + }) + .onScrollEdge((side: Edge) => { + console.info('To the edge') + }) + .onScrollStop(() => { + console.info('Scroll Stop') + }) + }.width('80%').height('80%').backgroundColor(0xDCDCDC) + + Button('scroll 150') + .height('5%') + .onClick(() => { // 点击后下滑指定距离150.0vp + this.scroller.scrollBy(0, 150) + }).id('ActionEventCommoneventFocuseventInteraction1400_001') + Button('指定位置1').onClick((event: ClickEvent) => { + this.scroller.scrollToIndex(0) + }).id('ActionEventCommoneventFocuseventInteraction1400_002') + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1410.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1410.ets new file mode 100644 index 0000000000000000000000000000000000000000..672de9fd195768d07cb9ad3497ba6d0461ae7829 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1410.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1410 { + scroller: Scroller = new Scroller() + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Column() { + Flex({ direction: FlexDirection.Column }) { + ForEach(this.arr, (item: number) => { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }, (item: string) => item) + }.width('100%') + .height(500) + } + } + .scrollable(ScrollDirection.Vertical) // 滚动方向纵向 + .scrollBar(BarState.On) // 滚动条常驻显示 + .scrollBarColor(Color.Gray) // 滚动条颜色 + + .scrollBarWidth(10) // 滚动条宽度 + .friction(0.6) + .edgeEffect(EdgeEffect.None) + .onWillScroll((xOffset: number, yOffset: number, scrollState: ScrollState) => { + console.info(xOffset + ' ' + yOffset) + }) + .onScrollEdge((side: Edge) => { + console.info('To the edge') + }) + .onScrollStop(() => { + console.info('Scroll Stop') + }) + }.width('80%').height('50%').backgroundColor(0xDCDCDC) + + Button('scroll 150') + .height('5%') + .onClick(() => { + this.scroller.scrollBy(0, 150) + }).id('ActionEventCommoneventFocuseventInteraction1410_001') + + Button('指定位置1').onClick((event: ClickEvent) => { + this.scroller.scrollToIndex(0) + }).id('ActionEventCommoneventFocuseventInteraction1410_002') + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1420.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1420.ets new file mode 100644 index 0000000000000000000000000000000000000000..224a8e76b92dca6118e7a0f327c6c8746d27c4a7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1420.ets @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1420 { + scroller: Scroller = new Scroller() + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Row() { + ForEach(this.arr, (item: number) => { + Button(item.toString()) + .width('90%') + .height(150) + .backgroundColor(Color.Blue) + .borderRadius(15) + .fontSize(16) + .margin({ top: 10 }) + }, (item: string) => item) + } + } + .scrollable(ScrollDirection.Horizontal) // 滚动方向纵向 + .scrollBar(BarState.On) // 滚动条常驻显示 + .scrollBarColor(Color.Gray) // 滚动条颜色 + + + Button('scroll 150') + .height('5%') + .onClick(() => { + this.scroller.scrollBy(150, 0) + }).id('ActionEventCommoneventFocuseventInteraction1420_001') + .margin({ top: 10, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1430.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1430.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c0eb0deeff68d8539e4bd546ef5f6b93f5c169c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1430.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ActionEventCommoneventFocuseventInteraction1430 { + @State minSize: number = 80; + @State maxSize: number = 80; + @State fontSize: number = 24; + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F]; + scroller: Scroller = new Scroller(); + @State dataSource: number[] = [1, 2, 3, 4, 5, 6, 7]; + @State focusRecord: string[] = []; + + build() { + Column({ space: 10 }) { + Text(`focusRecord: ${this.focusRecord}`) + Row({ space: 10 }) { + + WaterFlow() { + ForEach(this.dataSource, (item: number) => { + FlowItem() { + Stack() { + Text("N" + item) + .fontSize(12) + .width('100%') + .height('100%') + .focusable(true) + .id('ActionEventCommoneventFocuseventInteraction1430_' + item) + .textAlign(TextAlign.Center) + .onFocus(() => { + this.focusRecord.push(item + '') + }) + Image('res/waterFlowTest(' + item % 5 + ').jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .onAppear(() => { + + }) + .width('100%') + .height(100) + .backgroundColor(this.colors[item % 5]) + }, (item: string) => item) + } + .columnsTemplate("1fr 1fr 1fr") + .columnsGap(10) + .rowsGap(5) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .height(300) + .width('100%') + .border({ + width: 2, + color: Color.Red + }) + }.width('70%') + }.width('80%').height('70%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/WaterFlowDataSource.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/WaterFlowDataSource.ets new file mode 100644 index 0000000000000000000000000000000000000000..7d9ef2b1c97b1e923f4f09fcc7927ece3cff5080 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/ActionEventCommoneventFocuseventInteraction/WaterFlowDataSource.ets @@ -0,0 +1,129 @@ +// WaterFlowDataSource.ets + +// 实现IDataSource接口的对象,用于瀑布流组件加载数据 +export class WaterFlowDataSource implements IDataSource { + private dataArray: number[] = [] + private listeners: DataChangeListener[] = [] + + constructor() { + for (let i = 0; i < 4; i++) { + this.dataArray.push(i) + } + } + + // 获取索引对应的数据 + public getData(index: number): number { + return this.dataArray[index] + } + + // 通知控制器数据重新加载 + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded() + }) + } + + // 通知控制器数据增加 + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index) + }) + } + + // 通知控制器数据变化 + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index) + }) + } + + // 通知控制器数据删除 + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index) + }) + } + + // 通知控制器数据位置变化 + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to) + }) + } + + //通知控制器数据批量修改 + notifyDatasetChange(operations: DataOperation[]): void { + this.listeners.forEach(listener => { + listener.onDatasetChange(operations); + }) + } + + // 获取数据总数 + public totalCount(): number { + return this.dataArray.length + } + + // 注册改变数据的控制器 + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + this.listeners.push(listener) + } + } + + // 注销改变数据的控制器 + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener) + if (pos >= 0) { + this.listeners.splice(pos, 1) + } + } + + // 增加数据 + public add1stItem(): void { + this.dataArray.splice(0, 0, this.dataArray.length) + this.notifyDataAdd(0) + } + + // 在数据尾部增加一个元素 + public addLastItem(): void { + this.dataArray.splice(this.dataArray.length, 0, this.dataArray.length) + this.notifyDataAdd(this.dataArray.length - 1) + } + + // 在指定索引位置增加一个元素 + public addItem(index: number): void { + this.dataArray.splice(index, 0, this.dataArray.length) + this.notifyDataAdd(index) + } + + // 删除第一个元素 + public delete1stItem(): void { + this.dataArray.splice(0, 1) + this.notifyDataDelete(0) + } + + // 删除第二个元素 + public delete2ndItem(): void { + this.dataArray.splice(1, 1) + this.notifyDataDelete(1) + } + + // 删除最后一个元素 + public deleteLastItem(): void { + this.dataArray.splice(-1, 1) + this.notifyDataDelete(this.dataArray.length) + } + + // 在指定索引位置删除一个元素 + public deleteItem(index: number): void { + this.dataArray.splice(index, 1) + this.notifyDataDelete(index) + } + + // 重新加载数据 + public reload(): void { + this.dataArray.splice(1, 1) + this.dataArray.splice(3, 2) + this.notifyDataReload() + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/Index.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0e4b0390777d039b0993caeeff4c0deab3384c57 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/Index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0010.ets new file mode 100644 index 0000000000000000000000000000000000000000..35ede6e303613e67d750fdf91d95d84fa2c4a2d8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0010.ets @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterAction0010 { + build() { + Column({ space: 20 }) { + Button("你好").tabIndex(0) + Button("你好呀").tabIndex(0) + Button("你好哈").tabIndex(0) + }.tabIndex(0) + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..40e256906ac17d1302b7316992a01c3939eccc20 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0020.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterAction0020 { + @State str: string = 'aa' + @State str1: string = '' + controller: TextInputController = new TextInputController() + + fun() { + if (typeof this.str == 'number') { + return this.str + } else { + this.str1 = "error" + return 0 + } + } + + build() { + Column({ space: 10 }) { + TextInput({ placeholder: 'input ...', controller: this.controller }) + .width(380) + .height(60) + .tabIndex(this.fun()) + Text(this.str1).width(50) + }.width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..9f86336ec889053530843518a9c68b0026bf3925 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0030.ets @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterAction0030 { + build() { + Column({ space: 20 }) { + Button("你好").tabIndex(2) + Button("你好呀").tabIndex(0) + Button("你好哈").tabIndex(3) + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ee1ebedf692540362eda25acde5b8d78ee06d29 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0040.ets @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterAction0040 { + build() { + Column({ space: 20 }) { + Button("你好").tabIndex(-1) + + Column({ space: 20 }) { + Button("你好啊").tabIndex(1) + + } + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..6247fa19a3c361fb476f3d7a393647b4afa11025 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0050.ets @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterAction0050 { + build() { + Column({ space: 20 }) { + Button("tabIndex(2)").tabIndex(2) + Column({ space: 20 }) { + Button("tabIndex(1)").tabIndex(1) + } + Column({ space: 20 }) { + Button("未设置") + } + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0010.ets new file mode 100644 index 0000000000000000000000000000000000000000..8d2ba26e836177168bfd49bcf906c9d9644b07e7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0010.ets @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0010 { + @State fontColor: string = '#182431' + @State selectedFontColor: string = '#007DFF' + @State currentIndex: number = 0 + @State selectedIndex: number = 0 + private controller: TabsController = new TabsController() + private iconStr: ResourceStr = $r("app.media.icon"); + + @Builder + tabBuilder(index: number, name: string) { + + } + + build() { + Column({ space: 20 }) { + Button("Focus-btn4") + .width(200) + .height(70) + .defaultFocus(false) + .fontColor(Color.White) + Column({ space: 20 }) { + Image(this.iconStr) + .width(200) + .defaultFocus(false) + .height(70) + } + + Column({ space: 20 }) { + Row({ space: 5 }) { + Tabs({ barPosition: BarPosition.Start, index: this.currentIndex, controller: this.controller }) { + TabContent() { + Column().width('100%').height('50%').backgroundColor('#00CB87') + }.tabBar(this.tabBuilder(0, 'green')) + + TabContent() { + Column().width('100%').height('50%').backgroundColor('#007DFF') + }.tabBar(this.tabBuilder(1, 'blue')).id('focus') + + }.defaultFocus(false) + } + }.width('100%') + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e6f17a8c1e770e8070c0331b51ed38b5ff4db94 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0020.ets @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0020 { + build() { + Column({ space: 20 }) { + Button("DefaultFocus(true)").defaultFocus(true) + Column({ space: 20 }) { + Button("你好") + } + + Column({ space: 20 }) { + Button("你好啊") + } + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..02caf46af6e21509b44d0478b0b498f69e1ad163 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0030.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0030 { + @State str: string = 'aa' + @State strError: string = '' + + fun() { + if (typeof this.str == 'boolean') { + return this.str + } else { + this.strError = "error" + return true + } + } + + build() { + Column({ space: 20 }) { + Button("DefaultFocus(a)") + + .defaultFocus(this.fun()) + Text(this.strError) + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..45f6abda9ba100f719084037b825e84c33217880 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0050.ets @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0050 { + @State state: AnimationStatus = AnimationStatus.Initial + @State reverse: boolean = false + @State iterations: number = 1 + private iconStr: ResourceStr = $r("app.media.icon"); + + build() { + Column({ space: 10 }) { + ImageAnimator() + .images([ + { + src: $r('app.media.icon') + }, + { + src: $r('app.media.cat') + }, + ]) + .duration(2000) + .state(this.state) + .reverse(this.reverse) + .fillMode(FillMode.None) + .iterations(this.iterations) + .width(340) + .height(240) + .margin({ top: 100 }) + .focusable(true) + + Column({ space: 20 }) { + + Text("Focus") + .width(200) + .height(70) + .defaultFocus(false) + .fontColor(Color.White) + .focusable(true) + Image(this.iconStr) + .width(200) + .defaultFocus(false) + .height(70) + .focusable(true) + + }.width('100%') + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0060.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4d3bafbaf0df1ea6cef0e0c6f928613246a92af --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0060.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0060 { + @State str: string = 'aa' + @State str1: string = '' + controller: TextInputController = new TextInputController() + + fun() { + if (typeof this.str == 'boolean') { + return this.str + } else { + this.str1 = "error" + return true + } + } + + build() { + Column({ space: 10 }) { + TextInput({ placeholder: 'input ...', controller: this.controller }) + .width(380) + .height(60) + .focusable(this.fun()) + Text(this.str1).width(50) + }.width('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0080.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf55ba2f8b69a7ab7afaed6dc878dc8f4d894d6a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0080.ets @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0080 { + @State str: string = 'aa' + @State str1: string = '' + controller: TextInputController = new TextInputController() + + fun() { + if (typeof this.str == 'boolean') { + return this.str + } else { + this.str1 = "error" + return true + } + } + + build() { + Column({ space: 10 }) { + Button("Focus-btn4") + .width(200) + .height(70) + .fontColor(Color.White) + TextInput({ placeholder: 'input ...', controller: this.controller }) + .width(380) + .height(60) + .focusOnTouch(this.fun()) + Text(this.str1).width(50) + }.width('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0090.ets new file mode 100644 index 0000000000000000000000000000000000000000..2445af91e7eced8484b4a43b9529786c7be7306d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0090.ets @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0090 { + @State text: string = '' + controller: TextInputController = new TextInputController() + build() { + Column() { + Button("focusOnTouch true") + .id('UIAttributesFocuscontrolInterface0220_001') + .width(200) + .height(70) + .fontColor(Color.White) + .focusOnTouch(true) + + Button("3") + .focusOnTouch(false) + Button("focusOnTouch true") + .id('UIComponentCommonattrResult0030_001') + .width(200) + .height(70) + .fontColor(Color.White) + .focusOnTouch(true) + + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width('95%') + .height(40) + .margin(20) + .fontSize(14) + .id('focus') + .fontColor(Color.Black) + .focusOnTouch(false) + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0100.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1ac5df2fe10783fdfc0d1a2aaf28f929be1abad --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0100.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0100 { + @State str :string = 'aa' + @State str1 :string = '' + + controller: TextInputController = new TextInputController() + fun(){ + if(typeof this.str == 'boolean') + { + return this.str + }else { + this.str1 = "error" + return true + } + } + build() { + Column({ space: 10 }) { + TextInput({ placeholder: 'input ...', controller: this.controller }) + .width(380) + .height(60) + .groupDefaultFocus(this.fun()) + Text(this.str1).width(50) + }.width('100%') + } + +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0110.ets new file mode 100644 index 0000000000000000000000000000000000000000..8712bebec3347be2ea26b23831ccdfc52a2356ed --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0110.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0110 { + @State text: string = '' + controller: TextInputController = new TextInputController() + @State changeValue: string = '' + + build() { + Column({ space: 5 }) { + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width('95%') + .height(40) + .margin(20) + .fontSize(14) + .groupDefaultFocus(true) + .fontColor(Color.Black) + .groupDefaultFocus(true) + Button('one button ') + Search({ value: this.changeValue, placeholder: 'Type to search...', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .backgroundColor('#F5F5F5') + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .textFont({ size: 14, weight: 400 }) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0120.ets new file mode 100644 index 0000000000000000000000000000000000000000..ebd33c4482a06c7b8194102dda62979d549bd2c7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0120.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0120 { + @State fontColor: string = '#182431' + @State selectedFontColor: string = '#007DFF' + @State currentIndex: number = 0 + @State selectedIndex: number = 0 + private controller: TabsController = new TabsController() + private iconStr: ResourceStr = $r("app.media.icon"); + + @Builder + tabBuilder(index: number, name: string) { + } + build() { + Column({ space: 20 }) { + Button("Focus-btn4") + .width(200) + .height(70) + .fontColor(Color.White) + + Column({ space: 20 }) { + Image(this.iconStr) + .width(200) + .height(70) + .defaultFocus(true) + } + + Column({ space: 20 }) { + Row({ space: 5 }) { + Tabs({ barPosition: BarPosition.Start, index: this.currentIndex, controller: this.controller }) { + TabContent() { + Column().width('100%').height('50%').backgroundColor('#00CB87') + }.tabBar(this.tabBuilder(0, 'green')) + .defaultFocus(true) + + TabContent() { + Column().width('100%').height('50%').backgroundColor('#007DFF') + }.tabBar(this.tabBuilder(1, 'blue')).id('focus') + + }.defaultFocus(false) + } + }.width('100%') + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0140.ets new file mode 100644 index 0000000000000000000000000000000000000000..4927c31fc32f3bf1d1a9834a9018629f6512ab4a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0140.ets @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0140 { + @State text: string = '' + controller: TextInputController = new TextInputController() + @State changeValue: string = '' + + build() { + Column({ space: 5 }) { + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width('95%') + .height(40) + .margin(20) + .fontSize(14) + .groupDefaultFocus(true) + .fontColor(Color.Black) + Button('one button ') + Search({ value: this.changeValue, placeholder: 'Type to search...', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .backgroundColor('#F5F5F5') + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .textFont({ size: 14, weight: 400 }) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0150.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a80568f2c8c4d5c18b9f0595ff9c64e23f012bc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0150.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0150 { + @State text: string = '' + controller: TextInputController = new TextInputController() + @State changeValue: string = '' + build() { + Column({ space: 5 }) { + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width('95%') + .height(40) + .margin(20) + .fontSize(14) + .fontColor(Color.Black) + Button('one button ').groupDefaultFocus(true) + Search({ value: this.changeValue, placeholder: 'Type to search...', controller: this.controller }) + .searchButton('SEARCH') + .groupDefaultFocus(true) + .width('95%') + .height(40) + .backgroundColor('#F5F5F5') + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .textFont({ size: 14, weight: 400 }) + }.width('100%').margin({ top: 5 }) + .tabIndex(1) + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0160.ets new file mode 100644 index 0000000000000000000000000000000000000000..7bbe11eb71802af6988082fe04069b284db14275 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0160.ets @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0160 { + controller: TextInputController = new TextInputController() + + build() { + Column({ space: 20 }) { + Button("Focus") + .width(200) + .height(70) + .fontColor(Color.White) + TextInput({ placeholder: 'input ...', controller: this.controller }) + .width(380) + .height(60) + .tabIndex(1) + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0170.ets new file mode 100644 index 0000000000000000000000000000000000000000..fba0fbcd0cd4f092ab28f8b65e65a3f88743d3ec --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0170.ets @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0170 { + @State fontColor: string = '#182431' + @State selectedFontColor: string = '#007DFF' + @State currentIndex: number = 0 + @State selectedIndex: number = 0 + private controller: TabsController = new TabsController() + private iconStr: ResourceStr = $r("app.media.icon"); + + build() { + Column({ space: 20 }) { + Button("Focus") + .width(200) + .height(70) + .fontColor(Color.White) + + Column({ space: 20 }) { + Image(this.iconStr) + .width(200) + .height(70) + } + + Column({ space: 20 }) { + Text("第三个column").width(200) + }.width('100%') + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0190.ets new file mode 100644 index 0000000000000000000000000000000000000000..e56620d177b0cc1d45e507684e8dcd9c855f22bf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0190.ets @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0190 { + @State state: AnimationStatus = AnimationStatus.Initial + @State reverse: boolean = false + @State iterations: number = 1 + private iconStr: ResourceStr = $r("app.media.icon"); + + build() { + Column({ space: 10 }) { + ImageAnimator() + .images([ + { + src: $r('app.media.icon') + }, + { + src: $r('app.media.cat') + }, + ]) + .duration(2000) + .state(this.state) + .reverse(this.reverse) + .fillMode(FillMode.None) + .iterations(this.iterations) + .width(340) + .height(240) + .margin({ top: 100 }) + + Column({ space: 20 }) { + + Text("Focus") + .width(200) + .height(70) + .defaultFocus(false) + .fontColor(Color.White) + Image(this.iconStr) + .width(200) + .defaultFocus(false) + .height(70) + + }.width('100%') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0220.ets new file mode 100644 index 0000000000000000000000000000000000000000..d394c9d5c9e3bbe1a45e132d2bdbb09c5c589646 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0220.ets @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0220 { + @State focusOnTouchValue: boolean = false + build() { + Column() { + + Button("focusOnTouch true") + .id('UIAttributesFocuscontrolInterface0220_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + this.focusOnTouchValue = true + }) + + Button("3") + .focusOnTouch(this.focusOnTouchValue) + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0230.ets new file mode 100644 index 0000000000000000000000000000000000000000..f72750a0b12fc4e661dbe9108f0216332adddd03 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0230.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0230 { + @State focusOnTouchValue: boolean = false + @State text: string = '' + controller: TextInputController = new TextInputController() + build() { + Column() { + + Button("focusOnTouch true") + .id('UIAttributesFocuscontrolInterface0230_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + this.focusOnTouchValue = true + }) + + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width('95%') + .height(40) + .margin(20) + .fontSize(14) + .id('focus') + .fontColor(Color.Black) + .focusOnTouch(this.focusOnTouchValue) + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0240.ets new file mode 100644 index 0000000000000000000000000000000000000000..93804b4770a16ebdf1630dfdeb37967466607c09 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0240.ets @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0240 { + @State focusOnTouchValue: boolean = false + private iconStr: ResourceStr = $r("app.media.icon"); + build() { + Column() { + + Button("focusOnTouch true") + .id('UIAttributesFocuscontrolInterface0240_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + this.focusOnTouchValue = true + }) + + Image(this.iconStr) + .width(200) + .height(270) + .focusOnTouch(this.focusOnTouchValue) + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0250.ets new file mode 100644 index 0000000000000000000000000000000000000000..4399bc2afa8a36d4b2e78dea6672f20fd7edefa0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0250.ets @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0250 { + build() { + Column({ space: 20 }) { + Button("你好") + .id('UIAttributesFocuscontrolInterface0250_001') + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0260.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0260.ets new file mode 100644 index 0000000000000000000000000000000000000000..58e213f59ab3efeedf73b5bd1d5922926cc6856a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0260.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIAttributesFocuscontrolInterface0260 { +@State enabledValue :boolean = true + build() { + Column({ space: 20 }) { + Row(){ + Button("enable:false") + .id('UIAttributesFocuscontrolInterface0260_001') + .width(200) + .height(70) + .onClick(() => { + this.enabledValue = false + }) + } + Button("Focus") + .width(200) + .height(70) + .fontColor(Color.White) + .enabled(this.enabledValue) + }.width('100%') + } + } + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse001.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse001.ets new file mode 100644 index 0000000000000000000000000000000000000000..00e00778db06306e9c03600c0625097cf1422983 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse001.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrClearfocuse001 { + @State bgColorValue: Color = Color.Blue + @State bgBtnValue: Color = Color.Blue + @State bgBtnColor: Color = Color.Blue + + build() { + Column() { + Button('1') + .defaultFocus(true) + .backgroundColor(this.bgColorValue) + .onFocus(() => { + this.bgColorValue = Color.Green + }) + .onBlur(() => { + this.bgColorValue = Color.Red + }) + .tabIndex(1) + Button('2') + .focusOnTouch(true) + .backgroundColor(this.bgBtnValue) + .onFocus(() => { + this.bgBtnValue = Color.Green + }) + .onBlur(() => { + this.bgBtnValue = Color.Blue + }) + .tabIndex(2) + Button('3') + .backgroundColor(this.bgBtnColor) + .onFocus(() => { + this.bgBtnColor = Color.Red + }) + .onBlur(() => { + this.bgBtnColor = Color.Blue + }) + .tabIndex(3) + + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse002.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse002.ets new file mode 100644 index 0000000000000000000000000000000000000000..0538d5c97464af3a1b7790a7c67c81d48699dbe3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse002.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrClearfocuse002 { + @State bgColorValue: Color = Color.Blue + @State bgBtnValue: Color = Color.Blue + @State bgBtnColor: Color = Color.Blue + + build() { + Column() { + Button('1') + .defaultFocus(true) + .backgroundColor(this.bgColorValue) + .onFocus(() => { + this.bgColorValue = Color.Green + }) + .onBlur(() => { + this.bgColorValue = Color.Red + }) + .tabIndex(1) + Button('2') + .focusOnTouch(true) + .backgroundColor(this.bgBtnValue) + .onFocus(() => { + this.bgBtnValue = Color.Green + }) + .onBlur(() => { + this.bgBtnValue = Color.Blue + }) + .tabIndex(2) + Button('3') + .backgroundColor(this.bgBtnColor) + .onFocus(() => { + this.bgBtnColor = Color.Red + }) + .onBlur(() => { + this.bgBtnColor = Color.Blue + }) + .tabIndex(3) + + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse003.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse003.ets new file mode 100644 index 0000000000000000000000000000000000000000..242e2a7035b179f8b904b622d50b0e96942a5677 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse003.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrClearfocuse003 { + @State bgColorValue: Color = Color.Blue + @State bgBtnValue: Color = Color.Blue + @State bgBtnColor: Color = Color.Blue + + build() { + Column() { + Button('1') + .defaultFocus(true) + .backgroundColor(this.bgColorValue) + .onFocus(() => { + this.bgColorValue = Color.Green + }) + .onBlur(() => { + this.bgColorValue = Color.Red + }) + .tabIndex(1) + Button('2') + .focusOnTouch(true) + .backgroundColor(this.bgBtnValue) + .onFocus(() => { + this.bgBtnValue = Color.Green + }) + .onBlur(() => { + this.bgBtnValue = Color.Blue + }) + .tabIndex(2) + Button('3') + .backgroundColor(this.bgBtnColor) + .onFocus(() => { + this.bgBtnColor = Color.Red + }) + .onBlur(() => { + this.bgBtnColor = Color.Blue + }) + .tabIndex(3) + + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0010.ets new file mode 100644 index 0000000000000000000000000000000000000000..285dc770de41532c7bf5e7901a6ee4b90c868d16 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0010.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0010 { + build() { + Column({ space: 30 }) { + Button('button strokeWidth -20px') + .focusBox({ + strokeWidth: LengthMetrics.px(-20) + }) + Button('button strokeWidth -20vp') + .focusBox({ + strokeWidth: LengthMetrics.vp(-20), + }) + Button('button strokeWidth -20lpx') + .focusBox({ + strokeWidth: LengthMetrics.lpx(-20), + }) + Button('button strokeWidth -20fp') + .focusBox({ + strokeWidth: LengthMetrics.fp(-20), + }) + Button('button strokeWidth 30%') + .focusBox({ + strokeWidth: LengthMetrics.percent(30), + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..71d03c6ae9102c5b97baf66228588f29fbeb8a42 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0020.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0020 { + build() { + Column({ space: 30 }) { + Button('button strokeWidth 负数') + .focusBox({ + strokeWidth: LengthMetrics.px(-20) + }) + Button('button strokeWidth 小数') + .focusBox({ + strokeWidth: LengthMetrics.vp(0.5), + }) + Button('button strokeWidth -null') + .focusBox({ + strokeWidth: null, + }) + Button('button strokeWidth undefined') + .focusBox({ + strokeWidth: undefined, + }) + Button('button strokeWidth 0') + .focusBox({ + strokeWidth: LengthMetrics.px(0), + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..d48935219bfbce435911cf40fb1d6fe884298144 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0030.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0030 { + build() { + Column({ space: 30 }) { + Button('button strokeColor rgba') + .focusBox({ + strokeColor: ColorMetrics.rgba(192, 192, 192), + }) + Button('button strokeColor Green') + .focusBox({ + strokeColor: ColorMetrics.resourceColor(Color.Green), + }) + Button('button strokeColor undefined') + .focusBox({ + strokeColor: ColorMetrics.resourceColor($r('app.color.Pink')), + }) + Button('button strokeColor fc0303') + .focusBox({ + strokeColor: ColorMetrics.resourceColor('#fc0303'), + }) + Button('button strokeColor 0xff000000') + .focusBox({ + strokeColor: ColorMetrics.resourceColor('#ff000000'), + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..f579cd787546cb50374439392aff9674f3138e40 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0040.ets @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0040 { + build() { + Column({ space: 30 }) { + Button('button strokeColor null') + .focusBox({ + strokeColor: null, + }) + Button('button strokeColor undefined') + .focusBox({ + strokeColor: undefined, + }) + Button('button strokeColor abcd') + .focusBox({ + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..189332d362529e4e8f71c9c5cde580916998a6c6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0050.ets @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0050 { + build() { + Column({ space: 30 }) { + Button('button margin -5px') + .focusBox({ + margin: LengthMetrics.px(-5), + }) + Button('button margin 内侧-5vp') + .focusBox({ + margin: LengthMetrics.vp(-5), + }) + Button('button margin 内侧-5fp') + .focusBox({ + margin: LengthMetrics.fp(-5), + }) + Button('button margin 内侧5') + .focusBox({ + margin: LengthMetrics.vp(5), + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0060.ets new file mode 100644 index 0000000000000000000000000000000000000000..390c22280d51b00e73aa0426380201df98a501c9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0060.ets @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0060 { + build() { + Column({ space: 30 }) { + Button('button margin 内侧-5px') + .focusBox({ + margin: LengthMetrics.px(-5), + }) + Button('button margin 内侧-5vp') + .focusBox({ + margin: LengthMetrics.vp(-5), + }) + Button('button margin 内侧-5fp') + .focusBox({ + margin: LengthMetrics.fp(-5), + }) + Button('button margin 内侧5') + .focusBox({ + margin: LengthMetrics.vp(5), + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0070.ets new file mode 100644 index 0000000000000000000000000000000000000000..3074fbf20ce4338ecee400152251e513010a13aa --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0070.ets @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0070 { + build() { + Column({ space: 30 }) { + Button('button margin为小数') + .focusBox({ + margin: LengthMetrics.px(0.1), + }) + Button('button margin 0') + .focusBox({ + margin: LengthMetrics.px(0), + }) + Button('button margin null') + .focusBox({ + margin: null, + }) + Button('button margin undefined') + .focusBox({ + margin: undefined, + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0080.ets new file mode 100644 index 0000000000000000000000000000000000000000..45ff63150204cdd109e18f13111ef7b7ed73156b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0080.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0080 { + build() { + Column({ space: 30 }) { + Button('button margin 10px、strokeColor Color、strokeWidth 20vp') + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 255, 128), + strokeWidth: LengthMetrics.px(20) + }) + Button('button margin 5vp、strokeColor app、strokeWidth 20lpx') + .focusBox({ + margin: LengthMetrics.lpx(20), + strokeColor: ColorMetrics.rgba(255, 128, 255), + strokeWidth: LengthMetrics.px(5) + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0090.ets new file mode 100644 index 0000000000000000000000000000000000000000..e438a5e70caa559095eb7e084e3e98e1bdf8bc9a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0090.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0090 { + build() { + Column({ space: 30 }) { + Button('zIndex(5)') + .zIndex(5) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 140, 0), + strokeWidth: LengthMetrics.vp(20), + + }) + Button('zIndex(1)') + .zIndex(1) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 140, 0), + strokeWidth: LengthMetrics.vp(20), + + }) + Button('zIndex(20)') + .zIndex(20) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 140, 0), + strokeWidth: LengthMetrics.vp(20), + + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0100.ets new file mode 100644 index 0000000000000000000000000000000000000000..d41f687efc37ca60197938a278ec72b9cab2a7d6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0100.ets @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0100 { + build() { + Column({ space: 30 }) { + Button('zIndex(1)') + .visibility(Visibility.Visible) + .zIndex(1) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 140, 0), + strokeWidth: LengthMetrics.vp(20), + }) + Button('zIndex(2)') + .visibility(Visibility.Visible) + .zIndex(2) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 140, 0), + strokeWidth: LengthMetrics.vp(20), + }) + Button('zIndex(3)') + .visibility(Visibility.Visible) + .zIndex(3) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 140, 0), + strokeWidth: LengthMetrics.vp(20), + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0110.ets new file mode 100644 index 0000000000000000000000000000000000000000..e35931eeb88c41bed4257d29e8e460444200b33f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0110.ets @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0110 { + build() { + Column({ space: 20 }) { + Button("small black focus box") + .enabled(false) + .focusBox({ + margin: new LengthMetrics(0), + }) + } + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0120.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1497fb6f8e5543f1f1da8a78c73da4d65f126c8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0120.ets @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0120 { + build() { + Column({ space: 30 }) { + Button('button Visibility.Visible') + .visibility(Visibility.Visible) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 255, 128), + strokeWidth: LengthMetrics.px(20), + + }) + Button('button Visibility.Hidden') + .visibility(Visibility.Hidden) + .focusBox({ + margin: LengthMetrics.lpx(20), + strokeColor: ColorMetrics.rgba(255, 128, 255), + strokeWidth: LengthMetrics.px(5) + }) + Button('button Visibility.None') + .visibility(Visibility.None) + .focusBox({ + margin: LengthMetrics.lpx(20), + strokeColor: ColorMetrics.rgba(255, 128, 255), + strokeWidth: LengthMetrics.px(5) + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0130.ets new file mode 100644 index 0000000000000000000000000000000000000000..ace28685ccd2691a9cd172507232d4dc850e135e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0130.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0130 { + private iconStr: ResourceStr = $r("app.media.icon"); + + build() { + Column({ space: 30 }) { + Image(this.iconStr) + .onClick(() => { + }) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 128, 64), + strokeWidth: LengthMetrics.vp(20) + }).height('50%') + .width('50%') + Text('你好') + .onClick(() => { + }) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 128, 64), + strokeWidth: LengthMetrics.vp(20) + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0140.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0eb49860794a9845ff7fb0dd550d78587e51e03 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0140.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0140 { + private iconStr: ResourceStr = $r("app.media.icon"); + + build() { + Column({ space: 30 }) { + Image(this.iconStr).focusable(true) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 128, 64), + strokeWidth: LengthMetrics.vp(20) + }).height('50%') + .width('50%') + Text('你好').focusable(true) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 128, 64), + strokeWidth: LengthMetrics.vp(20) + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0150.ets new file mode 100644 index 0000000000000000000000000000000000000000..e308442e87e9bbf99159a2768f6a6d513923dbf9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0150.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' +import window from '@ohos.window'; +import common from '@ohos.app.ability.common'; +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0150 { + @State isFullScreen: boolean = false + + horVerSwitch() { + let context = getContext(this) as common.UIAbilityContext; + window.getLastWindow(context).then((lastWindow) => { + lastWindow.setPreferredOrientation(this.isFullScreen ? window.Orientation.PORTRAIT : window.Orientation.LANDSCAPE) + this.isFullScreen = !this.isFullScreen + }) + } + aboutToAppear(): void { + this.horVerSwitch() + } + + build() { + Column({ space: 30 }) { + Button("横竖屏切换") + .id('UIComponentCommonattrDrawingoptimization0150_001') + .onClick(() => { + this.horVerSwitch() + }) + Button('button Visibility.Visible') + .visibility(Visibility.Visible) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 128, 64), + strokeWidth: LengthMetrics.vp(20), + + }) + Button('button Visibility.Hidden') + .visibility(Visibility.Hidden) + .focusBox({ + margin: LengthMetrics.vp(5), + strokeColor: ColorMetrics.rgba(255, 128, 192), + strokeWidth: LengthMetrics.lpx(20) + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0170.ets new file mode 100644 index 0000000000000000000000000000000000000000..e27c08ffd9e433159eb39183296bf8b1718f705b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0170.ets @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0170 { + build() { + Column({ space: 30 }) { + Button('button margin 10px、strokeColor Color、strokeWidth 20vp') + .visibility(Visibility.Visible) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 255, 128), + strokeWidth: LengthMetrics.vp(20), + + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0180.ets new file mode 100644 index 0000000000000000000000000000000000000000..59c1c2e671d7453d1ab0c21334db5f9a24365b1e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0180.ets @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0180 { + private iconStr: ResourceStr = $r("app.media.icon"); + + build() { + Column({ space: 30 }) { + Image(this.iconStr) + .onClick(() => { + }) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 128, 64), + strokeWidth: LengthMetrics.vp(20) + }).height('50%') + .width('50%') + + } + .justifyContent(FlexAlign.Center) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 128, 64), + strokeWidth: LengthMetrics.vp(20) + }) + .padding(30) + .height('100%') + .width('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0190.ets new file mode 100644 index 0000000000000000000000000000000000000000..347152809fba99f164e93294c8ed8ac1367eb905 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0190.ets @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0190 { + @State text: string = '' + @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } + @State passwordState: boolean = false + controller: TextInputController = new TextInputController() + + build() { + Column() { + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width('95%') + .height(40) + .margin(20) + .fontSize(14) + .fontColor(Color.Black) + .inputFilter('[a-z]', (e) => { + console.log(JSON.stringify(e)) + }) + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 128, 64), + strokeWidth: LengthMetrics.vp(20) + }) + .padding(30) + .height('100%') + .width('100%') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0200.ets new file mode 100644 index 0000000000000000000000000000000000000000..6585b9afc2108efb91eaec576090bca89426d7a3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0200.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0200 { + build() { + Column({ space: 30 }) { + Button('button one') + .focusBox({ + margin: LengthMetrics.vp(10), + strokeColor: ColorMetrics.rgba(255, 128, 64), + strokeWidth: LengthMetrics.vp(200) + }) + Button('button two') + .focusBox({ + margin: LengthMetrics.vp(5), + strokeColor: ColorMetrics.rgba(255, 128, 64), + strokeWidth: LengthMetrics.vp(10) + }) + }.justifyContent(FlexAlign.Center) + .padding(30) + .height('100%') + .width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0210.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6eaa4c892746c87d0a59f235c84f8e01a6da970 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0210.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0210 { + @State select: boolean = true + private iconStr: ResourceStr = $r("app.media.icon") + private iconStr2: ResourceStr = $r("app.media.icon") + + @Builder + SubMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } + } + + @Builder + MyMenu(){ + Menu() { + MenuItem({ startIcon: $r("app.media.icon"), content: "菜单选项" }) + } + .focusBox({ + margin: LengthMetrics.px(10), + strokeColor: ColorMetrics.rgba(255, 0, 0), + strokeWidth: LengthMetrics.px(4), + }) + } + + build() { + Row() { + Column() { + Text('click to show menu') + .id('UIComponentCommonattrDrawingoptimization0210_001') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + } + .height('100%') + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0220.ets new file mode 100644 index 0000000000000000000000000000000000000000..eda2a6da7ed00a154e8311b24d5a16c352a75c45 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0220.ets @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@CustomDialog +struct UIComponentCommonattrDrawingoptimization0220 { + controllerTwo?: CustomDialogController + + build() { + Column() { + Text('我是第二个弹窗') + .fontSize(30) + .height(100) + Button('点我关闭第二个弹窗') + .onClick(() => { + if (this.controllerTwo != undefined) { + this.controllerTwo.close() + } + }) + .margin(20) + } + } +} + +@CustomDialog +struct CustomDialogExample { + @Link textValue: string + @Link inputValue: string + dialogControllerTwo: CustomDialogController | null = new CustomDialogController({ + builder: UIComponentCommonattrDrawingoptimization0220(), + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -25 } }) + controller?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + + build() { + Column() { + Text('Change text').fontSize(20).margin({ top: 10, bottom: 10 }) + TextInput({ placeholder: '', text: this.textValue }).height(60).width('90%') + .onChange((value: string) => { + this.textValue = value + }) + Text('Whether to change a text?').fontSize(16).margin({ bottom: 10 }) + Flex({ justifyContent: FlexAlign.SpaceAround }) { + Button('cancel') + .onClick(() => { + if (this.controller != undefined) { + this.controller.close() + this.cancel() + } + }).backgroundColor(0xffffff).fontColor(Color.Black) + Menu() + { + MenuItem({ startIcon: $r("app.media.icon"), content: "菜单选项" }) + .focusBox({ + strokeColor: ColorMetrics.rgba(255, 0, 0), + strokeWidth: LengthMetrics.px(5) + }) + }.backgroundColor(0xffffff).fontColor(Color.Red) + + }.margin({ bottom: 10 }) + + Button('点我打开第二个弹窗') + .onClick(() => { + if (this.dialogControllerTwo != null) { + this.dialogControllerTwo.open() + } + }) + .margin(20) + }.borderRadius(10) + } +} + +@Entry +@Component +struct CustomDialogUser { + @State textValue: string = '' + @State inputValue: string = 'click me' + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: CustomDialogExample({ + cancel: () => { + this.onCancel() + }, + confirm: () => { + this.onAccept() + }, + textValue: $textValue, + inputValue: $inputValue + }), + cancel: this.exitApp, + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 4, + customStyle: false, + cornerRadius: 10, + }) + + // 在自定义组件即将析构销毁时将dialogControlle置空 + aboutToDisappear() { + this.dialogController = null // 将dialogController置空 + } + + onCancel() { + console.info('Callback when the first button is clicked') + } + + onAccept() { + console.info('Callback when the second button is clicked') + } + + exitApp() { + console.info('Click the callback in the blank area') + } + + build() { + Column() { + Button(this.inputValue) + .id('UIComponentCommonattrDrawingoptimization0220_001') + .onClick(() => { + if (this.dialogController != null) { + this.dialogController.open() + } + }).backgroundColor(0x317aff) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0230.ets new file mode 100644 index 0000000000000000000000000000000000000000..b4cb68eddad969c824da440fd5b07f437a4a98a7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0230.ets @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0230 { + @State isShow: boolean = false + @Builder + myBuilder() { + Column() { + Button("content1") + .margin(10) + .fontSize(20) + .focusBox({ + strokeColor: ColorMetrics.rgba(255, 0, 0), + strokeWidth: LengthMetrics.px(5) + }) + } + .width('100%') + } + + build() { + Column() { + Button("transition modal 1") + .id('UIComponentCommonattrDrawingoptimization0230_001') + .onClick(() => { + this.isShow = true + }) + .fontSize(20) + .margin(10) + .bindSheet($$this.isShow, this.myBuilder(), { + detents: [SheetSize.MEDIUM, SheetSize.LARGE, 200], + backgroundColor: Color.Gray, + blurStyle: BlurStyle.Thick, + showClose: true, + title: { title: "title", subtitle: "subtitle" }, + }) + } + .justifyContent(FlexAlign.Start) + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0240.ets new file mode 100644 index 0000000000000000000000000000000000000000..b0b8139af30364b0bd65cee0e23c536f129f77e4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0240.ets @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { ColorMetrics, LengthMetrics } from '@ohos.arkui.node' + +@Entry +@Component +struct UIComponentCommonattrDrawingoptimization0240 { + build() { + Column({ space: 20 }) { + Button("small black focus box") + .clip(true) + .focusBox({ + margin: new LengthMetrics(0), + strokeColor: ColorMetrics.rgba(255, 0, 0), + strokeWidth: LengthMetrics.px(10) + }) + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0010.ets new file mode 100644 index 0000000000000000000000000000000000000000..93376a51d2330d09c6e7dd76eb0b891b63a15053 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0010.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0010 { + build() { + Column({ space: 5 }) { + Text("你好").width(68).height(68) + .onClick(() => { + }) + Text("你好").width(68).height(68) + .gesture( + TapGesture({ count: 1, fingers: 2 }) + ) + Text("你好").width(68).height(68) + .gesture( + TapGesture({ count: 2, fingers: 1 }) + ) + Text("你好").width(68).height(68) + .gesture( + TapGesture({ count: 1, fingers: 1 }) + ) + Text("你好").width(68).height(68) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..5fe695e224e7aba5795a84fe2a6d791c3ba0eb75 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0020.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0020 { + private iconStr: ResourceStr = $r("app.media.icon"); + + build() { + Column({ space: 5 }) { + Image(this.iconStr).width(68).height(68) + .onClick(() => { + }) + Image(this.iconStr).width(68).height(68) + .gesture( + TapGesture({ count: 1, fingers: 2 }) + ) + Image(this.iconStr).width(68).height(68) + .gesture( + TapGesture({ count: 2, fingers: 1 }) + ) + Image(this.iconStr).width(68).height(68) + .gesture( + TapGesture({ count: 1, fingers: 1 }) + ) + Image(this.iconStr).width(68).height(68) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..a341cff6e60ed33f9dd2231065ca21cb7f3ea4e8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0030.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0030 { + @State text: string = '' + controller: TextInputController = new TextInputController() + @State changeValue: string = '' + + build() { + Column({ space: 5 }) { + Divider() + .vertical(true) + .height(22) + .color('#ff3982d0') + .opacity(0.6) + .margin({ left: 8, right: 8 }) + .onClick(() => { + }) + Divider() + .vertical(true) + .height(22) + .color('#ff5aa02c') + .opacity(0.6) + .margin({ left: 8, right: 8 }) + .gesture( + TapGesture({ count: 1, fingers: 2 }) + ) + Divider() + .vertical(true) + .height(22) + .color('#ff0b4e96') + .opacity(0.6) + .margin({ left: 8, right: 8 }) + .gesture( + TapGesture({ count: 2, fingers: 1 }) + ) + Divider() + .vertical(true) + .height(22) + .color('#ff75064d') + .opacity(0.6) + .margin({ left: 8, right: 8 }) + .gesture( + TapGesture({ count: 1, fingers: 1 }) + ) + Divider() + .vertical(true) + .height(22) + .color('#ffef0d5e') + .opacity(0.6) + .margin({ left: 8, right: 8 }) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6354c7dc63e56fa111202f85b5668ce15309b96 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0040.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0040 { + build() { + Column({ space: 5 }) { + Gauge({ value: 5, min: 1, max: 10 }).width(68).height(68) + .onClick(() => { + }) + Gauge({ value: 5, min: 1, max: 10 }).width(68).height(68) + .gesture( + TapGesture({ count: 1, fingers: 2 }) + ) + Gauge({ value: 5, min: 1, max: 10 }).width(68).height(68) + .gesture( + TapGesture({ count: 2, fingers: 1 }) + ) + Gauge({ value: 5, min: 1, max: 10 }).width(68).height(68) + .gesture( + TapGesture({ count: 1, fingers: 1 }) + ) + Gauge({ value: 5, min: 1, max: 10 }).width(68).height(68) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..5fcbf7fc21d69f740f0f149592daaf7c96ef7f2d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0050.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0050 { + build() { + Column({ space: 5 }) { + DataPanel({ values: [30], max: 100, type: DataPanelType.Circle }).width(168).height(168) + .onClick(() => { + }) + DataPanel({ values: [30], max: 100, type: DataPanelType.Circle }).width(168).height(168) + .gesture( + TapGesture({ count: 1, fingers: 2 }) + ) + DataPanel({ values: [30], max: 100, type: DataPanelType.Circle }).width(168).height(168) + .gesture( + TapGesture({ count: 2, fingers: 1 }) + ) + DataPanel({ values: [30], max: 100, type: DataPanelType.Circle }).width(168).height(168) + .gesture( + TapGesture({ count: 1, fingers: 1 }) + ) + DataPanel({ values: [30], max: 100, type: DataPanelType.Circle }).width(168).height(168) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0060.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca1ff2490f034138d2861dcecba5da2b5c705d47 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0060.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0060 { + private iconStr: ResourceStr = $r("app.media.icon"); + @State focusableValue: boolean = false + + build() { + Column({ space: 5 }) { + Text('你好').focusable(this.focusableValue) + + Image(this.iconStr).width(68).height(68).focusable(this.focusableValue) + .onClick(() => { + }) + Divider() + .focusable(this.focusableValue) + .vertical(true) + .height(22) + .color('#ffef0d5e') + .opacity(0.6) + .margin({ left: 8, right: 8 }) + Gauge({ value: 5, min: 1, max: 10 }).width(68).height(68) + .focusable(this.focusableValue) + .gesture( + TapGesture({ count: 2, fingers: 1 }) + ) + DataPanel({ values: [30], max: 100, type: DataPanelType.Circle }).width(168).height(168) + .focusable(this.focusableValue) + .gesture( + TapGesture({ count: 2, fingers: 1 }) + ) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0070.ets new file mode 100644 index 0000000000000000000000000000000000000000..2381c5ec4c799e136855fd50bb6caf1754c7860d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0070.ets @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0070 { + private iconStr: ResourceStr = $r("app.media.icon"); + @State focusableValue: boolean = false + + build() { + Column({ space: 5 }) { + Text('你好').focusable(this.focusableValue) + + Image(this.iconStr).width(68).height(68).focusable(this.focusableValue) + .onClick(() => { + }) + Divider() + .focusable(this.focusableValue) + .vertical(true) + .height(22) + .color('#ffef0d5e') + .opacity(0.6) + .margin({ left: 8, right: 8 }) + Gauge({ value: 5, min: 1, max: 10 }).width(68).height(68) + .focusable(this.focusableValue) + .gesture( + TapGesture({ count: 2, fingers: 1 }) + ) + DataPanel({ values: [30], max: 100, type: DataPanelType.Circle }).width(168).height(168) + .focusable(this.focusableValue) + .gesture( + TapGesture({ count: 2, fingers: 1 }) + ) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0080.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b48df09d1351e36383f7c207ffffa0a7569d5ec --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0080.ets @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0080 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + private listScroller: ListScroller = new ListScroller(); + @State flag: boolean = false; + + build() { + Column() { + List({ space: 10, scroller: this.listScroller }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('item_' + item) + .width('100%') + .height(100) + .textAlign(TextAlign.Center) + .backgroundColor(0xFFFFFF) + } + }, (item: string) => item) + }.focusable(false) + .padding(10) + .backgroundColor(Color.Yellow) + .height(500) + .scrollSnapAlign(this.flag ? ScrollSnapAlign.CENTER : ScrollSnapAlign.START) + + Row({ space: 20 }) { + Button('focusable false').focusable(false) + }.height('50%') + }.onClick(()=>{}) + .backgroundColor(0xDCDCDC) + .width('100%') + .height('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0090.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba5d9a6cefc7086f1afa11c270605d9f75267498 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0090.ets @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0090 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + private listScroller: ListScroller = new ListScroller(); + @State flag: boolean = false; + + build() { + Column() { + List({ space: 10, scroller: this.listScroller }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Text('item_' + item) + .width('100%') + .height(100) + .textAlign(TextAlign.Center) + .backgroundColor(0xFFFFFF) + } + }, (item: string) => item) + }.focusable(true) + .padding(10) + // .backgroundColor(Color.Yellow) + .height(500) + //.scrollSnapAlign(this.flag ? ScrollSnapAlign.CENTER : ScrollSnapAlign.START) + + Row({ space: 20 }) { + Button('focusable true') + }.height('50%') + }.onClick(()=>{}) + .backgroundColor(0xDCDCDC) + .width('100%') + .height('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0100.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c3ad77a2acd45f67f78988262d5124e1dbf4d32 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0100.ets @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0100{ + build() { + Column({ space: 5 }) { + Text("disable") + }.width('100%').margin({ top: 5 }) + .tabIndex(1) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0110.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb7becd56766f98db9b9c87bc87fd350649275af --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0110.ets @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0110 { + @State widthValue: number = 200 + @State heightValue: number = 250 + @State str: string = 'await Utils.sleep(3000);' + + build() { + Column({ space: 5 }) { + Text(this.str).width(this.widthValue).height(this.heightValue) + .id('UIComponentCommonattrFocusenhancement0110_001') + .onFocus(() => { + this.str = "rotateonFocus" + }) + }.width('100%').margin({ top: 5 }) + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0120.ets new file mode 100644 index 0000000000000000000000000000000000000000..0368954f0e81531cfcee777afa0d6908637204a2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0120.ets @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0120 { + @State widthValue: number = 200 + @State heightValue: number = 250 + @State str: string = '你好' + + build() { + Column({ space: 5 }) { + Text(this.str).width(this.widthValue).height(this.heightValue) + .id('UIComponentCommonattrFocusenhancement0120_001') + + .onHover(() => { + this.widthValue = 80 + this.heightValue = 60 + }) + }.width('100%').margin({ top: 5 }) + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0130.ets new file mode 100644 index 0000000000000000000000000000000000000000..749ebe56dacdda1fc2018fc0837186071b3f06e2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0130.ets @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrFocusenhancement0130 { + build() { + Column({ space: 5 }) { + Text("你好").width(68).height(68) + .tabIndex(1) + Text("你好").width(68).height(68) + .tabIndex(3) + Text("你好").width(68).height(68) + .tabIndex(2) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0010.ets new file mode 100644 index 0000000000000000000000000000000000000000..53ebbaf87555b923ad604a1e1711e601a61a4747 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0010.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0010 { + @State color :Color = Color.Red + build() { + Column({ space: 20 }) { + Row({ space: 5 }) { + Button("btn1").width(200).height(100) + .backgroundColor(this.color) + .id('focus') + } + + Button("Focus-btn1").id('UIComponentCommonattrResult0010_001') + .width(200).height(70).fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.color = Color.Green + } else { + this.getUIContext().getPromptAction().showToast({ message: '150003' }) + } + + }) + }.width('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..b655721e70157af69e5b2d0b64123d8467d96c75 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0020.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0020 { + private iconStr: ResourceStr = $r("app.media.icon"); + build() { + Column({ space: 20 }) { + Row({ space: 5 }) { + Image(this.iconStr) + .width(200) + .clip(false) + .id('focus') + } + + Button("Focus-img1").id('UIComponentCommonattrResult0020_001') + .width(200).height(70).fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150001' }) + } + }) + }.width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c14a1370333f169f5a5926da4e6579f8ee245ff --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0030.ets @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0030 { + build() { + Column() { + Button("Focus-btn3") + .id('UIComponentCommonattrResult0030_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150002' }) + } + }) + Button("你好中国").id('Focus') + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a0366a0dfd67e8c91944bb41935143e4d12ba50 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0040.ets @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0040 { + build() { + Column({ space: 20 }) { + Row({ space: 5 }) { + Button("button4").width(200).height(100) + .backgroundColor(Color.Yellow) + .id('focusButton') + } + Button("Focus-btn4") + .id('UIComponentCommonattrResult0040_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150003' }) + } + + }) + }.width('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..413600cab675a6a9d3e0b1ea9865270c7dd6080d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0050.ets @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0050 { + build() { + Column({ space: 20 }) { + Row({ space: 5 }) { + Text("111111") + .width(200) + .focusable(true) + .id('focus') + } + + Button("RequestFocus").id('UIComponentCommonattrResult0050_001') + .width(200).height(70).fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150001' }) + } + }) + }.width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0060.ets new file mode 100644 index 0000000000000000000000000000000000000000..dcf3ee40a3fd7a66dcdcbfb884219f48ec6cef1e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0060.ets @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0060 { + @State idList: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'LastPageId'] + + build() { + Column({ space: 20 }) { + Row({ space: 5 }) { + Button("id: " + this.idList[0] + " focusable(false)") + .width(200) + .height(70) + .fontColor(Color.White) + .id(this.idList[0]) + .focusable(false) + Button("id: " + this.idList[1]) + .width(200).height(70).fontColor(Color.White) + .id(this.idList[1]) + } + + Button("RequestFocus").id('UIComponentCommonattrResult0060_001') + .width(200).height(70).fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus(this.idList[0]) + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'Request success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150001' }) + } + }) + }.width('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0070.ets new file mode 100644 index 0000000000000000000000000000000000000000..77db9e22a49e1c42a9ee3416ae37dfbd6736864a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0070.ets @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0070 { + @State color: Color = Color.Red + + build() { + Column({ space: 20 }) { + Row({ space: 5 }) { + Button("btn1").width(200).height(100) + .backgroundColor(Color.Yellow) + .visibility(Visibility.Hidden) + .id('focus') + } + + Button("Focus-btn4") + .id('UIComponentCommonattrResult0070_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150003' }) + } + + }) + }.width('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0080.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1f08043c3e5903c5bd7646a2d9cbbebb06d98f4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0080.ets @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0080 { + build() { + Column({ space: 20 }) { + Row({ space: 5 }) { + Button("btn1").width(200).height(100) + .backgroundColor(Color.Yellow) + .visibility(Visibility.None) + .id('focus') + } + + Button("Focus-btn5") + .id('UIComponentCommonattrResult0080_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150003' }) + } + + }) + }.width('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0090.ets new file mode 100644 index 0000000000000000000000000000000000000000..26054fed9b6a10e7d344bd39c445e6393c1d3f87 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0090.ets @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0090 { + @State text: string = '' + @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } + @State passwordState: boolean = false + controller: TextInputController = new TextInputController() + + build() { + Column({ space: 20 }) { + Row({ space: 5 }) { + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width('95%') + .height(40) + .enabled(false) + .margin(20) + .fontSize(14) + .fontColor(Color.Black) + .id('focus') + } + + Button("textInput1") + .id('UIComponentCommonattrResult0090_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150003' }) + } + + }) + }.width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0100.ets new file mode 100644 index 0000000000000000000000000000000000000000..53d2b171628a2d256c8ef7176ee8024f204cd1dc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0100.ets @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0100 { + @State accumulateTime: number = 0 + controller: TextClockController = new TextClockController() + @State visibleValue: Visibility = Visibility.Visible + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Image($r('app.media.icon')).width(100).height(100).focusable(true) + .id('img2') + + Button('clip-img') + .id('UIComponentCommonattrResult0100_001') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("img2") + } + catch (error) { + console.error('requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0110.ets new file mode 100644 index 0000000000000000000000000000000000000000..54dae461e6998c1ec311dd6c9b3d3edc00d133a4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0110.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0110 { + @State text: string = '' + @State positionInfo: CaretOffset = { index: 0, x: 0, y: 0 } + @State passwordState: boolean = false + controller: TextInputController = new TextInputController() + + build() { + Column({ space: 20 }) { + Row({ space: 5 }) { + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width('95%') + .height(40) + .enabled(false) + .margin(20) + .fontSize(14) + .fontColor(Color.Black) + .tabIndex(0) + .id('focusTextInput') + } + + Row({ space: 5 }) { + Button("button4").width(200).height(100) + .backgroundColor(Color.Yellow) + .id('focusButton') + } + Button("Focus-btn4") + .id('UIComponentCommonattrResult0110_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focusButton') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150003' }) + } + + }) + }.width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0120.ets new file mode 100644 index 0000000000000000000000000000000000000000..3b1ea84aa5aa9096a029335ecf41b4bcef49bcd1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0120.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct UIComponentCommonattrResult0120 { + @State showPopup: boolean = false + @State str: string = '' + + @Builder + popupBuilder() { + Column({ space: 2 }) { + Image($r("app.media.icon")).width(24).height(24).margin({ left: -5 }) + Text(this.str).fontSize(10) + Button('button') + TextInput() + .id('textInput') + Button("RequestFocus") + .fontColor(Color.White) + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("textInput") + } + catch (error) { + console.error('requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + Button("RequestFocus2") + .fontColor(Color.White) + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("btn2") + } + catch (error) { + console.error('requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + + Button("调用requestFocus传入pageOne页面内textInput") + .fontColor(Color.White) + .id('UIComponentCommonattrResult0120_002') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("textInput") + } + catch (error) { + console.error('ljx requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + .width(300) + .height(300) + .padding(5) + .onFocus(() => { + console.log(`popup is onFocused`) + }) + .onBlur(() => { + console.log(`popup is onBlur`) + }) + } + + build() { + Scroll() { + Column({ space: 10 }) { + Row({ space: 10 }) { + Button('showPopup') + .id('UIComponentCommonattrResult0120_001') + .bindPopup(this.showPopup, { + builder: this.popupBuilder, + placement: Placement.Top, + mask: { color: '0x33000000' }, + popupColor: Color.Yellow, + enableArrow: true, + showInSubWindow: false, + onStateChange: (e) => { + if (!e.isVisible) { + this.showPopup = false + } + }, + focusable: false + }) + .onClick(() => { + this.showPopup = true + }) + } + } + .width('100%') + .height('100%') + .align(Alignment.Top) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0130.ets new file mode 100644 index 0000000000000000000000000000000000000000..d24fb7b5576502952355542c3351db248be1761a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0130.ets @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct UIComponentCommonattrResult0130 { + @State showPopup: boolean = false + @State str: string = '' + + @Builder + popupBuilder() { + Column({ space: 2 }) { + Image($r("app.media.icon")).width(24).height(24).margin({ left: -5 }) + Text(this.str).fontSize(10) + Button('button') + + Button("RequestFocus") + .fontColor(Color.White) + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("textInput") + } + catch (error) { + console.error('requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + Button("RequestFocus2") + .fontColor(Color.White) + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("btn2") + } + catch (error) { + console.error('requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + Button("page页调用requestFocus传入popUp内textInput") + .id('UIComponentCommonattrResult0130_002') + .fontColor(Color.White) + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("textInput") + } + catch (error) { + this.str = 'requestFocus failed code is ' + error.code + ' message is ' + error.message + } + }) + } + .width(300) + .height(300) + .padding(5) + .onFocus(() => { + console.log(`popup is onFocused`) + }) + .onBlur(() => { + console.log(`popup is onBlur`) + }) + } + + build() { + Scroll() { + Column({ space: 10 }) { + Row({ space: 10 }) { + Button('showPopup') + .id('UIComponentCommonattrResult0130_001') + .bindPopup(this.showPopup, { + builder: this.popupBuilder, + placement: Placement.Top, + mask: { color: '0x33000000' }, + popupColor: Color.Yellow, + enableArrow: true, + showInSubWindow: false, + onStateChange: (e) => { + if (!e.isVisible) { + this.showPopup = false + } + }, + focusable: false + }) + .onClick(() => { + this.showPopup = true + }) + } + } + .width('100%') + .height('100%') + .align(Alignment.Top) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0140.ets new file mode 100644 index 0000000000000000000000000000000000000000..2bf08e9eb4e86cf1c36b0cac632e89aa44cd4c89 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0140.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0140 { + private iconStr: ResourceStr = $r("app.media.icon"); + @State text: string = '' + controller: TextInputController = new TextInputController() + + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "菜单选项", }) + MenuItem({ content: "菜单选项", }) + + } + } + + build() { + Column({ space: 5 }) { + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width('95%') + .height(40) + .margin(20) + .fontSize(14) + .id('focus') + .fontColor(Color.Black) + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Button('click for Menu').id('UIComponentCommonattrResult0140_001') + .bindMenu([ + { + value: 'Menu1', + action: () => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150002' }) + } + } + } + ]) + } + .height('100%') + .width('100%') + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0150.ets new file mode 100644 index 0000000000000000000000000000000000000000..fff8b413c3eaa5ccc6d3c21601a30fa4ad453d18 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0150.ets @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0150 { + private iconStr: ResourceStr = $r("app.media.icon"); + + @Builder + MyMenu() { + Menu() { + MenuItem({ content: "菜单选项", }).id('focus') + MenuItem({ content: "菜单选项", }) + } + } + + build() { + Column() { + Button("Focus-btn1") + .id('UIComponentCommonattrResult0150_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150003' }) + } + }) + + + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Start }) { + Button('ShowMenu-1050') + .height(180) + .width(164) + .bindContextMenu(this.MyMenu, ResponseType.LongPress, + { + enableArrow: true, + placement: Placement.TopLeft + }) + } + .height('100%') + .width('100%') + } + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0160.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec545cd6c10c602e77e82f1113df7802e429a2ff --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0160.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0160 { + @State text: string = '' + controller: TextInputController = new TextInputController() + + build() { + Column({ space: 5 }) { + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width('95%') + .height(40) + .margin(20) + .fontSize(14) + .id('focus') + .fontColor(Color.Black) + Button('调用requestFocus传入page页textInput') + .id('UIComponentCommonattrResult0160_001') + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 3, + confirm: { + value: 'button', + action: () => { + console.info('Button-clicking callback') + } + }, + cancel: () => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150002' }) + } + console.info('Closed callbacks') + }, + } + ) + }) + .backgroundColor(0x317aff) + + }.width('100%').margin({ top: 5 }) + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0170.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c202b600468b696ca0b12a201f0c7d2abbdde1c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0170.ets @@ -0,0 +1,198 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +struct UIComponentCommonattrResult0170 { + + controllerTwo?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column({space:10}) { + + TextInput({text:'TextInput'}).height(50).id('dialog-textInput') + Button('Dialog内调用requestFocus传入textInput').onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("dialog-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + Button('调用requestFocus传入page页textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("page-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + }.height(300) + } +} + + +@Entry +@Component +struct FocusLevel0_2 { + @State showPopup:boolean = false + @State isShow:boolean = false + @State str :string = '' + + @Builder MyMenu1(){ + Menu() { + MenuItem(){ + TextInput().id('menu-textInput') + } + MenuItem(){ + Button('Menu内调用requestFocus传入textInput').onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("menu-textInput") + } catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + MenuItem(){ + Button('调用requestFocus传入page页textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("page-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + }.width('300').height(300) + } + + @State textValue: string = '' + onCancel() {} + onAccept() {} + exitApp() {} + + radioIndex = 0; + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: UIComponentCommonattrResult0170({ + cancel: this.onCancel, + confirm: this.onAccept + }), + autoCancel: true, + alignment: DialogAlignment.Center, + offset: { dx: 0, dy: 0 }, + customStyle: false + }) + + + + @Builder myBuilder() { + Column() { + TextInput().id('ContentCover-textInput') + Button('半模态框内调用requestFocus传入textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("ContentCover-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } }) + Button('调用requestFocus传入page页textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("page-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + .width('100%') + .height('100%') + .justifyContent(FlexAlign.Center) + } + + build() { + Scroll() { + Column({ space: 10 }) { + Text(this.str).fontSize(10) + TextInput().id('page-textInput') + Button('bindMenu') + .bindMenu(this.MyMenu1, { showInSubWindow: true }) + + Button('page页调用requestFocus传入Menu内textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("menu-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + + + Button("openDialog") + .width('100%') + .height(40) + .onClick(() => { + this.dialogController?.open() + }) + Button('page页调用requestFocus传入Dialog内textInput') + .id('UIComponentCommonattrResult0170_001') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("dialog-textInput") + } + catch (error) { + this.str = ' requestFocus failed code is ' + error.code + ' message is ' + error.message + } + }) + Button("bindContentCover") + .onClick(() => { + this.isShow = true + }) + .fontSize(20) + .margin(10) + .bindContentCover(this.isShow, this.myBuilder(), { + modalTransition: ModalTransition.NONE, + backgroundColor: Color.Pink, + }) + Button('page页调用requestFocus传入全模态页面内textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("ContentCover-textInput") + } + catch (error) { + console.error('requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + + } + } + .width('100%') + .height('100%') + .align(Alignment.Top) + } + + pageTransition() { + // 适配自动化,设置页面转场无动画 + PageTransitionEnter({ type: RouteType.Push, duration: 0 }) + PageTransitionExit({ type: RouteType.Push, duration: 0 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0180.ets new file mode 100644 index 0000000000000000000000000000000000000000..e2ef92fc251cc5ece12ab8d80acef7c141a3fc8b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0180.ets @@ -0,0 +1,199 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +struct UIComponentCommonattrResult0180 { + + controllerTwo?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column({space:10}) { + + TextInput({text:'TextInput'}).height(50).id('dialog-textInput') + Button('Dialog内调用requestFocus传入textInput').onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("dialog-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + Button('调用requestFocus传入page页textInput') + .id('UIComponentCommonattrResult0180_002') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("page-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + }.height(300) + } +} + + +@Entry +@Component +struct UIComponentCommonattrResult0180_2 { + @State showPopup:boolean = false + @State isShow:boolean = false + @State str :string = '' + + @Builder MyMenu1(){ + Menu() { + MenuItem(){ + TextInput().id('menu-textInput') + } + MenuItem(){ + Button('Menu内调用requestFocus传入textInput').onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("menu-textInput") + } catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + MenuItem(){ + Button('调用requestFocus传入page页textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("page-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + }.width('300').height(300) + } + + @State textValue: string = '' + onCancel() {} + onAccept() {} + exitApp() {} + + radioIndex = 0; + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: UIComponentCommonattrResult0180({ + cancel: this.onCancel, + confirm: this.onAccept + }), + autoCancel: true, + alignment: DialogAlignment.Center, + offset: { dx: 0, dy: 0 }, + // gridCount: 4, + customStyle: false + }) + + + + @Builder myBuilder() { + Column() { + TextInput().id('ContentCover-textInput') + Button('半模态框内调用requestFocus传入textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("ContentCover-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } }) + Button('调用requestFocus传入page页textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("page-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + .width('100%') + .height('100%') + .justifyContent(FlexAlign.Center) + } + + build() { + Scroll() { + Column({ space: 10 }) { + Text(this.str).fontSize(10) + TextInput().id('page-textInput') + Button('bindMenu') + .bindMenu(this.MyMenu1, { showInSubWindow: true }) + + Button('page页调用requestFocus传入Menu内textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("menu-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + + + Button("openDialog") + .width('100%') + .height(40) + .onClick(() => { + this.dialogController?.open() + }) + Button('page页调用requestFocus传入Dialog内textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("dialog-textInput") + } + catch (error) { + this.str = ' requestFocus failed code is ' + error.code + ' message is ' + error.message + } + }) + Button("bindContentCover") + .id('UIComponentCommonattrResult0180_001') + .onClick(() => { + this.isShow = true + }) + .fontSize(20) + .margin(10) + .bindContentCover(this.isShow, this.myBuilder(), { + modalTransition: ModalTransition.NONE, + backgroundColor: Color.Pink, + }) + Button('page页调用requestFocus传入全模态页面内textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("ContentCover-textInput") + } + catch (error) { + console.error('requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + + } + } + .width('100%') + .height('100%') + .align(Alignment.Top) + } + + pageTransition() { + // 适配自动化,设置页面转场无动画 + PageTransitionEnter({ type: RouteType.Push, duration: 0 }) + PageTransitionExit({ type: RouteType.Push, duration: 0 }) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0190.ets new file mode 100644 index 0000000000000000000000000000000000000000..0b4baac9a8017dd0e6c50fe0728a96bff22873c3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0190.ets @@ -0,0 +1,198 @@ +/* + * Copyright (C) 2024 Huawei Device 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. + */ + +@CustomDialog +struct UIComponentCommonattrResult0190 { + + controllerTwo?: CustomDialogController + cancel: () => void = () => { + } + confirm: () => void = () => { + } + build() { + Column({space:10}) { + + TextInput({text:'TextInput'}).height(50).id('dialog-textInput') + Button('Dialog内调用requestFocus传入textInput').onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("dialog-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + Button('调用requestFocus传入page页textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("page-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + }.height(300) + } +} + + +@Entry +@Component +struct UIComponentCommonattrResult0190_2 { + @State showPopup:boolean = false + @State isShow:boolean = false + @State str :string = '' + + @Builder MyMenu1(){ + Menu() { + MenuItem(){ + TextInput().id('menu-textInput') + } + MenuItem(){ + Button('Menu内调用requestFocus传入textInput').onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("menu-textInput") + } catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + MenuItem(){ + Button('调用requestFocus传入page页textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("page-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + }.width('300').height(300) + } + + @State textValue: string = '' + onCancel() {} + onAccept() {} + exitApp() {} + + radioIndex = 0; + dialogController: CustomDialogController | null = new CustomDialogController({ + builder: UIComponentCommonattrResult0190({ + cancel: this.onCancel, + confirm: this.onAccept + }), + autoCancel: true, + alignment: DialogAlignment.Center, + offset: { dx: 0, dy: 0 }, + customStyle: false + }) + + + + @Builder myBuilder() { + Column() { + TextInput().id('ContentCover-textInput') + Button('半模态框内调用requestFocus传入textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("ContentCover-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } }) + Button('调用requestFocus传入page页textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("page-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + } + .width('100%') + .height('100%') + .justifyContent(FlexAlign.Center) + } + + build() { + Scroll() { + Column({ space: 10 }) { + Text(this.str).fontSize(10) + TextInput().id('page-textInput') + Button('bindMenu') + .bindMenu(this.MyMenu1, { showInSubWindow: true }) + + Button('page页调用requestFocus传入Menu内textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("menu-textInput") + } + catch (error) { + console.error(' requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + + + Button("openDialog") + .width('100%') + .height(40) + .onClick(() => { + this.dialogController?.open() + }) + Button('page页调用requestFocus传入Dialog内textInput') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("dialog-textInput") + } + catch (error) { + this.str = ' requestFocus failed code is ' + error.code + ' message is ' + error.message + } + }) + Button("bindContentCover") + .onClick(() => { + this.isShow = true + }) + .fontSize(20) + .margin(10) + .bindContentCover(this.isShow, this.myBuilder(), { + modalTransition: ModalTransition.NONE, + backgroundColor: Color.Pink, + }) + Button('page页调用requestFocus传入全模态页面内textInput') + .id('UIComponentCommonattrResult0190_001') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("ContentCover-textInput") + } + catch (error) { + this.str = 'requestFocus failed code is ' + error.code + ' message is ' + error.message + } + }) + + } + } + .width('100%') + .height('100%') + .align(Alignment.Top) + } + + pageTransition() { + // 适配自动化,设置页面转场无动画 + PageTransitionEnter({ type: RouteType.Push, duration: 0 }) + PageTransitionExit({ type: RouteType.Push, duration: 0 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0200.ets new file mode 100644 index 0000000000000000000000000000000000000000..a05a212605c0b793b305fb75e7fdb4457786726e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0200.ets @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0200 { + @State showPopup: boolean = false + @State str: string = '' + + build() { + Column({ space: 2 }) { + Text(this.str).fontSize(10) + TextInput().id('textInput') + Button("RequestFocus") + .fontColor(Color.White) + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("textInput") + } + catch (error) { + console.error('ljx requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + Button("RequestFocus2") + .fontColor(Color.White) + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("btn2") + } + catch (error) { + console.error('ljx requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + Button("调用requestFocus传入pageOne页面内textInput") + .fontColor(Color.White) + .id('UIComponentCommonattrResult0200_001') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("textInput") + } + catch (error) { + this.str = ' requestFocus failed code is ' + error.code + ' message is ' + error.message + } + }) + } + .width(300) + .height(300) + .padding(5) + .onFocus(() => { + console.log(`ljx popup is onFocused`) + }) + .onBlur(() => { + console.log(`ljx popup is onBlur`) + }) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0220.ets new file mode 100644 index 0000000000000000000000000000000000000000..c46f7344ec99cd40b9837fdeae4e5427e646c603 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0220.ets @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0220 { + @State text: string = '' + @State mode: NavigationMode = NavigationMode.Split + @Provide('pageInfos') pageInfos: NavPathStack = new NavPathStack() + + @Builder + PageMap(name: string) { + if (name === 'pageOne') { + pageOne() + } else if (name === 'pageTwo') { + pageTwo() + } + } + + build() { + Scroll() { + Navigation(this.pageInfos) { + Column() { + TextInput().id('navbar-TextInput') + Button('调用requestFocus传入pageOne页面内textInput').onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("pageOne-TextInput") + } + catch (error) { + console.error('requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + Button('跳转到pageOne页面').onClick(() => { + this.pageInfos.pushPath({ name: 'pageOne' }) + }) + Button('跳转到pageTwo页面') + .id('UIComponentCommonattrResult0220_001') + .onClick(() => { + this.pageInfos.pushPath({ name: 'pageTwo' }) + }) + + } + } + .mode(this.mode) + .title("main") + .navDestination(this.PageMap) + + } + } +} + +// pageOne.ets +@Component +export struct pageOne { + @Consume('pageInfos') pageInfos: NavPathStack; + @State text: string = '' + + build() { + Scroll() { + NavDestination() { + Column() { + TextInput().id('pageOne-TextInput') + Button('调用requestFocus传入navbar中的textInput').onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("navbar-TextInput") + } + catch (error) { + console.error('requestFocus failed code is ' + error.code + ' message is ' + error.message) + } + }) + + }.width('100%').height('100%') + }.title('pageOne') + } + } +} + +// pageTwo.ets +@Component +export struct pageTwo { + @Consume('pageInfos') pageInfos: NavPathStack; + @State text: string = '' + @State str: string = '' + + build() { + Scroll() { + NavDestination() { + Column() { + Text(this.str).fontSize(10) + Button('调用requestFocus传入pageOne页面内textInput') + .id('UIComponentCommonattrResult0220_002') + .onClick(() => { + try { + this.getUIContext().getFocusController().requestFocus("pageOne-TextInput") + } + catch (error) { + this.str = 'requestFocus failed code is ' + error.code + ' message is ' + error.message + } + }) + }.width('100%').height('100%') + }.title('pageTwo') + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0230.ets new file mode 100644 index 0000000000000000000000000000000000000000..d843a63238115d125c9a49c266cc35034b3cc62e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0230.ets @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0230 { + @State fontColor: string = '#182431' + @State selectedFontColor: string = '#007DFF' + @State currentIndex: number = 0 + @State selectedIndex: number = 0 + private controller: TabsController = new TabsController() + + @Builder + tabBuilder(index: number, name: string) { + + } + build() { + Column({ space: 20 }) { + Button("Focus-btn4") + .id('UIComponentCommonattrResult0230_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150003' }) + } + + }) + Row({ space: 5 }) { + Tabs({ barPosition: BarPosition.Start, index: this.currentIndex, controller: this.controller }) { + TabContent() { + Column().width('100%').height('50%').backgroundColor('#00CB87') + }.tabBar(this.tabBuilder(0, 'green')) + + TabContent() { + Column().width('100%').height('50%').backgroundColor('#007DFF') + }.tabBar(this.tabBuilder(1, 'blue')).id('focus') + + } + } + + }.width('100%') + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0240.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b54dabb620658824c37f922afe29ca7fc428ab4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0240.ets @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0240 { + @State arr: number[] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + private listScroller: ListScroller = new ListScroller(); + @State flag: boolean = false; + build() { + Column({ space: 20 }) { + List({ space: 10, scroller: this.listScroller }) { + ForEach(this.arr, (item: number) => { + ListItem() { + Text("item_" + item) + .width('100%') + .height(100) + .textAlign(TextAlign.Center) + .backgroundColor(0xFFFFFF) + } + ListItem() { + Text("item_2_" + item) + .width('100%') + .height(100) + .textAlign(TextAlign.Center) + .backgroundColor(0xFFFFFF) + }.id('focus') + }, (item: string) => item) + } + .padding(10) + .backgroundColor(Color.Yellow) + .height(500) + Button("Focus-btn1").id('UIComponentCommonattrResult0240_001') + .width(200).height(70).fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150003' }) + } + + }) + }.width('100%') + } +} + + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0250.ets new file mode 100644 index 0000000000000000000000000000000000000000..29034b92de3dbcb1dc22be66363f949a441252a8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0250.ets @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License') + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UIComponentCommonattrResult0250 { + @State numbers: string[] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"] + + build() { + Column() { + Button("Focus-btn1") + .id('UIComponentCommonattrResult0250_001') + .width(200) + .height(70) + .fontColor(Color.White) + .onClick(() => { + let res = focusControl.requestFocus('focus') + if (res) { + this.getUIContext().getPromptAction().showToast({ message: 'focus success' }) + } else { + this.getUIContext().getPromptAction().showToast({ message: '150003' }) + } + + }) + Grid() { + GridItem() { + Text('4') + .fontSize(16) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + }.rowStart(1).rowEnd(2).columnStart(1).columnEnd(2) + } + .width('90%').height(300) + }.width('100%').margin({ top: 5 }) + } +} + diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0010.ets new file mode 100644 index 0000000000000000000000000000000000000000..78ef8fbf94e32d077e01dc28b7229a609bb08f16 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0010.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0010 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("Column_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为正数&离屏截图").id("UIComponentSnapshotAttribute0010_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..61533f94fc4318e6c56d78f481aeb5cdf22745ff --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0020.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0020 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 40 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("Column_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为0&离屏截图").id("UIComponentSnapshotAttribute0020_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..d2be06f45d7170341730913d687b6ccc907aca0a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0030.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0030 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("Column_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为负数&离屏截图").id("UIComponentSnapshotAttribute0030_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ead6ac1e83c7204b0ddf0b99612207dc6ca0bd4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0040.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0040 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("Column_001") + .height(this.buttonHeight) + } + + build() { + Column() { + Button("height设置为正数&离屏截图").id("UIComponentSnapshotAttribute0040_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..a1184d8b507b014454bdb12da63d6046755e982f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0050.ets @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0050 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 40 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("Column_001") + .height(this.buttonHeight) + .width(40) + } + + build() { + Column() { + Button("height设置为0&离屏截图").id("UIComponentSnapshotAttribute0050_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0060.ets new file mode 100644 index 0000000000000000000000000000000000000000..8705b954e2aaf25c94791090f4ffb9c090043d83 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0060.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0060 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0060_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0070.ets new file mode 100644 index 0000000000000000000000000000000000000000..331cae9331e3a7a2273c3a1366c04e25c00580bf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0070.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0070 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0070_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0080.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b10e9b9a3cac6c95e7aae6a71894b056503a169 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0080.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0080 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute0080_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0090.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b5b94bc2fa7f6c0770a58fea12d1b4e3d7e8584 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0090.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0090 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0090_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0100.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3f7203e3467c556d99e387d8c2f436b6038a9bb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0100.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0100 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0100_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0110.ets new file mode 100644 index 0000000000000000000000000000000000000000..24b99f5362009ea9ff3727df33ed89bd6222bf7d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0110.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0110 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute0110_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0120.ets new file mode 100644 index 0000000000000000000000000000000000000000..bc5ed2ae88ebb4fcbb1c14acd369bdd0695be3fd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0120.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0120 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0120_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0130.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d691f67b083ffab8627ad04f41e8880bb65e6b2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0130.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0130 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0130_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0140.ets new file mode 100644 index 0000000000000000000000000000000000000000..d949f2f4179472141f05cd13fe07bc3c22d743f2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0140.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0140 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute0140_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0150.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff0cd2c00af41d81c46730d080b14eb81dea57e1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0150.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0150 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0150_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0160.ets new file mode 100644 index 0000000000000000000000000000000000000000..d406cb4256a9cf3001933ac36cdddf682777dea2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0160.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0160 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0160_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0170.ets new file mode 100644 index 0000000000000000000000000000000000000000..18fc582ae267e8508cf2c926be32c621cc36b067 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0170.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0170 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute0170_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0180.ets new file mode 100644 index 0000000000000000000000000000000000000000..f01eafd8b11112a442fc793b3c50ec5f9d18c478 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0180.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0180 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0180_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0190.ets new file mode 100644 index 0000000000000000000000000000000000000000..969fef7a4b28b203bdca16e4860e550be8728aaf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0190.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0190 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0190_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0200.ets new file mode 100644 index 0000000000000000000000000000000000000000..313ddea7fa082e00c34868a44f37e8254994503e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0200.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0200 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute0200_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0210.ets new file mode 100644 index 0000000000000000000000000000000000000000..9344e49423cbb8a0a1add82e4a1c0163172e5514 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0210.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0210 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0210_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0220.ets new file mode 100644 index 0000000000000000000000000000000000000000..29b2180abd42822c569bf9b6a9c0d88e40f4c694 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0220.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0220 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0220_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0230.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3bbecb83c3e0b0dfe544d7746fade908b16cb6b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0230.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0230 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute0230_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0240.ets new file mode 100644 index 0000000000000000000000000000000000000000..11a174f57daf65b365482cb80f92675f91b687b7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0240.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0240 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0240_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0250.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f824cd82f490e9cd839c5c965110d5430d1d219 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0250.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0250 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0250_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0260.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0260.ets new file mode 100644 index 0000000000000000000000000000000000000000..8b7cdc7252158b0b6b47b3a9290549ec5af4556b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0260.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0260 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为0&离屏截图").id("UIComponentSnapshotAttribute0260_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0270.ets new file mode 100644 index 0000000000000000000000000000000000000000..2045bc632fd863d21db270a506c6062715ef1cdb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0270.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0270 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0270_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0280.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a8b94df8b50f6bf49890f72a04012a59b6fd5fe --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0280.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0280 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0280_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0290.ets new file mode 100644 index 0000000000000000000000000000000000000000..67301a31b990466ac58c4b06c1ccaffa6455635c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0290.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0290 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为0&离屏截图").id("UIComponentSnapshotAttribute0290_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0300.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0eb7c6a1d214ec8edb21cd243c288c42941cf94 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0300.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0300 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0300_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0310.ets new file mode 100644 index 0000000000000000000000000000000000000000..9355c53276f1e86f11cdb3a43d210873ee091b10 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0310.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0310 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = -20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0310_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0320.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0320.ets new file mode 100644 index 0000000000000000000000000000000000000000..8aa44ec4576e3996f930943d5fed18d8633788db --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0320.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0320 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为0&离屏截图").id("UIComponentSnapshotAttribute0320_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0330.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0330.ets new file mode 100644 index 0000000000000000000000000000000000000000..6e8ab74fc47bfbe7d7d5195287a4d7a6ffe15246 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0330.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0330 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0330_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0340.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0340.ets new file mode 100644 index 0000000000000000000000000000000000000000..11e7578043ee09f4095727a27a4ac4d6e53486a4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0340.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0340 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为0&离屏截图").id("UIComponentSnapshotAttribute0340_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0350.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0350.ets new file mode 100644 index 0000000000000000000000000000000000000000..e7c9fbb51928073bffd03249194b97ecc8029746 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0350.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0350 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为0&离屏截图").id("UIComponentSnapshotAttribute0350_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0360.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0360.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5057b7d13a1e3a814e16e714cbf1c5894e6f073 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0360.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0360 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0360_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0370.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0370.ets new file mode 100644 index 0000000000000000000000000000000000000000..9cc578ab26666afe9ca61b159f06bbe994460e7a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0370.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0370 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = -20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0370_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0380.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0380.ets new file mode 100644 index 0000000000000000000000000000000000000000..58e2f2e7012514e593c7fce15849e27e631adc30 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0380.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0380 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为0&离屏截图").id("UIComponentSnapshotAttribute0380_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0390.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0390.ets new file mode 100644 index 0000000000000000000000000000000000000000..3375c0531d1ba73b7df62a6e0966eadb7e9a451b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0390.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0390 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0390_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0400.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0400.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b4ce4407c6f29eafd3b04792012955fe05ef619 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0400.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0400 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0400_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0410.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0410.ets new file mode 100644 index 0000000000000000000000000000000000000000..bc0f452499965b6aca611bc27d4134aa9f3cfd30 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0410.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0410 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为0&离屏截图").id("UIComponentSnapshotAttribute0410_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0420.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0420.ets new file mode 100644 index 0000000000000000000000000000000000000000..3dbec5ef70208ee0fedef6b7313c406408c83a42 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0420.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0420 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0420_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0430.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0430.ets new file mode 100644 index 0000000000000000000000000000000000000000..c137791657235d1599717d117218a976881b675e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0430.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0430 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为正数&离屏截图").id("UIComponentSnapshotAttribute0430_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0440.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0440.ets new file mode 100644 index 0000000000000000000000000000000000000000..1407a40f886b0bb9a841f63ba7f92db6e5511126 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0440.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0440 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 40 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为0&离屏截图").id("UIComponentSnapshotAttribute0440_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0450.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0450.ets new file mode 100644 index 0000000000000000000000000000000000000000..e68bcc710b48ecca32a3954729a82e8cc48077c2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0450.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0450 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为负数&离屏截图").id("UIComponentSnapshotAttribute0450_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0460.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0460.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ed4635f65a9460a246801f4f79223521f00b91e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0460.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0460 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .height(this.buttonHeight) + .width(40) + } + + build() { + Column() { + Button("height设置为正数&离屏截图").id("UIComponentSnapshotAttribute0460_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0470.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0470.ets new file mode 100644 index 0000000000000000000000000000000000000000..c96fceb2207cda954c19ccc21831209f10929c22 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0470.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0470 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 40 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .height(this.buttonHeight) + .width(40) + } + + build() { + Column() { + Button("height设置为0&离屏截图").id("UIComponentSnapshotAttribute0470_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0480.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0480.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d488ccd6903c4846f7914a842ea9be03c2059d2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0480.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0480 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .height(this.buttonHeight) + .width(40) + } + + build() { + Column() { + Button("height设置为负数&离屏截图").id("UIComponentSnapshotAttribute0480_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0490.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0490.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ee58776e2fb0ee2bc875c6726e37f868f31823f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0490.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0490 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0490_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0500.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0500.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2ffad2c6bc7d1a0383bdc7bd9639c7cb460f05f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0500.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0500 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute0500_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0510.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0510.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6e50d454ab4058354a10b9dc31d446b00ec5ddd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0510.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0510 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0510_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0520.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0520.ets new file mode 100644 index 0000000000000000000000000000000000000000..f108c336367ffb55051c005e0bbc7eac3cd3d419 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0520.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0520 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0520_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0530.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0530.ets new file mode 100644 index 0000000000000000000000000000000000000000..034825cbae135e0a7257199cad749e6731103541 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0530.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0530 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute0530_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0540.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0540.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4db1ff89e85ef0512a7fc74114cc7a9dc771998 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0540.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0540 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0540_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0550.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0550.ets new file mode 100644 index 0000000000000000000000000000000000000000..39bedf2dc7da66073362592ca5a167f514b972d2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0550.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0550 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0550_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0560.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0560.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddf2e67de54de1cd9a62af8c0c77c22305390e55 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0560.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0560 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute0560_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0570.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0570.ets new file mode 100644 index 0000000000000000000000000000000000000000..b234c81b620c997a204a427845484bf85aba6bbd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0570.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0570 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0570_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0580.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0580.ets new file mode 100644 index 0000000000000000000000000000000000000000..b33ee314da0fb6b610c057ae3d5a2b6e10cf4515 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0580.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0580 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0580_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0590.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0590.ets new file mode 100644 index 0000000000000000000000000000000000000000..0de6a3656213ddfa8f6cd0feac501453c7e1ba56 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0590.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0590 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute0590_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0600.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0600.ets new file mode 100644 index 0000000000000000000000000000000000000000..90748e300c8f843862c6d18c6c73bdad7c9619b4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0600.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0600 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + Text("组件") + } + .id("column_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0600_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0610.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0610.ets new file mode 100644 index 0000000000000000000000000000000000000000..161f942ac614a8a88536b747e211ecc514ddafa5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0610.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0610 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0610_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0620.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0620.ets new file mode 100644 index 0000000000000000000000000000000000000000..41e7680329facb72db6b1e2c0db24ad065841a89 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0620.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0620 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute0620_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0630.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0630.ets new file mode 100644 index 0000000000000000000000000000000000000000..d786e46f554329d45790a36a75a1e5c6b54ddfbb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0630.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0630 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0630_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0640.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0640.ets new file mode 100644 index 0000000000000000000000000000000000000000..c488892037f1515dc5cba682919c067bbc5f337c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0640.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0640 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0640_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0650.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0650.ets new file mode 100644 index 0000000000000000000000000000000000000000..b02f1a5fe2842e8f106c6979e6238cefb71fb4cb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0650.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0650 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute0650_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0660.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0660.ets new file mode 100644 index 0000000000000000000000000000000000000000..4bdc6efcd90de790a858ee4e04a0dff747fb7fa3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0660.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0660 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0660_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0670.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0670.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ca1f9ebd80b8d9a6ae7273a32e1db1177474332 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0670.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0670 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = -20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0670_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0680.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0680.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd4e3c822d711e8ef46864a370505cc64afb6fdc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0680.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0680 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为0&离屏截图").id("UIComponentSnapshotAttribute0680_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0690.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0690.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ee5e1922935851064d074a6fed113cec087471d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0690.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0690 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0690_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0700.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0700.ets new file mode 100644 index 0000000000000000000000000000000000000000..54aa6816e28f5d3820276fcd6d0ac9096198418e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0700.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0700 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0700_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0710.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0710.ets new file mode 100644 index 0000000000000000000000000000000000000000..58820a94ab1e5a7345d577167d73b0d0cd919424 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0710.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0710 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为0&离屏截图").id("UIComponentSnapshotAttribute0710_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0720.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0720.ets new file mode 100644 index 0000000000000000000000000000000000000000..52ec60297ba5f92c949602f48bf9fdf0a910b4c4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0720.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0720 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0720_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0730.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0730.ets new file mode 100644 index 0000000000000000000000000000000000000000..291d9c1297d8d33218c9c54468c440739309cb05 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0730.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0730 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = -20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0730_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0740.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0740.ets new file mode 100644 index 0000000000000000000000000000000000000000..c66cde48bb7a294be8b73db08b5bfec6449b4c75 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0740.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0740 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为0&离屏截图").id("UIComponentSnapshotAttribute0740_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0750.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0750.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0fd8df2868dd9187d59a0f7e25fae95acb0aec8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0750.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0750 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0750_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0760.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0760.ets new file mode 100644 index 0000000000000000000000000000000000000000..58727511abaf20852103caed54f7fe6956b1d27d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0760.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0760 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0760_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0770.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0770.ets new file mode 100644 index 0000000000000000000000000000000000000000..f33551ff4defcdbcce1228e99bf28d805a6757cd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0770.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0770 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为0&离屏截图").id("UIComponentSnapshotAttribute0770_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0780.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0780.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b1d38c0a2f481199d04cd9d362c451f8df207cd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0780.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0780 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0780_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0790.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0790.ets new file mode 100644 index 0000000000000000000000000000000000000000..b560900ab64c8e5eb6035539a7cfe9517ef9cadd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0790.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0790 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = -20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0790_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0800.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0800.ets new file mode 100644 index 0000000000000000000000000000000000000000..02effe43b1c85b42ca042d61cc85dae3b7bddd05 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0800.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0800 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为0&离屏截图").id("UIComponentSnapshotAttribute0800_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0810.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0810.ets new file mode 100644 index 0000000000000000000000000000000000000000..9a5d8121750f0a9fa543791f3220e101a5b0e5a8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0810.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0810 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0810_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0820.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0820.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e2f6946649d9c0e7ddfa1a107c91cb648984b70 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0820.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0820 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0820_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0830.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0830.ets new file mode 100644 index 0000000000000000000000000000000000000000..26f2b0416f43fa3f1b7a597018ed95ba6c7b3938 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0830.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0830 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为0&离屏截图").id("UIComponentSnapshotAttribute0830_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0840.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0840.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8c8631559776135fb1fe329dd62f6f4070f06d4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0840.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0840 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Text("组件") + .id("text_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0840_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("text_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0850.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0850.ets new file mode 100644 index 0000000000000000000000000000000000000000..42a4ba87a62a842a3bb7876887a63ecffb7af2bf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0850.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0850 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为正数&离屏截图").id("UIComponentSnapshotAttribute0850_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0860.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0860.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb0830f7a6934099c940cfbb5131a863197b0f61 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0860.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0860 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 40 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为0&离屏截图").id("UIComponentSnapshotAttribute0860_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0870.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0870.ets new file mode 100644 index 0000000000000000000000000000000000000000..46816ff4e5df5b2cac2f98df6769a9d600538968 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0870.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0870 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为负数&离屏截图").id("UIComponentSnapshotAttribute0870_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0880.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0880.ets new file mode 100644 index 0000000000000000000000000000000000000000..b59e4452842ccd9a36f67d563c27da7bf7638826 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0880.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0880 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .height(this.buttonHeight) + } + + build() { + Column() { + Button("height设置为正数&离屏截图").id("UIComponentSnapshotAttribute0880_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0890.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0890.ets new file mode 100644 index 0000000000000000000000000000000000000000..06f924783887cfafa3c48b944dbeb33497bc9dd5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0890.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0890 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 40 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .height(this.buttonHeight) + .width(40) + } + + build() { + Column() { + Button("height设置为0&离屏截图").id("UIComponentSnapshotAttribute0890_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0900.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0900.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f86916971fdde57037668fa494429264a866037 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0900.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0900 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .height(this.buttonHeight) + } + + build() { + Column() { + Button("height设置为负数&离屏截图").id("UIComponentSnapshotAttribute0900_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0910.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0910.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee346378f065fa37fd294b5069414ab7ad9bf9cf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0910.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0910 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0910_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0920.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0920.ets new file mode 100644 index 0000000000000000000000000000000000000000..7602230bafe6daec6cc03411441e03febe8d2e69 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0920.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0920 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute0920_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0930.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0930.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a87938184990285d105c1594b1d8272d0b991ad --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0930.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0930 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute0930_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0940.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0940.ets new file mode 100644 index 0000000000000000000000000000000000000000..5662a3856fa3c8f1d060876bf144140eff730c55 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0940.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0940 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute0940_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0950.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0950.ets new file mode 100644 index 0000000000000000000000000000000000000000..b675353865022619d7747243ed1f8632c3043d9f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0950.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0950 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute0950_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0960.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0960.ets new file mode 100644 index 0000000000000000000000000000000000000000..6dd539dfa1c4a8a65e379ef18f1596f08bcf1064 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0960.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0960 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute0960_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0970.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0970.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf28c0c32e48f740036af1231179bcef2e50e5a1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0970.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0970 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute0970_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0980.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0980.ets new file mode 100644 index 0000000000000000000000000000000000000000..2f7b0d460268bd0f47958d0d1ad5f54bc850b4a7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0980.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute0980 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute0980_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0990.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0990.ets new file mode 100644 index 0000000000000000000000000000000000000000..177f93ff2565652f51b7ad1534b68a51cacfa2c7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0990.ets @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2024 Huawei Device 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 componentUtils from '@ohos.arkui.componentUtils'; + + +@Entry +@Component +struct UIComponentSnapshotAttribute0990 { + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + build() { + Column() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + + Grid() { + GridItem() { + Button("windowoffset设置x为负数").onClick(() => { + this.positionX = -40 + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + .id("UIComponentSnapshotAttribute0990_001") + } + } + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1000.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1000.ets new file mode 100644 index 0000000000000000000000000000000000000000..a3595a23204913f223aa331f340e228464842303 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1000.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1000 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1000_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1010.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c2d2d63f5476b5a324ea6956b4dffcce7b974ee --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1010.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1010 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute1010_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1020.ets new file mode 100644 index 0000000000000000000000000000000000000000..8a6282104ca7456ae62e4c0f034cb13d1e600ab1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1020.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1020 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1020_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1030.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a421f685e34f891c6dd853dce297bf88644c500 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1030.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1030 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1030_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1040.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f0bd64aace317aa4f095520389baa23192ef173 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1040.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1040 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute1040_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1050.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fa820c7216985db312c0056f7de68968a4c34f4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1050.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1050 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1050_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1060.ets new file mode 100644 index 0000000000000000000000000000000000000000..c8284c522b41398aaf0fcc8da5161ee4131dfab0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1060.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1060 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1060_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1070.ets new file mode 100644 index 0000000000000000000000000000000000000000..cdf073ba90ddc8c731727f2054e3baba59911986 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1070.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1070 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute1070_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1080.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba30e8aaeedb0da0cbbd744b0d46dfd9bde8859f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1080.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1080 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1080_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1090.ets new file mode 100644 index 0000000000000000000000000000000000000000..830997f6889045dd6cfeb40087eba7bf2d3b6ae6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1090.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1090 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = -20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1090_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1100.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b4df738ed1a60364e4e86bb70e0127260a61a80 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1100.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1100 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为0&离屏截图").id("UIComponentSnapshotAttribute1100_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1110.ets new file mode 100644 index 0000000000000000000000000000000000000000..7df4bba8e73d0b44fa7118b7f235924e94bcb76e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1110.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1110 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1110_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1120.ets new file mode 100644 index 0000000000000000000000000000000000000000..f16a677716812fa60d2a81f6918d96defd394470 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1120.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1120 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1120_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1130.ets new file mode 100644 index 0000000000000000000000000000000000000000..bac53b0654bd3f8b6c79bf953a6cd2405e2f116e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1130.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1130 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为0&离屏截图").id("UIComponentSnapshotAttribute1130_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1140.ets new file mode 100644 index 0000000000000000000000000000000000000000..d2e887b889b24fd8b556a6c757fdde09c8a0f08e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1140.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1140 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1140_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1150.ets new file mode 100644 index 0000000000000000000000000000000000000000..0abf3801a6fff87a2f8991f3adf43895a1072889 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1150.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1150 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = -20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1150_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1160.ets new file mode 100644 index 0000000000000000000000000000000000000000..88e1ebfaca9141aa9191ca7d567c5c898bc360e9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1160.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1160 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为0&离屏截图").id("UIComponentSnapshotAttribute1160_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1170.ets new file mode 100644 index 0000000000000000000000000000000000000000..826891999ab9b9e1dd3531ec95f66437fe6199be --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1170.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1170 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1170_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1180.ets new file mode 100644 index 0000000000000000000000000000000000000000..caba84234b4e5379e7cad5ce65fce5199f401b10 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1180.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1180 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1180_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1190.ets new file mode 100644 index 0000000000000000000000000000000000000000..2f5448411fb41615f5ae6ce58e0933e5b2e7fdce --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1190.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1190 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为0&离屏截图").id("UIComponentSnapshotAttribute1190_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1200.ets new file mode 100644 index 0000000000000000000000000000000000000000..d698633c960c409a5e6f7661444e765ac5fe9d1e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1200.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1200 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1200_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1210.ets new file mode 100644 index 0000000000000000000000000000000000000000..06e653983ce00adbc49d63f89ce3a9d303d120b7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1210.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1210 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1210_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1220.ets new file mode 100644 index 0000000000000000000000000000000000000000..57c325ff6a7a1cc8a25793dfede8e9bb960e8750 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1220.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1220 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为0&离屏截图").id("UIComponentSnapshotAttribute1220_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1230.ets new file mode 100644 index 0000000000000000000000000000000000000000..7377c2fa7e01c6f54b917d801473d283af146976 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1230.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1230 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1230_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1240.ets new file mode 100644 index 0000000000000000000000000000000000000000..b777a1bdb9b73b1bfec9b88f02b6bc719c96d468 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1240.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1240 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1240_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1250.ets new file mode 100644 index 0000000000000000000000000000000000000000..d5d9b67f5b9b69ea38a40635cba383c1a401a56c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1250.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1250 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为0&离屏截图").id("UIComponentSnapshotAttribute1250_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1260.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1260.ets new file mode 100644 index 0000000000000000000000000000000000000000..f9956222fd9d751f1f6c2a690d9208d6623879cb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1260.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1260 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Button("组件") + .id("Button_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1260_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("Button_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1270.ets new file mode 100644 index 0000000000000000000000000000000000000000..4e6d0c6888ef0591bab414114e1c676186d06842 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1270.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1270 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为正数&离屏截图").id("UIComponentSnapshotAttribute1270_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1280.ets new file mode 100644 index 0000000000000000000000000000000000000000..adc90b01282eb123f3ef899c794b56865d2fa19f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1280.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1280 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 40 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为0&离屏截图").id("UIComponentSnapshotAttribute1280_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1290.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5ac0fb4d5479a880fe30028b195e46570737085 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1290.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1290 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .width(this.buttonWidth) + } + + build() { + Column() { + Button("width设置为负数&离屏截图").id("UIComponentSnapshotAttribute1290_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1300.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4c1dc162c5a82ed1c0acd72a16b508f2b80150c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1300.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1300 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .height(this.buttonHeight) + } + + build() { + Column() { + Button("height设置为正数&离屏截图").id("UIComponentSnapshotAttribute1300_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1310.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c2cfd079b83aa44bb8168c891fe1bfe5a7db294 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1310.ets @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1310 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 40 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .height(this.buttonHeight) + .width(40) + } + + build() { + Column() { + Button("height设置为0&离屏截图").id("UIComponentSnapshotAttribute1310_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1320.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1320.ets new file mode 100644 index 0000000000000000000000000000000000000000..93c9fc25a739d44c4194284d84dcf1d60c324909 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1320.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1320 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .height(this.buttonHeight) + } + + build() { + Column() { + Button("height设置为负数&离屏截图").id("UIComponentSnapshotAttribute1320_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1330.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1330.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2a0327a0f85a91c1155d032830ce6472139157c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1330.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1330 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1330_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1340.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1340.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f3772cff005e2ec99f1facd5a3b7084b9f46f57 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1340.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1340 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute1340_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1350.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1350.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1a338c6fe212d8db44c66b61d0176ce3e67e45b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1350.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1350 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1350_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1360.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1360.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8c3c91d3e95125fa7bbc599ae8597af362d0e46 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1360.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1360 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1360_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1370.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1370.ets new file mode 100644 index 0000000000000000000000000000000000000000..be905ffea34991187bd3632ef1f5271bc31038ea --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1370.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1370 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute1370_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1380.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1380.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff8925b095e9c2d83160a8059636837491e65e27 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1380.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1380 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1380_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1390.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1390.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8581d9b0a761a432f308e0240679a6690c6d79b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1390.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1390 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1390_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1400.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1400.ets new file mode 100644 index 0000000000000000000000000000000000000000..6baac010ecd7fa72b8dc5139ebf7a3ba51292752 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1400.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1400 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute1400_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1410.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1410.ets new file mode 100644 index 0000000000000000000000000000000000000000..f0376a4d0a143c819cbf8fb66a1a7c77dbb874b0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1410.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1410 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1410_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1420.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1420.ets new file mode 100644 index 0000000000000000000000000000000000000000..98bf6b78ed7153df654603555371f6dc427b090d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1420.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1420 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1420_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1430.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1430.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa079a3fe4918387eb6c0501018563292f621ac8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1430.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1430 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute1430_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1440.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1440.ets new file mode 100644 index 0000000000000000000000000000000000000000..122de990fbf6f167328953d5a335dc65e024ab82 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1440.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1440 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1440_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1450.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1450.ets new file mode 100644 index 0000000000000000000000000000000000000000..c24dc7e4f8a54a1f4efa66fc57467f2379f16d37 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1450.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1450 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1450_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1460.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1460.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9ff201f777afcffaadf5f0e41db808e12a32cdb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1460.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1460 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute1460_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1470.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1470.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ffc3deb724d02e989828531d0ba7e754d5b1e78 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1470.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1470 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1470_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1480.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1480.ets new file mode 100644 index 0000000000000000000000000000000000000000..d7de922b6a960f311c395505c6275617c6a163bc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1480.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1480 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1480_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1490.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1490.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f171a374bafbd9c9eab506c9d5c1ebd2fd1b4a4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1490.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1490 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute1490_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1500.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1500.ets new file mode 100644 index 0000000000000000000000000000000000000000..ca54f8b386f3da460f92bc47c164f64bd4747306 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1500.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1500 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1500_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1510.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1510.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd6c2b728cb1b740ac5cf115a112d8f4f8619faf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1510.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1510 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = -20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1510_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1520.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1520.ets new file mode 100644 index 0000000000000000000000000000000000000000..28350a6c55960e77cf1bf81acf30bb197601043b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1520.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1520 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为0&离屏截图").id("UIComponentSnapshotAttribute1520_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1530.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1530.ets new file mode 100644 index 0000000000000000000000000000000000000000..da770e73565de53f5842e61e8375e51e2ed2a9cd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1530.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1530 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1530_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1540.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1540.ets new file mode 100644 index 0000000000000000000000000000000000000000..1054c6e262591d6fdbfd59f8a0d66bae3961f311 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1540.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1540 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1540_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1550.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1550.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6f88ff2cb0997e1bc65e0450525f915fe38e205 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1550.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1550 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为0&离屏截图").id("UIComponentSnapshotAttribute1550_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1560.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1560.ets new file mode 100644 index 0000000000000000000000000000000000000000..23d69db7a69b27dfa59e83da6d0ed918f071ce09 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1560.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1560 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1560_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1570.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1570.ets new file mode 100644 index 0000000000000000000000000000000000000000..a76a74fa9f29ba9da0fdf93122264d5c91a67633 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1570.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1570 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = -20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1570_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1580.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1580.ets new file mode 100644 index 0000000000000000000000000000000000000000..d5fbc50afda34c64382965aa557e14e176e80d9d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1580.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1580 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为0&离屏截图").id("UIComponentSnapshotAttribute1580_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1590.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1590.ets new file mode 100644 index 0000000000000000000000000000000000000000..8a84131959259324301b67dde824a32451d65902 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1590.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1590 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1590_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1600.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1600.ets new file mode 100644 index 0000000000000000000000000000000000000000..696be8bd68c286f01ec83399a24031ca82d70d70 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1600.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1600 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1600_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1610.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1610.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ae1a6bd463dc50f81c342626b16560d51d27674 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1610.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1610 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为0&离屏截图").id("UIComponentSnapshotAttribute1610_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1620.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1620.ets new file mode 100644 index 0000000000000000000000000000000000000000..5566df7ac62968fe6ecd1b9675660ac6097d12ca --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1620.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1620 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1620_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1630.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1630.ets new file mode 100644 index 0000000000000000000000000000000000000000..0046e6ed35b28409f36a0c45cf1b95136532ed5c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1630.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1630 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = -20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1630_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1640.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1640.ets new file mode 100644 index 0000000000000000000000000000000000000000..a6179e592cc50185ae2436eee9e908ee3929bec2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1640.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1640 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为0&离屏截图").id("UIComponentSnapshotAttribute1640_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1650.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1650.ets new file mode 100644 index 0000000000000000000000000000000000000000..a91de9d4e947228cfe3af5272290be648b53ef36 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1650.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1650 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1650_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1660.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1660.ets new file mode 100644 index 0000000000000000000000000000000000000000..bf8a4bb9251d035347d1bbfe6e178215c57a051a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1660.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1660 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1660_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1670.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1670.ets new file mode 100644 index 0000000000000000000000000000000000000000..4de5b560099da681ff5bac91bbefd5c72677693a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1670.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1670 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为0&离屏截图").id("UIComponentSnapshotAttribute1670_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1680.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1680.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e12e3d65f47e42251761bd534048fec5083f75c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1680.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1680 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Row() { + Text("组件") + } + .id("row_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1680_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("row_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1690.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1690.ets new file mode 100644 index 0000000000000000000000000000000000000000..7246899b97aea69d4c75000b88d24b806bc83de7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1690.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1690 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width(this.buttonWidth) + .height('100%') + .id("actionSheet_001") + + } + + build() { + Column() { + Button("width设置为正数&离屏截图").id("UIComponentSnapshotAttribute1690_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.buttonWidth = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1700.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1700.ets new file mode 100644 index 0000000000000000000000000000000000000000..0933243db3335a599daae50301cb5faa55c85499 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1700.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1700 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width(this.buttonWidth) + .height('100%') + .id("actionSheet_001") + + } + + build() { + Column() { + Button("width设置为0&离屏截图").id("UIComponentSnapshotAttribute1700_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.buttonWidth = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1710.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1710.ets new file mode 100644 index 0000000000000000000000000000000000000000..3eed70c197cde53d8d22cf7d70729db40f15a2ba --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1710.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1710 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width(this.buttonWidth) + .height('100%') + .id("actionSheet_001") + + } + + build() { + Column() { + Button("width设置为负数&离屏截图").id("UIComponentSnapshotAttribute1710_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.buttonWidth = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1720.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1720.ets new file mode 100644 index 0000000000000000000000000000000000000000..13e57a40239c52488fb40e90dde38d00e0ebbb20 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1720.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1720 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height(this.buttonHeight) + .id("actionSheet_001") + + } + + build() { + Column() { + Button("height设置为正数&离屏截图").id("UIComponentSnapshotAttribute1720_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.buttonHeight = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1730.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1730.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7078e0363289d97f4e8f4e4ddb1bf1fda83577c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1730.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1730 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height(this.buttonHeight) + .id("actionSheet_001") + + } + + build() { + Column() { + Button("height设置为0&离屏截图").id("UIComponentSnapshotAttribute1730_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.buttonHeight = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1740.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1740.ets new file mode 100644 index 0000000000000000000000000000000000000000..acb5c37cb8a297aa1a69d07c8a8f439a30140288 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1740.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1740 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height(this.buttonHeight) + .id("actionSheet_001") + + } + + build() { + Column() { + Button("height设置为负数&离屏截图").id("UIComponentSnapshotAttribute1740_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.buttonHeight = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1750.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1750.ets new file mode 100644 index 0000000000000000000000000000000000000000..41445d27a77f9855e45c45956a30472070a9ebc4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1750.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1750 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("localoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1750_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1760.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1760.ets new file mode 100644 index 0000000000000000000000000000000000000000..eeb637ec6ae512855a8380f7ec9464b95fa63941 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1760.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1760 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("localoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute1760_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1770.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1770.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff4728c1e170b12cb5a5a1236dc4047f5f46b706 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1770.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1770 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("localoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1770_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1780.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1780.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2aaf7eb745b0d2e541c327f37a233add8f585ca --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1780.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1780 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("localoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1780_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1790.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1790.ets new file mode 100644 index 0000000000000000000000000000000000000000..49e4423d7a464c354bdc2fed703450d1cc8f5834 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1790.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1790 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("localoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute1790_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1800.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1800.ets new file mode 100644 index 0000000000000000000000000000000000000000..bac8227099dba99eb7e3b7c299d19d1b7a9f60cc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1800.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1800 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("localoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1800_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1810.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1810.ets new file mode 100644 index 0000000000000000000000000000000000000000..87706f06f914b44b62029a0a8778578c7da7079a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1810.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1810 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("windowsoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1810_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1820.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1820.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec248c65b4d96f4efaaf993d3895aff8f3cef164 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1820.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1820 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("windowsoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute1820_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1830.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1830.ets new file mode 100644 index 0000000000000000000000000000000000000000..8ad9eb8078bee54e6b3169b29e0d13b0648b6f1d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1830.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1830 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("windowsoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1830_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1840.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1840.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d353f95aa9fca8939bf696e23cca9abcfecfd09 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1840.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1840 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("windowsoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1840_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1850.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1850.ets new file mode 100644 index 0000000000000000000000000000000000000000..8353ac3cf47e5177385bd0518f1f0810bf9a3f48 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1850.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1850 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("windowsoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute1850_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1860.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1860.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f5a59f28b29500f064985687878b7d392712e2d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1860.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1860 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("windowsoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1860_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1870.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1870.ets new file mode 100644 index 0000000000000000000000000000000000000000..df85bb48e809f8cace581d2f11f9e8f459e40e68 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1870.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1870 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("screenoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1870_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1880.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1880.ets new file mode 100644 index 0000000000000000000000000000000000000000..19e6cb681d079dbc65d673752b5251607c55be76 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1880.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1880 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("screenoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute1880_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1890.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1890.ets new file mode 100644 index 0000000000000000000000000000000000000000..e57c0e9025fb083f2ca980fc659aa34433fa08cf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1890.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1890 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("screenoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1890_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1900.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1900.ets new file mode 100644 index 0000000000000000000000000000000000000000..627baec46a1a0bac337e205721a5976103ff04f0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1900.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1900 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("screenoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1900_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1910.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1910.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c767aea69db90221cd40e91252d177512e73cb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1910.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1910 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("screenoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute1910_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1920.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1920.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f406a2cbaa47ef2aa0cb419c9a1dc20172e91af --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1920.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1920 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .position({ x: this.positionX, y: this.positionY }) + + } + + build() { + Column() { + Button("screenoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1920_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1930.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1930.ets new file mode 100644 index 0000000000000000000000000000000000000000..65399f7b2381eb26b9f96d17b977b9233bccfb29 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1930.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1930 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = -20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .translate({ x: this.translateX, y: this.translateY }) + + } + + build() { + Column() { + Button("translate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1930_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.translateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1940.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1940.ets new file mode 100644 index 0000000000000000000000000000000000000000..93e6c7debe2a96e68cf3ea4d9fc403a51edaf5f9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1940.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1940 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .translate({ x: this.translateX, y: this.translateY }) + + } + + build() { + Column() { + Button("translate设置x为0&离屏截图").id("UIComponentSnapshotAttribute1940_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.translateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1950.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1950.ets new file mode 100644 index 0000000000000000000000000000000000000000..c72687bf62aff412291ff9abf48e8d7579dbcadd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1950.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1950 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .translate({ x: this.translateX, y: this.translateY }) + + } + + build() { + Column() { + Button("translate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute1950_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.translateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1960.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1960.ets new file mode 100644 index 0000000000000000000000000000000000000000..307284ea3faa5675e3d7e5e0e58bc24860c9ef2e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1960.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1960 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .translate({ x: this.translateX, y: this.translateY }) + + } + + build() { + Column() { + Button("translate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute1960_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.translateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1970.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1970.ets new file mode 100644 index 0000000000000000000000000000000000000000..fac33a290c122e81ac91cca00ba71953addc95c1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1970.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1970 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .translate({ x: this.translateX, y: this.translateY }) + + } + + build() { + Column() { + Button("translate设置y为0&离屏截图").id("UIComponentSnapshotAttribute1970_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.translateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1980.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1980.ets new file mode 100644 index 0000000000000000000000000000000000000000..616df49facc657efbf4adf49d7476c3f1ca479c5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1980.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1980 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .translate({ x: this.translateX, y: this.translateY }) + + } + + build() { + Column() { + Button("translate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute1980_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.translateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1990.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1990.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8728d3e602ad1634172216ea331790b5af9f0bd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1990.ets @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute1990 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = -20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为正数&离屏截图").id("UIComponentSnapshotAttribute1990_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.scaleX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2000.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2000.ets new file mode 100644 index 0000000000000000000000000000000000000000..047320c2ca714b23eadf317377a25bb7f1b946b1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2000.ets @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2000 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为0&离屏截图").id("UIComponentSnapshotAttribute2000_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.scaleX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2010.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c7c037bbc9453b3c6ff1ed21a8f80c29373bd51 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2010.ets @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2010 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为负数&离屏截图").id("UIComponentSnapshotAttribute2010_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.scaleX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2020.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d935b62f123699aeee99b0d484c583c74d627cd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2020.ets @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2020 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为正数&离屏截图").id("UIComponentSnapshotAttribute2020_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.scaleY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2030.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab74d47e603d35b69e9f9b07ef007a93f60bea09 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2030.ets @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2030 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为0&离屏截图").id("UIComponentSnapshotAttribute2030_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.scaleY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2040.ets new file mode 100644 index 0000000000000000000000000000000000000000..194fc1add1868f3b461cf95b338876111ebd8c5e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2040.ets @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2040 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为负数&离屏截图").id("UIComponentSnapshotAttribute2040_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.scaleY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2050.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7229d042590622622e00533b936f21fd03af94b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2050.ets @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2050 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = -20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute2050_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.rotateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2060.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6d732fb874947c906e581bfbf67722ea3c0243d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2060.ets @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2060 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为0&离屏截图").id("UIComponentSnapshotAttribute2060_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.rotateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2070.ets new file mode 100644 index 0000000000000000000000000000000000000000..2b109d4ad056d9f6fffef010fd8a966fbcff1052 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2070.ets @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2070 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute2070_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.rotateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2080.ets new file mode 100644 index 0000000000000000000000000000000000000000..d8e6b64f1ad563807bf2e2785bae9e211f273567 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2080.ets @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2080 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute2080_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.rotateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2090.ets new file mode 100644 index 0000000000000000000000000000000000000000..9417530ca1006fa0d192d8a691c09a6ef19d4001 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2090.ets @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2090 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为0&离屏截图").id("UIComponentSnapshotAttribute2090_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.rotateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2100.ets new file mode 100644 index 0000000000000000000000000000000000000000..075797038d48044de330f7a6506cc9d7db273c49 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2100.ets @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2100 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Click to Show ActionSheet').id("show_001") + .onClick(() => { + ActionSheet.show({ + title: 'ActionSheet title', + subtitle: 'ActionSheet subtitle', + message: 'message', + autoCancel: true, + confirm: { + defaultFocus: true, + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + } + ] + }) + }) + } + .width('100%') + .height('100%') + .id("actionSheet_001") + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute2100_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + + this.rotateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("actionSheet_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2110.ets new file mode 100644 index 0000000000000000000000000000000000000000..6dc30b61ca90bf7a8c0d1f55bdd9e188d6c8afb4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2110.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2110 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(this.buttonWidth) + .height(60) + } + + build() { + Column() { + Button("width设置为正数&离屏截图").id("UIComponentSnapshotAttribute2110_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2120.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b3a8179079c3360eac6dffa0abe3c1ee5f792f9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2120.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2120 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(this.buttonWidth) + .height(60) + } + + build() { + Column() { + Button("width设置为0&离屏截图").id("UIComponentSnapshotAttribute2120_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2130.ets new file mode 100644 index 0000000000000000000000000000000000000000..4c64c77061a1f3795aa261f2a5dc8b6e6c8b0662 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2130.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2130 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonWidth: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(this.buttonWidth) + .height(60) + } + + build() { + Column() { + Button("width设置为负数&离屏截图").id("UIComponentSnapshotAttribute2130_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonWidth = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2140.ets new file mode 100644 index 0000000000000000000000000000000000000000..840fc3a25bee17567ff4a41255b0b5da7f5a31f3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2140.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2140 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(this.buttonHeight) + } + + build() { + Column() { + Button("height设置为正数&离屏截图").id("UIComponentSnapshotAttribute2140_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = 100 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2150.ets new file mode 100644 index 0000000000000000000000000000000000000000..b7dd4a40d59ecca28350f3f41572370494f6ab61 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2150.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2150 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 40 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(this.buttonHeight) + } + + build() { + Column() { + Button("height设置为0&离屏截图").id("UIComponentSnapshotAttribute2150_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2160.ets new file mode 100644 index 0000000000000000000000000000000000000000..517e7d44a6d322576748230ae6bea6cae08b0fdc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2160.ets @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2160 { + @State pixmap: image.PixelMap | undefined = undefined + @State buttonHeight: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(this.buttonHeight) + } + + build() { + Column() { + Button("height设置为负数&离屏截图").id("UIComponentSnapshotAttribute2160_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.buttonHeight = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2170.ets new file mode 100644 index 0000000000000000000000000000000000000000..8fbb297dd07a980aec671db225ffafa8560f58c5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2170.ets @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2170 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute2170_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2180.ets new file mode 100644 index 0000000000000000000000000000000000000000..442b8b70d105eca95e49d78b20247e3f4b6d7f91 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2180.ets @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2180 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute2180_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2190.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0ed30f058cc34f5838d256b6416fc72f5c588fc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2190.ets @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2190 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute2190_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2200.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa445b59095799a534cbb011bdfeb301f412f1ae --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2200.ets @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2200 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute2200_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2210.ets new file mode 100644 index 0000000000000000000000000000000000000000..204cf579630e634208257760ec9b626776668462 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2210.ets @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2210 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute2210_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2220.ets new file mode 100644 index 0000000000000000000000000000000000000000..f6fcf82aa8b1f6b779271a19747e89b80a0cbdbf --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2220.ets @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2220 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("localoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute2220_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2230.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c39d8d9e7603adb2c503fc7f6db5a339b9bac5d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2230.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2230 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowsoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute2230_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2240.ets new file mode 100644 index 0000000000000000000000000000000000000000..a13c566d7d523e8168e63683af3af8509775064b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2240.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2240 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowsoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute2240_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2250.ets new file mode 100644 index 0000000000000000000000000000000000000000..9bca72fad87857066956d2b262b8e6ec5e36bba4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2250.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2250 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowsoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute2250_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2260.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2260.ets new file mode 100644 index 0000000000000000000000000000000000000000..8a624045d017dc137461ecd35dbd8312bd184913 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2260.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2260 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowsoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute2260_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2270.ets new file mode 100644 index 0000000000000000000000000000000000000000..d3ea56f4fb1f61c4a18014e17beb71951e14729d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2270.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2270 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowsoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute2270_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2280.ets new file mode 100644 index 0000000000000000000000000000000000000000..5159fe30d86b26af9d3bbf6239316ca799482e78 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2280.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2280 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("windowsoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute2280_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2290.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6b4ec92f7265cd5b5324d97321e6a23d3332ab2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2290.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2290 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = -20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为正数&离屏截图").id("UIComponentSnapshotAttribute2290_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2300.ets new file mode 100644 index 0000000000000000000000000000000000000000..e9d8e2678c86e8a79662bf4e47a7a73c01872f84 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2300.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2300 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为0&离屏截图").id("UIComponentSnapshotAttribute2300_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2310.ets new file mode 100644 index 0000000000000000000000000000000000000000..022d6fe369c70e34df9c2b79e1699916e42bc035 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2310.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2310 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置x为负数&离屏截图").id("UIComponentSnapshotAttribute2310_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2320.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2320.ets new file mode 100644 index 0000000000000000000000000000000000000000..8caa31e338159aa5fdb40794fd37e6b8ac5feccb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2320.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2320 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为正数&离屏截图").id("UIComponentSnapshotAttribute2320_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2330.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2330.ets new file mode 100644 index 0000000000000000000000000000000000000000..46ef7f7b5e36fad57c173bbd166fc3df69f02a64 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2330.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2330 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为0&离屏截图").id("UIComponentSnapshotAttribute2330_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2340.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2340.ets new file mode 100644 index 0000000000000000000000000000000000000000..51637fca99f726ed1cf9b4a83f3515153940c33e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2340.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2340 { + @State pixmap: image.PixelMap | undefined = undefined + @State positionX: number = 20 + @State positionY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .position({ x: this.positionX, y: this.positionY }) + } + + build() { + Column() { + Button("screenoffset设置y为负数&离屏截图").id("UIComponentSnapshotAttribute2340_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.positionY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2350.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2350.ets new file mode 100644 index 0000000000000000000000000000000000000000..540ca11a561df4d6ceffba7cf7a9ec40192df9e6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2350.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2350 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = -20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute2350_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2360.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2360.ets new file mode 100644 index 0000000000000000000000000000000000000000..797f221959bef71cc8f77f0023e31c935b6a1edc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2360.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2360 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为0&离屏截图").id("UIComponentSnapshotAttribute2360_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2370.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2370.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ec30479e59a377948076bfaaad6b27b161c9838 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2370.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2370 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute2370_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2380.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2380.ets new file mode 100644 index 0000000000000000000000000000000000000000..f7ec20ef205f5ce32d9da842ecb7392378547afb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2380.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2380 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute2380_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2390.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2390.ets new file mode 100644 index 0000000000000000000000000000000000000000..ccec594b06bcd2227209baca0e061666cddd1620 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2390.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2390 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为0&离屏截图").id("UIComponentSnapshotAttribute2390_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2400.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2400.ets new file mode 100644 index 0000000000000000000000000000000000000000..86408ba0472bafe85f3cb1e5ca421543710be285 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2400.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2400 { + @State pixmap: image.PixelMap | undefined = undefined + @State translateX: number = 20 + @State translateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .translate({ x: this.translateX, y: this.translateY }) + } + + build() { + Column() { + Button("translate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute2400_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.translateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2410.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2410.ets new file mode 100644 index 0000000000000000000000000000000000000000..30908732214309cbaf648ecc3e445de1d0b0d243 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2410.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2410 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = -20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为正数&离屏截图").id("UIComponentSnapshotAttribute2410_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2420.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2420.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee09aaf4af410baf6570807fa405313236146d4a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2420.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2420 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为0&离屏截图").id("UIComponentSnapshotAttribute2420_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2430.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2430.ets new file mode 100644 index 0000000000000000000000000000000000000000..e2684730f9cc357f009ce3434d6b7e90342cb49a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2430.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2430 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置x为负数&离屏截图").id("UIComponentSnapshotAttribute2430_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2440.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2440.ets new file mode 100644 index 0000000000000000000000000000000000000000..16fef46a8600a38616473b7aa59582e9d69d9c90 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2440.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2440 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为正数&离屏截图").id("UIComponentSnapshotAttribute2440_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2450.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2450.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ca668c2067b57650c2235d59e83c2cecc586982 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2450.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2450 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为0&离屏截图").id("UIComponentSnapshotAttribute2450_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2460.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2460.ets new file mode 100644 index 0000000000000000000000000000000000000000..90fad6a4634aa24cd229b6e097519310dc4adb45 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2460.ets @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2460 { + @State pixmap: image.PixelMap | undefined = undefined + @State scaleX: number = 20 + @State scaleY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .scale({ x: this.scaleX, y: this.scaleY }) + } + + build() { + Column() { + Button("scale设置y为负数&离屏截图").id("UIComponentSnapshotAttribute2460_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.scaleY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2470.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2470.ets new file mode 100644 index 0000000000000000000000000000000000000000..c30c7b75e2fb7fafe8d710e9d01293a4f6906202 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2470.ets @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2470 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = -20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为正数&离屏截图").id("UIComponentSnapshotAttribute2470_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2480.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2480.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6bc4e38182b23103136c33dffc098117051b573 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2480.ets @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2480 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为0&离屏截图").id("UIComponentSnapshotAttribute2480_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2490.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2490.ets new file mode 100644 index 0000000000000000000000000000000000000000..cc28c0ec5aa54c5f1c25f620938cdfd88db048d3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2490.ets @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2490 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置x为负数&离屏截图").id("UIComponentSnapshotAttribute2490_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateX = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2500.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2500.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b135853ff7c0335c61df38295fb789a217cc900 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2500.ets @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2500 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = -20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为正数&离屏截图").id("UIComponentSnapshotAttribute2500_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = 40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2510.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2510.ets new file mode 100644 index 0000000000000000000000000000000000000000..edcd2e4e13c307c22c5a3820fc26113a2a640a10 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2510.ets @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2510 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .backgroundColor(Color.Grey) + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为0&离屏截图").id("UIComponentSnapshotAttribute2510_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = 0 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2520.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2520.ets new file mode 100644 index 0000000000000000000000000000000000000000..de8862ee1ddc62e618244c577dc0591d30a2920c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2520.ets @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2520 { + @State pixmap: image.PixelMap | undefined = undefined + @State rotateX: number = 20 + @State rotateY: number = 20 + @State value: string = ''; + + @Builder + RandomBuilder() { + ImageAnimator() + .images([ + { + src: $rawfile("cat.jpg") + } + ]) + .id("ImageAnimator_001") + .width(60) + .height(20) + .rotate({ + x: this.rotateX, + y: this.rotateY, + z: 1, + centerX: '50%', + centerY: '50%', + angle: 300 + }) + } + + build() { + Column() { + Button("rotate设置y为负数&离屏截图").id("UIComponentSnapshotAttribute2520_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.rotateY = -40 + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("ImageAnimator_001")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2530.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2530.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4594247ee05060d1b10f4d91f02785aacd69ef3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2530.ets @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device 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 '@ohos.arkui.componentSnapshot' +import image from '@ohos.multimedia.image' +import componentUtils from '@ohos.arkui.componentUtils' + +@Entry +@Component +struct UIComponentSnapshotAttribute2530 { + @State pixmap: image.PixelMap | undefined = undefined + @State value: string = ''; + + @Builder + RandomBuilder() { + Column() { + } + .id("column_001") + .width(60) + .height(20) + } + + build() { + Column() { + Button("离屏截图").id("UIComponentSnapshotAttribute2530_001") + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("error: " + JSON.stringify(error)) + return; + } + this.pixmap = pixmap + this.value = JSON.stringify(componentUtils.getRectangleById("column_error")) + }) + }) + + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + + Text(this.value) + .width("95%") + .height(200) + .borderWidth(2) + }.width('100%').margin({ left: 10, top: 5, bottom: 5 }).height(300) + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0010.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a97fd0547042d2ea7474473ab99661b9736944f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0010.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0010 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1-0010").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2-0010").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0010') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0010') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0020.ets new file mode 100644 index 0000000000000000000000000000000000000000..e3d02f5a5e97a351d5b7d984bc8814609fc2e2f3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0020.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0020 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1-0070").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2-0070").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0020') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0020') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0030.ets new file mode 100644 index 0000000000000000000000000000000000000000..f326fa22ddebbb677169b45343ca6d138835e948 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0030.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0030 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("1").backgroundColor(Color.Pink) + Divider().height(10) + Text("2").backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(100) + .height(100) + + Image(this.pixmap) + .margin(10) + .width(200) + .height(200) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0030') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0030') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0040.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1184dd5e8e8dda72a0e144417258e8aede34245 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0040.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0040 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1-0040").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2-0040").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(100) + .height(100) + + Image(this.pixmap) + .margin(10) + .border({ color: Color.Black, width: 2 }) + .width(200) + .height(200) + Button("get callback") + .id('ui_snapshot_0040') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0040') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0050.ets new file mode 100644 index 0000000000000000000000000000000000000000..85d39532a7590b97b888aedebb472ec59838c57f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0050.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0050 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1-0050").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2-0050").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0050') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0050') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0060.ets new file mode 100644 index 0000000000000000000000000000000000000000..658edd2b6bd8c27fe2de094c7ce2480daa268c48 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0060.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0060 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(100) + .height(100) + + Image(this.pixmap) + .margin(10) + .border({ color: Color.Black, width: 2 }) + .width(200) + .height(200) + Button("get callback") + .id('ui_snapshot_0060') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0060') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0070.ets new file mode 100644 index 0000000000000000000000000000000000000000..f85be54b836b99bb1541fea91486708e961b430c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0070.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0070 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1-0070").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2-0070").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0070') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0070') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0080.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d84d11ce40f063f116b5eba4cce331797806e4e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0080.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0080 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(100) + .height(100) + + Image(this.pixmap) + .margin(10) + .border({ color: Color.Black, width: 2 }) + .width(200) + .height(200) + Button("get callback") + .id('ui_snapshot_0080') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0080') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0090.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c4db38d22c596424d354cab5d10e6c0b487716e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0090.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0090 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0090') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0090') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0100.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddd129bae0c5f23dcc4257f6503df5416bc9c186 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0100.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0100 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0100') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0100') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0110.ets new file mode 100644 index 0000000000000000000000000000000000000000..36d11da71a6964f16968c3756b0bbec8afbf3f69 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0110.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0110 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0110') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0110') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0120.ets new file mode 100644 index 0000000000000000000000000000000000000000..eac161b91f1b6f7ea0ae90f885a07acf896a095d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0120.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0120 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(true) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0120') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0120') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0130.ets new file mode 100644 index 0000000000000000000000000000000000000000..645c1471ea48e5c3db475dc82bdd199dd7852234 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0130.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0130 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1-0130").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2-0130").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0130') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0130') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0140.ets new file mode 100644 index 0000000000000000000000000000000000000000..fc917e7a8757a7f16e76b983c48112530c046037 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0140.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0140 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: 0.5, waitUntilRenderFinished:true}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0150.ets new file mode 100644 index 0000000000000000000000000000000000000000..a77323667883cd117fde30ca8c462426d5cdfe22 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0150.ets @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0150 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0150') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0150') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0160.ets new file mode 100644 index 0000000000000000000000000000000000000000..b801e8d7ad428ffd1c08f600794a5cc560ee19e0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0160.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0160 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: undefined, waitUntilRenderFinished:null}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0170.ets new file mode 100644 index 0000000000000000000000000000000000000000..85696002f8d6b4fc1afa00145e5b87a99fb7ba12 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0170.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0170 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: 14, waitUntilRenderFinished:undefined}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + // Text(this.textNow) + // .width("100%") + // .backgroundColor("#ffebf8a0") + // Text(this.textError) + // .width("100%") + // .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0180.ets new file mode 100644 index 0000000000000000000000000000000000000000..1e5eb7774a68d3e40b65eb5f8bec67d7e5693e98 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0180.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0180 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: 4, waitUntilRenderFinished:undefined}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0190.ets new file mode 100644 index 0000000000000000000000000000000000000000..fda4b71502cce132815a4a3ff457e76df073c021 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0190.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0190 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: null, waitUntilRenderFinished:true}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0200.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9c7c0dfe41f77ba91f966fd793b1cf8ee5da739 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0200.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0200 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_0200') + .onClick(() => { + componentSnapshot.get("builder", {scale:1}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0200') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0210.ets new file mode 100644 index 0000000000000000000000000000000000000000..42944b380fb280f8ea83568dac4955b95e543ac7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0210.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0210 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_0210') + .onClick(() => { + componentSnapshot.get("builder", {scale:0.5}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0210') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0220.ets new file mode 100644 index 0000000000000000000000000000000000000000..d2ec4bcd87d1260601618156d31373f83a7e8541 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0220.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0220 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_0220') + .onClick(() => { + componentSnapshot.get("builder", {scale:4}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0220') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0230.ets new file mode 100644 index 0000000000000000000000000000000000000000..14c7697878d4c0ded2d2a43fb85690e5cc9665b1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0230.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0230 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_0230') + .onClick(() => { + componentSnapshot.get("builder", {scale:14}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0230') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0240.ets new file mode 100644 index 0000000000000000000000000000000000000000..edcbce3050ee5146821952c7f770f1df61649b4b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0240.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0240 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_0240') + .onClick(() => { + componentSnapshot.get("builder", {scale:-1}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0240') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0250.ets new file mode 100644 index 0000000000000000000000000000000000000000..127e902de990e87ba8a7cfefe4ea3ce9b4a4a596 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0250.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0250 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_0250') + .onClick(() => { + componentSnapshot.get("builder", {scale:undefined}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0250') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0260.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0260.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f1752c2ea2bf9c1908079a82c863c6441ad6af6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0260.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0260 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_0260') + .onClick(() => { + componentSnapshot.get("builder", {scale:0}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0260') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0270.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d76e5894492de3c700e1387480cd900c0e66dc0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0270.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0270 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_0270') + .onClick(() => { + componentSnapshot.get("builder", {scale:undefined}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0270') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0280.ets new file mode 100644 index 0000000000000000000000000000000000000000..22aa14b59458cc76921be850c369b862a994e791 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0280.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot280 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + build() { + Column() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.img')).autoResize(true).width(200).height(200).margin(5).id("builder") + Button("click to generate UI snapshot") + .id('ui_snapshot_0280') + .onClick(() => { + componentSnapshot.get("builder", { waitUntilRenderFinished: undefined }) + .then((pixmap: image.PixelMap) => { + this.pixmap = pixmap + }).catch((err: Error) => { + console.log("error: " + err) + }) + }).margin(10) + Text(this.errcode) + }.margin({left:50,top:50}) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0290.ets new file mode 100644 index 0000000000000000000000000000000000000000..a08e7261aad83fac80305af43c72e5566939f8df --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0290.ets @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot290 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + build() { + Column() { + Image(this.pixmap).width(200).height(200).border({ color: Color.Black, width: 2 }).margin(5) + Image($r('app.media.img')).autoResize(true).width(200).height(200).margin(5).id("builder") + Button("click to generate UI snapshot") + .id('ui_snapshot_0290') + .onClick(() => { + componentSnapshot.get("builder", { waitUntilRenderFinished: undefined }) + .then((pixmap: image.PixelMap) => { + this.pixmap = pixmap + }).catch((err: Error) => { + console.log("error: " + err) + }) + }).margin(10) + Text(this.errcode) + }.margin({left:50,top:50}) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0300.ets new file mode 100644 index 0000000000000000000000000000000000000000..c3c5710367bb896f06b30a44b132cac6b50ec9cc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0300.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0300 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_0300') + .onClick(() => { + componentSnapshot.get("builder", {waitUntilRenderFinished:false}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0300') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0310.ets new file mode 100644 index 0000000000000000000000000000000000000000..72c3548d32a578b83f517e02ea6d4bdc37e18083 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0310.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0310 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_0310') + .onClick(() => { + componentSnapshot.get("builder", {waitUntilRenderFinished:true}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0310') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0320.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0320.ets new file mode 100644 index 0000000000000000000000000000000000000000..75dc79b91cc233a41ec9f94e7fd244a7250b6e3e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0320.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0320 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0320') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0320') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0330.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0330.ets new file mode 100644 index 0000000000000000000000000000000000000000..bacc85d591fca8ec6cf611240c3c955a6f7bd50f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0330.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapShot0330 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: 0.5, waitUntilRenderFinished: true}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0340.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0340.ets new file mode 100644 index 0000000000000000000000000000000000000000..872a677e87154f44906af621c61f1ae9307b6a6d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0340.ets @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot0340 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State errcode: string = '' + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").fontSize(20).backgroundColor(Color.Pink) + Divider().height(10) + Text("按钮2").fontSize(20).backgroundColor(Color.Brown) + }.id("builder") + .border({width:1}) + .width(200) + .height(200) + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get callback") + .id('ui_snapshot_0340') + .onClick(() => { + componentSnapshot.get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is get callback: " + JSON.stringify(error)) + this.errcode = JSON.stringify(error) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.get callback after") + }).margin({ top: 50 }) + Text(this.errcode).key('SNAPSHOT_0340') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0350.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0350.ets new file mode 100644 index 0000000000000000000000000000000000000000..3745636ecb201f687b99b5f4983abab133d4cab6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0350.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0350 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: undefined, waitUntilRenderFinished: undefined}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0360.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0360.ets new file mode 100644 index 0000000000000000000000000000000000000000..da28998dfe465dfb6871210609ad18911b624160 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0360.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0360 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: 14, waitUntilRenderFinished: undefined}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + // Text(this.textNow) + // .width("100%") + // .backgroundColor("#ffebf8a0") + // Text(this.textError) + // .width("100%") + // .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0370.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0370.ets new file mode 100644 index 0000000000000000000000000000000000000000..151fac8c906fe3d9f66fe3f75f347a6646b619e3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0370.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0370 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: 4, waitUntilRenderFinished:undefined}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0380.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0380.ets new file mode 100644 index 0000000000000000000000000000000000000000..e8971a5f5c1ca505f30bba1ac597a6d5f9146838 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0380.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0380 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: undefined, waitUntilRenderFinished: true}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0390.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0390.ets new file mode 100644 index 0000000000000000000000000000000000000000..029ff70aabc35654cf9343fef1a8f062715e46d0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0390.ets @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0390 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + // this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0400.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0400.ets new file mode 100644 index 0000000000000000000000000000000000000000..39fb708a11768646d67d20ae5b7d985e4d3ca40e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0400.ets @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0400 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + // this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0410.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0410.ets new file mode 100644 index 0000000000000000000000000000000000000000..280ac24e019151fd5e96965b8622ba38a8a5ddf3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0410.ets @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0410 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + // this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0420.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0420.ets new file mode 100644 index 0000000000000000000000000000000000000000..a8498d53c50b01e0cf43a844b9a8b287c296a19f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0420.ets @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0420 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + // this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0430.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0430.ets new file mode 100644 index 0000000000000000000000000000000000000000..2384b19948b64d0d93b892e4c526f0c50db85e30 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0430.ets @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0430 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + // this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0440.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0440.ets new file mode 100644 index 0000000000000000000000000000000000000000..b92229562fcf17f9d031e145e086c125eb5698c5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0440.ets @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0440 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + // this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0450.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0450.ets new file mode 100644 index 0000000000000000000000000000000000000000..d54612bfb872fea4292362b74c67f4d976380dec --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0450.ets @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0450 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + // this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0460.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0460.ets new file mode 100644 index 0000000000000000000000000000000000000000..29eade2ea80b64b427b3626f7dedfac38bacb2d2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0460.ets @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0460 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + // this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0530.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0530.ets new file mode 100644 index 0000000000000000000000000000000000000000..5d5bec6fde5938815eb17be925d0758ad5c5bc2d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0530.ets @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0530 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0540.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0540.ets new file mode 100644 index 0000000000000000000000000000000000000000..8fff8206293f48708f33f82ae80b22a594225963 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0540.ets @@ -0,0 +1,388 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null | boolean + + constructor(wait?: number | undefined | null | boolean) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0540 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(true), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0550.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0550.ets new file mode 100644 index 0000000000000000000000000000000000000000..3887c4feef99c89590d70c6c48fcac964cd9df1d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0550.ets @@ -0,0 +1,410 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0550 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + this.delay.delay + this.check.check + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0560.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0560.ets new file mode 100644 index 0000000000000000000000000000000000000000..0182749fa449e3c615505b33a0e897f546036202 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0560.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0560 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0560') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0570.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0570.ets new file mode 100644 index 0000000000000000000000000000000000000000..04c089772ec68b7ca08453fd67b7e5345b7a9333 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0570.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0570 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(null) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0570') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0580.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0580.ets new file mode 100644 index 0000000000000000000000000000000000000000..ace40e244e17c90a206343e0ed5bdca2c54457f1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0580.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0580 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0580') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0590.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0590.ets new file mode 100644 index 0000000000000000000000000000000000000000..04827566508beab25b06eb8bdb020b46e48ce7ea --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0590.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0590 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0590') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0600.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0600.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d57cecaab2b0dfdbc4edbaf0b3a8c0c7d5e7fb9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0600.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0600 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0600') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0610.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0610.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b77db87650d890db52a399e8dc39eca9d04badc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0610.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0610 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0610') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0620.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0620.ets new file mode 100644 index 0000000000000000000000000000000000000000..9630f917b575ccc3408597750f00c05471048f88 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0620.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0620 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0620') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0630.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0630.ets new file mode 100644 index 0000000000000000000000000000000000000000..021549ad0fc67ee7981a28cbd12242c0ca42c3bc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0630.ets @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0630 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + + Button("click to generate UI snapshot") + .id('ui_snapshot_0630') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_0630") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_0630") + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0640.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0640.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a57e917a7d99c5a20be360638b90916ed375140 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0640.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0640 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0640') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0650.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0650.ets new file mode 100644 index 0000000000000000000000000000000000000000..283b81a1833927e6c0e82942afa197ea188c11f4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0650.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0650 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0650') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0660.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0660.ets new file mode 100644 index 0000000000000000000000000000000000000000..482e867e500f04642e61e83b7323fd0fc2ab2369 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0660.ets @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0660 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("click to generate UI snapshot") + .id('ui_snapshot_0660') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_0660") + + Text(this.errcode).id("SNAPSHOT_0660") + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0670.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0670.ets new file mode 100644 index 0000000000000000000000000000000000000000..a7565ede58595611496f46356dee421a14f12874 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0670.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0670 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0670') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0680.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0680.ets new file mode 100644 index 0000000000000000000000000000000000000000..e9fd6212ced1f04585f1089c9acad989e59f975a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0680.ets @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0680 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("click to generate UI snapshot") + .id('ui_snapshot_0680') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_0680") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_0680") + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0690.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0690.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b89e00e89e4c84a8a8f06ef02d453c8e4758b83 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0690.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0690 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0690') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0700.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0700.ets new file mode 100644 index 0000000000000000000000000000000000000000..215fd1f55671761a6aa2464fea8a363dcf455441 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0700.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0700 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0700') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0710.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0710.ets new file mode 100644 index 0000000000000000000000000000000000000000..48a5c271cae212293b614df9eeb1ddac91c07787 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0710.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0710 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0710') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0720.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0720.ets new file mode 100644 index 0000000000000000000000000000000000000000..d752573e88ac318ee4dd70de2345e94f1d3ca207 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0720.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0720 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0720') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0730.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0730.ets new file mode 100644 index 0000000000000000000000000000000000000000..918605e97195fc43315bbfc0e84e21992908fe29 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0730.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0730 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(80).height(80).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0730') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + + }).margin({ top: 50 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0740.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0740.ets new file mode 100644 index 0000000000000000000000000000000000000000..278d60d916dfe76ef5871134970d0d8f89a81400 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0740.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0740 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(80).height(80).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0740') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + + }).margin({ top: 50 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0750.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0750.ets new file mode 100644 index 0000000000000000000000000000000000000000..9c3560041328111840100a2e61fbdc513dccad04 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0750.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0750 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(80).height(80).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0750') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + + }).margin({ top: 50 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0760.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0760.ets new file mode 100644 index 0000000000000000000000000000000000000000..27d6867eccb6c32582e5ab92ddace528b8516416 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0760.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0760 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(80).height(80).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0760') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + + }).margin({ top: 50 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0770.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0770.ets new file mode 100644 index 0000000000000000000000000000000000000000..649246cabf0b4607ff41c112f44b7bf3f21d6dce --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0770.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0770 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0770') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0780.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0780.ets new file mode 100644 index 0000000000000000000000000000000000000000..925b1fde7e44bbac83eb1a20094e6ac9fccd0157 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0780.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0780 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0780') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0790.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0790.ets new file mode 100644 index 0000000000000000000000000000000000000000..b7eb35135c3e5cf83efa93fb639520372849d993 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0790.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0790 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0790') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0800.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0800.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ce700054396936e6641ffe63c942eda2b2c7345 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0800.ets @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0800 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(null) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0800') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0810.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0810.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f4a908038672c08242eae32a07696caf77d51c5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0810.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0810 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(80).height(80).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0810') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + + }).margin({ top: 50 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0820.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0820.ets new file mode 100644 index 0000000000000000000000000000000000000000..5919accdf576c29ced7569ef84da872ed2532561 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0820.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0820 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(211.11) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(80).height(80).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0820') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + + }).margin({ top: 50 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0830.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0830.ets new file mode 100644 index 0000000000000000000000000000000000000000..881caf10b64e7c96e4cfc490d7639bc232445b61 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0830.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0830 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(80).height(80).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0830') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + + }).margin({ top: 50 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0840.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0840.ets new file mode 100644 index 0000000000000000000000000000000000000000..685b900f2245e820778d3dbbb787ec1fb71e2294 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0840.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0840 { + @State pixmap: image.PixelMap | undefined = undefined + + @State delay: TestDelayClass = new TestDelayClass(211.11) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(80).height(80).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0840') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + + }).margin({ top: 50 }) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0850.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0850.ets new file mode 100644 index 0000000000000000000000000000000000000000..0eee3ae75f78b05f8c0b8f012167a6cbbb5a9031 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0850.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0850 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0850') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0860.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0860.ets new file mode 100644 index 0000000000000000000000000000000000000000..f282c964d37db2e057399b4fb9d6f699b7797768 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0860.ets @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0860 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + Button("click to generate UI snapshot") + .id('ui_snapshot_0860') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_0860") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_0860") + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0870.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0870.ets new file mode 100644 index 0000000000000000000000000000000000000000..b18578495161a158b1848f1f3902b4476a847eea --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0870.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0870 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0870') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0880.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0880.ets new file mode 100644 index 0000000000000000000000000000000000000000..6cff07d77259addaa146c9757c9e67c24088eec2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0880.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0880 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0880') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0890.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0890.ets new file mode 100644 index 0000000000000000000000000000000000000000..a1f7d0a85e288954b9bd106df15b0c8314b4533a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0890.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0890 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_0890') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0900.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0900.ets new file mode 100644 index 0000000000000000000000000000000000000000..6546d7fafafe9867bddaede3fb75fb95d9d926d4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0900.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + + +@Entry +@Component +struct UISnapshot0900 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Button("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + Button("click to generate UI snapshot") + .id('ui_snapshot_0900') + .onClick(() => { + componentSnapshot.createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + // console.log("error: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_0900") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_0090") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0910.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0910.ets new file mode 100644 index 0000000000000000000000000000000000000000..eab8be416f8bb140b09a9c2e468f4e339572f32f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0910.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0910 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + // this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0920.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0920.ets new file mode 100644 index 0000000000000000000000000000000000000000..3aa7a5bb6a30fe33ff5281a126e857da03ec656a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0920.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0920 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + // this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0930.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0930.ets new file mode 100644 index 0000000000000000000000000000000000000000..60c008695766968bf004db89048000f576cfa4a9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0930.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0930 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + // this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0940.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0940.ets new file mode 100644 index 0000000000000000000000000000000000000000..8b4bff0d704881513b49f33520cda7c2159adda3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0940.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0940 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + // this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0950.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0950.ets new file mode 100644 index 0000000000000000000000000000000000000000..085817c31cd31411a9f40aa80de716153b4c6fee --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0950.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0950 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + // this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0960.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0960.ets new file mode 100644 index 0000000000000000000000000000000000000000..f85a38c115a91ddf80cfbb56575c537660afae36 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0960.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0960 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + // this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0970.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0970.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e1292b5c1f42eace4eb769a2fc85531a526199e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0970.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0970 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + // this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0980.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0980.ets new file mode 100644 index 0000000000000000000000000000000000000000..93f6cd30f3792044fecc947a9456e97e9889f881 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0980.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0980 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + // this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0990.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0990.ets new file mode 100644 index 0000000000000000000000000000000000000000..d611d58b5faf5ef9aa41191c22ddb9b46a27766a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot0990.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot0990 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1000.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1000.ets new file mode 100644 index 0000000000000000000000000000000000000000..42a4c47d6cdf275a41208753cc9e0744d74f4a83 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1000.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1000 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1010.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa881705a0f49e27f241e50422b8fea381b0dd3a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1010.ets @@ -0,0 +1,407 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1010 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1080.ets new file mode 100644 index 0000000000000000000000000000000000000000..e2b6f4bef1b6d53f5c99416d2e7d3e418510a47b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1080.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1080 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1080") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1080") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1090.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb5c6fb2b4c97bfcc6d4a9504a60f763428dd8e9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1090.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1090 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(null) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1090") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1090") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1100.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b4e0d4c46d61c091ada85a63cb9a7d1f7217228 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1100.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1100 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1100") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1100") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1110.ets new file mode 100644 index 0000000000000000000000000000000000000000..348bc1488220e5c0837d078e0fc318c334b818a2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1110.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1110 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1110") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1110") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1120.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1bad0eeb58d76d34e6e2f408ec5170a49c50af8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1120.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1120 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1120") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_1120") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1130.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1dc04e62660db2a681c9c703fdb4f5818f75639 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1130.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1130 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1130") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1130") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1140.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b2e92f869b9006f8ee02122c0f0d3139e41396f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1140.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1140 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(211.11) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1140") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_1140") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1150.ets new file mode 100644 index 0000000000000000000000000000000000000000..2a3914fc5dd3164b34813d9fe8723d991f18b445 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1150.ets @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1150 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(false) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_1150") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_1150") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_1150") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1160.ets new file mode 100644 index 0000000000000000000000000000000000000000..818e9d127eabf8f05f5b11616d6fc6c26233d51d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1160.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1160 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1160") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_1160") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1170.ets new file mode 100644 index 0000000000000000000000000000000000000000..0476403a60826da93fae2f336149ea002bbee8b3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1170.ets @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1170 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(true) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_1170") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_1170") + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_1170") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1180.ets new file mode 100644 index 0000000000000000000000000000000000000000..fac220c902d5d94b4c36ec3230444f5623ad8f9c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1180.ets @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1180 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_1180") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_1180") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_1180") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1190.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d1e868ccd226c8d976b656dd0dc2dda1554a6d2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1190.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1190 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1190") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1190") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1200.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb1997e02aeccac4b0046a308261646a695c1b5c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1200.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1200 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1200") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1200") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1210.ets new file mode 100644 index 0000000000000000000000000000000000000000..36c365057ef782e3916cc2f436637fe23b83ede7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1210.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1210 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1210") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1210") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1220.ets new file mode 100644 index 0000000000000000000000000000000000000000..08995ecaec51aef06451f3583f9a77f5b46adf06 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1220.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1220 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1220") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1220") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1230.ets new file mode 100644 index 0000000000000000000000000000000000000000..c09e1f6eef3af5cd0cfc8ad012f6ca6cf76e37af --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1230.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1230 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1230") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1230") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1240.ets new file mode 100644 index 0000000000000000000000000000000000000000..14ba66ee0b3fcbbe35d16f7eb067ee04752db442 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1240.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1240 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1240") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1240") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1250.ets new file mode 100644 index 0000000000000000000000000000000000000000..d8d31751c5c392778aac988ab88226aec1c73150 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1250.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1250 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1250") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1250") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1260.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1260.ets new file mode 100644 index 0000000000000000000000000000000000000000..20f905d3547fa85bc2f52c110d6fbef59877aa85 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1260.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1260 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1260") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1260") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1270.ets new file mode 100644 index 0000000000000000000000000000000000000000..82976802ce43cc955c0ee61cb8a758a68c0845a2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1270.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1270 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1270") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1270") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1280.ets new file mode 100644 index 0000000000000000000000000000000000000000..75c13569fa80c709df7e227afbf64c43964005bc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1280.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1280 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1280") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1280") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1290.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c50c1b178250e60c252e28ad26a4fe3866f3929 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1290.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1290 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1290") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1290") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1300.ets new file mode 100644 index 0000000000000000000000000000000000000000..967cf589dbc61b7c81c56bdbe5efd24ac10415ab --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1300.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1300 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1300") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1300") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1310.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba0095f3f830efd7342a3ee9f57acebfd570896c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1310.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1310 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1310") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1310") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1320.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1320.ets new file mode 100644 index 0000000000000000000000000000000000000000..a20341d227163ef261f824f91803301c553f8f4e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1320.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1320 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(null) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1320") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1320") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1330.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1330.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1216fd30f951906ab00351bb4424a55e424312a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1330.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1330 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1330") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1330") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1340.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1340.ets new file mode 100644 index 0000000000000000000000000000000000000000..e739477c0c48b6d26d56c44b8edd16b901ea1000 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1340.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1340 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(211.11) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1340") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1340") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1350.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1350.ets new file mode 100644 index 0000000000000000000000000000000000000000..f92447263073bc7f5f7d88c317ace3df5d756de5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1350.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1350 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1350") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1350") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1360.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1360.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba558de13ac3c3456269f0a902d8aebf6b720ddd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1360.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1360 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(211.11) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1360") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1360") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1370.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1370.ets new file mode 100644 index 0000000000000000000000000000000000000000..87e4b5b91797ce3800f69132da20e082418880b5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1370.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1370 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1370") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("ui_snapshot_1370") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1380.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1380.ets new file mode 100644 index 0000000000000000000000000000000000000000..3cf9e41b4238b7bf83f2d62b593c51905bb9dd12 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1380.ets @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1380 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_1380") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_1380") + + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1380") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1390.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1390.ets new file mode 100644 index 0000000000000000000000000000000000000000..80d0204e1b0223d9b31b7421062a7d3954de6508 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1390.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1390 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(60).height(60).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1390") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1380") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1400.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1400.ets new file mode 100644 index 0000000000000000000000000000000000000000..c386bff79c92028abf57aef5a55afedb4ec52ef3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1400.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1400 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(60).height(60).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1400") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1380") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1410.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1410.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee4f77491619cc4d2bd87675c3a89e2e8573f2f5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1410.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1410 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.icon')).width(60).height(60).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_1410") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1380") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1430.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1430.ets new file mode 100644 index 0000000000000000000000000000000000000000..5c0bbb00edc0eb9f9bbe838dcb135e12d1b16bcc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1430.ets @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot1430 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(null) + @State wait: TestWaitClass = new TestWaitClass(true) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_1430") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_1430") + + Text(this.errcode).fontSize(20).key("UI_SNAPSHOT_1430") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1440.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1440.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0bb3e468437bd90824ced4465a0b787c901e29f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1440.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1440 { + @State pixmap: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1440') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1440') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1450.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1450.ets new file mode 100644 index 0000000000000000000000000000000000000000..325b36c4501ac6b985d6514d65dccd08de395c5b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1450.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1450 { + @State pixmap: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1450') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1450') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1460.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1460.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf7d9dd9ea30cb164943381b053568e41fe9035e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1460.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1460 { + @State pixmap: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(4) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1460') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1460') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1470.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1470.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ccb6c4c3712279e52e66b4f488c2eb48b1cfcf8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1470.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1470 { + @State pixmap: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(14) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1470') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1470') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1480.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1480.ets new file mode 100644 index 0000000000000000000000000000000000000000..9045c730aadefc8e324721d2d2a7230ee6b0313a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1480.ets @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1480 { + @State pixmap: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮").fontSize(30) + } + .margin(20) + .height(100) + .width(100) + .id("builder") + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1480') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1480') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1490.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1490.ets new file mode 100644 index 0000000000000000000000000000000000000000..4262c7295e6551570df4d7023e5ef2cdb038452d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1490.ets @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1490 { + @State pixmap: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(100) + .width(100) + .id("builder") + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1490') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1490') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1500.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1500.ets new file mode 100644 index 0000000000000000000000000000000000000000..4b6dee2cc2ceeab19b93c26dee10f400fbf1a0b7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1500.ets @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1500 { + @State pixmap: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1500') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1500') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1510.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1510.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9dd17372ea3c458935e13d148415b07249a21a3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1510.ets @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1510 { + @State pixmap: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(100) + .width(100) + .id("builder") + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1510') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1510') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1520.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1520.ets new file mode 100644 index 0000000000000000000000000000000000000000..257d313dafb1c4d2658287a7fe1030598a04ed64 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1520.ets @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +@Entry +@Component +struct UISnapshot1520 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(100) + .width(100) + .id("builder") + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1520') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1520') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1530.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1530.ets new file mode 100644 index 0000000000000000000000000000000000000000..88279c10b4d787802d386aee3852901adaca31be --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1530.ets @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +@Entry +@Component +struct UISnapshot1530 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(100) + .width(100) + .id("builder") + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1530') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1530') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1540.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1540.ets new file mode 100644 index 0000000000000000000000000000000000000000..41309f6e30811208503742c2c4a21e55a63a1f14 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1540.ets @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +@Entry +@Component +struct UISnapshot1540 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(100) + .width(100) + .id("builder") + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1540') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1540') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1550.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1550.ets new file mode 100644 index 0000000000000000000000000000000000000000..f716407be070fbb50c6a3df3c052919d7c1cfe2b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1550.ets @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +@Entry +@Component +struct UISnapshot1550 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(100) + .width(100) + .id("builder") + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1550') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1550') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1560.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1560.ets new file mode 100644 index 0000000000000000000000000000000000000000..85e074ad4c92a04734c2d19317b8b43b42d95190 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1560.ets @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +@Entry +@Component +struct UISnapshot1560 { + @State pixmap: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮").fontSize(30) + } + .margin(20) + .height(100) + .width(100) + .id("builder") + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1560') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1560') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1570.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1570.ets new file mode 100644 index 0000000000000000000000000000000000000000..76bff9d4d33918379c3a3c842f3cca27b2883e52 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1570.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1570 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: 0.5, waitUntilRenderFinished:true}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1580.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1580.ets new file mode 100644 index 0000000000000000000000000000000000000000..994bfe9834783dcfd480efccf35e852a157d61a1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1580.ets @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +@Entry +@Component +struct UISnapshot1580 { + @State pixmap: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + // @Builder + // RandomBuilder() { + // Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + // Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + // Divider().height(10) + // Text("按钮") + // } + // .width(100) + // .id("builder") + // } + + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮").fontSize(30) + } + .margin(20) + .height(100) + .width(100) + .id("builder") + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1580') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode =JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1580') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1590.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1590.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff4a3000bb2a9c8b5ee77b387ff6569e086440e7 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1590.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1570 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: undefined, waitUntilRenderFinished:null}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1600.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1600.ets new file mode 100644 index 0000000000000000000000000000000000000000..4373d37f7e5ec99da7e80f5f7a821af6bf2e07b9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1600.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1600 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: 14, waitUntilRenderFinished:undefined}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + // Text(this.textNow) + // .width("100%") + // .backgroundColor("#ffebf8a0") + // Text(this.textError) + // .width("100%") + // .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1610.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1610.ets new file mode 100644 index 0000000000000000000000000000000000000000..b33572eef27be25cfed3161a089fcf73b6617918 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1610.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1610 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: 4, waitUntilRenderFinished: undefined}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1620.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1620.ets new file mode 100644 index 0000000000000000000000000000000000000000..e318ea1eea66b0251490e6f09875c64aac7ac6c1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1620.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1620 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: null, waitUntilRenderFinished:true}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1630.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1630.ets new file mode 100644 index 0000000000000000000000000000000000000000..dbda49c434b9739a19cd2df3dde39cb37c100e01 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1630.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1630 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1630') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {scale: 1}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1630') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1640.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1640.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf65399d9016935a09b563478e58c11426c920a9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1640.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1640 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1640') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {scale: 0.5}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1640') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1650.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1650.ets new file mode 100644 index 0000000000000000000000000000000000000000..86c2905db4ec7b0813f2f6c6d47716e718df1236 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1650.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1650 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1650') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {scale: 4}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1650') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1660.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1660.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f0c770f3c65184bb3eab998220d3294a89f145a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1660.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1660 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1660') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {scale: 14}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1660') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1670.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1670.ets new file mode 100644 index 0000000000000000000000000000000000000000..7505a35c15cc3062721d0267962193e9e8c03c82 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1670.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1670 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1670') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {scale: -1}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1670') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1680.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1680.ets new file mode 100644 index 0000000000000000000000000000000000000000..8689b04ec1be655654d9e2c2a4429ae8add15a20 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1680.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1680 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1680') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {scale: undefined}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1680') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1690.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1690.ets new file mode 100644 index 0000000000000000000000000000000000000000..78eaabae00763e1cefe5a27d1d74f4e842c9a284 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1690.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1690 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1690') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {scale: 0}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1690') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1700.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1700.ets new file mode 100644 index 0000000000000000000000000000000000000000..53de87c5ca5e59449bd47551cc668b46b5a02096 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1700.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1700 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1700') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {scale: undefined}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1700') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1710.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1710.ets new file mode 100644 index 0000000000000000000000000000000000000000..03ea63d979e650bf30c9d635c585970304c5a6fb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1710.ets @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1710 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1710') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {waitUntilRenderFinished: undefined}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1710') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1720.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1720.ets new file mode 100644 index 0000000000000000000000000000000000000000..3d2e531797d1871426759dc54c2893c565ec63c1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1720.ets @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1720 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1720') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {waitUntilRenderFinished: undefined}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1720') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1730.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1730.ets new file mode 100644 index 0000000000000000000000000000000000000000..6dbed772560debd0c675aeaf6a2598e67964eb0b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1730.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1730 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1730') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {waitUntilRenderFinished: false}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1730') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1740.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1740.ets new file mode 100644 index 0000000000000000000000000000000000000000..83faef98485dceb50ae5e74ce13f0f7a0b7b554b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1740.ets @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1740 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1740') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {waitUntilRenderFinished: true}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1740') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1750.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1750.ets new file mode 100644 index 0000000000000000000000000000000000000000..a4ccccce7a0eebf0cac951b817bd1b6627c3f161 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1750.ets @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1750 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(false) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(200) + .width(200) + .id("builder") + Image(this.pixmap) + .margin(10) + .height(200) + .width(200) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1750') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1750') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1760.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1760.ets new file mode 100644 index 0000000000000000000000000000000000000000..62081933beb5a42379e547784966ef607885f755 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1760.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1760 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: 0.5, waitUntilRenderFinished: true}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + // Text(this.textNow) + // .width("100%") + // .backgroundColor("#ffebf8a0") + // Text(this.textError) + // .width("100%") + // .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1770.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1770.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f386f7c665d3702254334eeff30272d6d6b37a6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1770.ets @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +@Entry +@Component +struct UISnapshot1770 { + @State pixmap: image.PixelMap | undefined = undefined + @State wait: TestWaitClass = new TestWaitClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1") + Divider().height(10) + Text("按钮2") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('按钮1').fontSize(30) + Divider().height(10) + Text("按钮2").fontSize(30) + } + .margin(20) + .height(100) + .width(100) + .id("builder") + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("get Promise") + .id('ui_snapshot_1770') + .onClick(() => { + this.getUIContext().getComponentSnapshot().get("builder", {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err:Error) => { + this.errcode = ''+err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1770') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1780.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1780.ets new file mode 100644 index 0000000000000000000000000000000000000000..da5f80774305bd6294917b439f10a0951ff8da39 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1780.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1780 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: undefined, waitUntilRenderFinished: undefined}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1790.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1790.ets new file mode 100644 index 0000000000000000000000000000000000000000..11ae1f8a780d1f7dc30dcaeb461014ad1a5b1e67 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1790.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1790 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: 14, waitUntilRenderFinished: undefined}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + // Text(this.textNow) + // .width("100%") + // .backgroundColor("#ffebf8a0") + // Text(this.textError) + // .width("100%") + // .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1800.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1800.ets new file mode 100644 index 0000000000000000000000000000000000000000..74028c18be8da7bf761c6013bdaf4c52e4518262 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1800.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1800 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: 4, waitUntilRenderFinished: undefined}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1810.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1810.ets new file mode 100644 index 0000000000000000000000000000000000000000..828cc77e34163832a417c3c4465ee6f68e2b01ed --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1810.ets @@ -0,0 +1,408 @@ +/* + * Copyright (C) 2024 Huawei Device 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 { CommonModifier, componentSnapshot, componentUtils, TextModifier } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; +class MyModifier extends TextModifier { + public index: number = 0 + + applyNormalAttribute(instance: TextAttribute): void { + super.applyNormalAttribute?.(instance); + } + + public setGroup1(): void { + this.width(50) + this.height(35) + this.fontColor(Color.Yellow) + this.backgroundColor("#ff035ff6") + this.textAlign(TextAlign.Center) + this.fontSize(12) + } +} + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1810 { + @State pixmap1: image.PixelMap | undefined = undefined + // @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + // @State pixmap3: image.PixelMap | undefined | ResourceStr = $r("app.media.ic_public_input_search") + @State pixmap2: image.PixelMap | undefined = undefined + @State pixmap3: image.PixelMap | undefined = undefined + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scaleIndex: number = 0 + @State scaleNowIndex: number = 0 + @State waitIndex: number = 0 + @State waitNowIndex: number = 0 + @State delayIndex: number = 0 + @State delayNowIndex: number = 0 + @State checkIndex: number = 0 + @State checkNowIndex: number = 0 + @State myModifier: CommonModifier = new MyModifier() + .width(45) + .height(35) + .textAlign(TextAlign.Center) + .fontColor(Color.White) + .backgroundColor("#ff035ff6") + .fontSize(12) + @State textNow: string = "Now: delay = 300, check = false, scale = 1, wait = false" + @State textError: string = "Error: No error" + + private testScaleCase = [ + new TestScaleClass(1), + new TestScaleClass(4), + new TestScaleClass(13), + new TestScaleClass(14), + new TestScaleClass(0.5), + new TestScaleClass(0), + new TestScaleClass(-1), + new TestScaleClass(undefined), + new TestScaleClass(null), + ] + + private testWaitCase = [ + new TestWaitClass(false), + new TestWaitClass(true), + new TestWaitClass(undefined), + new TestWaitClass(null), + ] + + private testDelayCase = [ + new TestDelayClass(300), + new TestDelayClass(0), + new TestDelayClass(1), + new TestDelayClass(1000), + new TestDelayClass(-1), + new TestDelayClass(211.11), + new TestDelayClass(undefined), + new TestDelayClass(null), + ] + + private testCheckCase = [ + new TestCheckClass(false), + new TestCheckClass(true), + new TestCheckClass(undefined), + new TestCheckClass(null), + ] + + private setParam(delayIndex: number, checkIndex: number, scaleIndex: number, waitIndex: number): void { + this.delay.delay = this.testDelayCase[delayIndex].delay + this.delayNowIndex = delayIndex + this.check.check = this.testCheckCase[checkIndex].check + this.checkNowIndex = checkIndex + this.scale1.scale = this.testScaleCase[scaleIndex].scale + this.scaleNowIndex = scaleIndex + this.wait.wait = this.testWaitCase[waitIndex].wait + this.waitNowIndex = waitIndex + this.textNow = "Now: delay = " + this.delay.delay + ", check = " + this.check.check + ", scale = " + this.scale1.scale + ", wait = " + this.wait.wait + this.textError = "Now: No error" + } + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.img")) + .height(190) + .width(190) + .syncLoad(true) + } + .width(190) + .height(190) + .id("builder") + } + + @Builder + RandomBuilder2() { + Column(){ + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + build() { + Column({space: 5}) { + Row({space: 5}) { + Image(this.pixmap1) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Image(this.pixmap2) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + } + Row({space: 5}) { + Text("callback↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Text("promise↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + + Row({space: 5}){ + Image($r("app.media.icon")).width(190).height(190).id("image1") + // Image($r("app.media.apple")).width(100).height(100).id("image1") + Column({space: 10}){ + Text("←Test Image") + .width(150) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + Button("get callback") + .id("gCallback") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get callback begin") + componentSnapshot.get("image1", (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.textError = "Now: error is get callback: " + JSON.stringify(error) + console.log("XXX: error is get callback: " + JSON.stringify(error)) + return; + } + this.pixmap1?.release() + this.pixmap1 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + },{scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // },{waitUntilRenderFinished: this.wait.wait}) + // },{scale: this.scale1.scale}) + console.log("XXX: componentSnapshot.get callback after") + }).margin(10) + Button("get promise") + .id("gPromise") + .onClick(() => { + this.textError = "Now: No error" + console.log("XXX: componentSnapshot.get promise begin") + componentSnapshot.get("image1", {scale: undefined, waitUntilRenderFinished: true}) + // componentSnapshot.get("image1", {waitUntilRenderFinished: this.wait.wait}) + // componentSnapshot.get("image1", {scale: this.scale1.scale}) + + .then((pixmap: image.PixelMap) => { + this.pixmap2?.release() + this.pixmap2 = pixmap + let info = componentUtils.getRectangleById("image1") + console.log("www: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is get promise: " + err + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + } + } + + Divider() + Row({space: 5}){ + Column({space:1}) { + Image(this.pixmap3) + .width(190) + .height(190) + .border({ color: Color.Black, width: 2 }) + .objectFit(ImageFit.None) + Text("builder↑") + .width(190) + .height(13) + .backgroundColor("#ffebf8a0") + .textAlign(TextAlign.Center) + .fontSize(12) + } + Column({space: 20}){ + Button("Builder callback") + .id("bCallback") + .onClick(() => { + this.textError = "Now: No error" + + console.log("XXX: componentSnapshot.createFromBuilder callback begin") + componentSnapshot.createFromBuilder(()=>{this.RandomBuilder()}, + (error: Error, pixmap: image.PixelMap) => { + if(error){ + this.textError = "Now: error is createFromBuilder callback: " + JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay) + // }, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.check.check) + // }, this.delay.delay, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + // }, this.delay.delay, this.check.check) + // }, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + console.log("XXX: componentSnapshot.createFromBuilder callback after") + }).margin(10) + Button("Builder promise") + .id("bPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.textError = "Now: No error" + componentSnapshot.createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap3?.release() + this.pixmap3 = pixmap + let info = componentUtils.getRectangleById("builder2") + console.log("XXX: " + "pixelMapSize:" + JSON.stringify(pixmap.getImageInfoSync().size) + info.size.width + ' ' + info.size.height + ' ' + info.localOffset.x + ' ' + info.localOffset.y + ' ' + info.windowOffset.x + ' ' + info.windowOffset.y) + }) + .catch((err:Error) => { + this.textError = "Now: error is createFromBuilder promise " + err + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + }).margin(10) + } + } + Divider() + Column({space: 5}) { + Row({space:4}){ + Text("delay++") + .attributeModifier(this.myModifier) + .id("delay++") + .onClick(() => { + this.delayIndex = (this.delayIndex +1) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("delay--") + .attributeModifier(this.myModifier) + .id("delay--") + .onClick(() => { + this.delayIndex = (this.delayIndex - 1 + this.testDelayCase.length) % this.testDelayCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("check") + .attributeModifier(this.myModifier) + .id("check") + .onClick(() => { + this.checkIndex = (this.checkIndex + 1) % this.testCheckCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + + Text("scale++") + .attributeModifier(this.myModifier) + .id("scale++") + .onClick(() => { + this.scaleIndex = (this.scaleIndex + 1) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("scale--") + .attributeModifier(this.myModifier) + .id("scale--") + .onClick(() => { + this.scaleIndex = (this.scaleIndex - 1 + this.testScaleCase.length) % this.testScaleCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("wait") + .attributeModifier(this.myModifier) + .id("wait") + .onClick(() => { + this.waitIndex = (this.waitIndex + 1) % this.testWaitCase.length + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + }) + Text("clear") + .attributeModifier(this.myModifier) + .id("clear") + .backgroundColor(Color.Blue) + .onClick(() => { + // this.pixmap1 = $r("app.media.ic_public_input_search") + // this.pixmap2 = $r("app.media.ic_public_input_search") + // this.pixmap3 = $r("app.media.ic_public_input_search") + this.textError = "Now: No error" + }) + Text("zero") + .attributeModifier(this.myModifier) + .id("zero") + .backgroundColor(Color.Blue) + .onClick(() => { + this.delayIndex = 0 + this.checkIndex = 0 + this.scaleIndex = 0 + this.waitIndex = 0 + this.setParam(this.delayIndex, this.checkIndex, this.scaleIndex, this.waitIndex) + this.textError = "Now: No error" + }) + } + Text(this.textNow) + .width("100%") + .backgroundColor("#ffebf8a0") + Text(this.textError) + .width("100%") + .backgroundColor("#fff69a83") + } + .width('100%') + } + .width('100%') + .height('100%') + .alignItems(HorizontalAlign.Center) + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1820.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1820.ets new file mode 100644 index 0000000000000000000000000000000000000000..565dd1995cdd27b623cffd2f3f815e7239bf357f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1820.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1820 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1820') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, 300) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1820') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1830.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1830.ets new file mode 100644 index 0000000000000000000000000000000000000000..439e3fe89bb36eba42fdade4fe0699bd3038a585 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1830.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1830 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1830') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, 1000) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1830') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1840.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1840.ets new file mode 100644 index 0000000000000000000000000000000000000000..53150900758bb59a27ad2d6ae72e5bfe0a658484 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1840.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1840 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + + Button("click to generate UI snapshot") + .id('ui_snapshot_1840') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, 1) + }).margin({ top: 50 }) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_1840") + + Text(this.errcode).key('SNAPSHOT_1840') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1850.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1850.ets new file mode 100644 index 0000000000000000000000000000000000000000..9264dfbbdcdf2c0743dd20ca0b5fed555a99877b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1850.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1850 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1850') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, 211.11) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1850') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1860.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1860.ets new file mode 100644 index 0000000000000000000000000000000000000000..6616ccc858131e9f5d739ab4fc7d67c5f6b87b96 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1860.ets @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1860 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + + Button("click to generate UI snapshot") + .id('ui_snapshot_1860') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, 0) + }).margin({ top: 50 }) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_1860") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_1860") + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1870.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1870.ets new file mode 100644 index 0000000000000000000000000000000000000000..615aaf6f9055ddbbffca07013745b558ee76bf5c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1870.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1870 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1870') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, -1) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1870') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1880.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1880.ets new file mode 100644 index 0000000000000000000000000000000000000000..030c882c8873496969e64482b07f8365ea7d6ca5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1880.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1880 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1880') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, undefined) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1880') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1890.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1890.ets new file mode 100644 index 0000000000000000000000000000000000000000..4fc60850e3531ec4b8093f98542fbfdcf1f9ec4c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1890.ets @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1890 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1890') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, undefined) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1890') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1960.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1960.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9ed95d149cf48b06dae31d3628dbe1f7f707b29 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1960.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1960 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1960') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, undefined,undefined ) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1960') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1970.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1970.ets new file mode 100644 index 0000000000000000000000000000000000000000..c103371d85fa94dd0d1c4f81b8d51e03f3b1265b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1970.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1970 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1970') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, 300,undefined ) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1970') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1980.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1980.ets new file mode 100644 index 0000000000000000000000000000000000000000..519f0436b702a3fc100693a6bc94ec9b833b9bb8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1980.ets @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2024 Huawei Device 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 UISnapshot1980 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1980') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, undefined, true) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1980') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1990.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1990.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e136d11e675a4074afed93fb29b4e6a4e06fb9a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot1990.ets @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot1990 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_1990') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_1990') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2000.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2000.ets new file mode 100644 index 0000000000000000000000000000000000000000..815b8800d3b2b0153754aab6f9ac5d263ff630d2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2000.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2000 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(null) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2000') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2000') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2010.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2010.ets new file mode 100644 index 0000000000000000000000000000000000000000..4227e6a0ec212be405ba5bdceaf7ec85e6f2d76b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2010.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2010 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2010') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2010') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2020.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2020.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f08bfbc2d96f03ad445c63cab674eda1af8f2c8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2020.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2020 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2020') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2020') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2030.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2030.ets new file mode 100644 index 0000000000000000000000000000000000000000..182f7fbbd7f956529311fbe33760c2b285221337 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2030.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2030 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2030') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2030') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2040.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2040.ets new file mode 100644 index 0000000000000000000000000000000000000000..2fb35aadd41e5116d2fc18be3bb56d564ff8b5a9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2040.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2040 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2040') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2040') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2050.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2050.ets new file mode 100644 index 0000000000000000000000000000000000000000..e0cc16ad849c8dd2a071e853a39d58ebecece4ec --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2050.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2050 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2050') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2050') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2060.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2060.ets new file mode 100644 index 0000000000000000000000000000000000000000..9cb6a954c6724c3418ae9976c70e2f1a723aaa5a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2060.ets @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2060 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + Button("click to generate UI snapshot") + .id('ui_snapshot_2060') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2060") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2060") + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2070.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2070.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c45f8bfecdd0aeca7565a965123b6cdab43f65a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2070.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2070 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2070') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2070') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2080.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2080.ets new file mode 100644 index 0000000000000000000000000000000000000000..57ca66c5ba877bf0d24415a661696ec5953f6d79 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2080.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2080 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2080') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2080') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2090.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2090.ets new file mode 100644 index 0000000000000000000000000000000000000000..62ed5defe06eb2df5ee4c996e32bdf543d476097 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2090.ets @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2090 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + + Button("click to generate UI snapshot") + .id('ui_snapshot_2090') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2090") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2090") + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2100.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2100.ets new file mode 100644 index 0000000000000000000000000000000000000000..ddc251926bb07093e68fb974919dc65ac7d4478b --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2100.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2100 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2100') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2100') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2110.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2110.ets new file mode 100644 index 0000000000000000000000000000000000000000..067caeac5b2cbc07b889507ee7be7e3906951da6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2110.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2110 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2110') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2110') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2120.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2120.ets new file mode 100644 index 0000000000000000000000000000000000000000..31f72452580d4141fd66d2e741c18e5dfff37425 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2120.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2120 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2120') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2120') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2130.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2130.ets new file mode 100644 index 0000000000000000000000000000000000000000..5f7eab3ab085796403f71db0b0dc3027254ba17d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2130.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2130 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2130') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2130') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2140.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2140.ets new file mode 100644 index 0000000000000000000000000000000000000000..a99c2118745fda17dac689767926c41376a88eff --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2140.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2140 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2140') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2140') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2150.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2150.ets new file mode 100644 index 0000000000000000000000000000000000000000..a95eb49ed579144b08bb7942ae793ce0b939f01d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2150.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2150 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2150') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2150') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2160.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2160.ets new file mode 100644 index 0000000000000000000000000000000000000000..575fe13039f780cfb77dcdc59eda98195916fbc6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2160.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2160 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2160') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2160') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2170.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2170.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1b396a2608e2a25f47d214f0673786196ad3eff --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2170.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2170 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2170') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2170') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2180.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2180.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ded6c21c105359164d9a03cd5d3405e93182f0f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2180.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2180 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2180') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2180') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2190.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2190.ets new file mode 100644 index 0000000000000000000000000000000000000000..3de4803dc0f3810628ceef9b50fef6f8dca8ea19 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2190.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2190 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2190') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2190') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2200.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2200.ets new file mode 100644 index 0000000000000000000000000000000000000000..876b9fec512ef5d2bf437801bb4938ce219f6906 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2200.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2200 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2200') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2200') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2210.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2210.ets new file mode 100644 index 0000000000000000000000000000000000000000..4c62dabd85c129dceee7006dbadd1521f74289a3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2210.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2210 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2210') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2210') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2220.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2220.ets new file mode 100644 index 0000000000000000000000000000000000000000..8c3e18e25689e91dd5056f6ed982576157715886 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2220.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2220 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2220') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2220') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2230.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2230.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea8b1ec287fe3df45e80a7a56f128b79072baa8e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2230.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2230 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(null) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2230') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2240.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2240.ets new file mode 100644 index 0000000000000000000000000000000000000000..53be9398cdd6c4c611e93dad446eefe77db5b9fd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2240.ets @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2240 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("click to generate UI snapshot") + .id('ui_snapshot_2240') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2240") + Text(this.errcode).id("UI_SNAPSHOT_2240") + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2250.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2250.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa0360b6dd8c9d7690731225d89874d08b291259 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2250.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2250 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(211.11) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2250') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2260.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2260.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff6528494df4ad7fd4bd32cad0f9abb13db2206c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2260.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2260 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2260') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2270.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2270.ets new file mode 100644 index 0000000000000000000000000000000000000000..123890b43d8e97be704c1e33ae9dd5756cc99d23 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2270.ets @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2270 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(211.11) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2270') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode) + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2280.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2280.ets new file mode 100644 index 0000000000000000000000000000000000000000..3db6aa29babb7030aa0ab9954d1042d14b592f0d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2280.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2280 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2280') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2280') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2290.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2290.ets new file mode 100644 index 0000000000000000000000000000000000000000..92e431868085d143dedbc616608f526e5079b2a9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2290.ets @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2290 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(undefined) + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("click to generate UI snapshot") + .id('ui_snapshot_2290') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2290") + + Text(this.errcode).key('SNAPSHOT_2290') + + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2300.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2300.ets new file mode 100644 index 0000000000000000000000000000000000000000..740b35977dfd086378f4b6025e2dc9259983b02a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2300.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2300 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(true) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2300') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2300') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2310.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2310.ets new file mode 100644 index 0000000000000000000000000000000000000000..94b068c8c634321e0ff6f930fa2782b9fd8c2756 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2310.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2310 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(false) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2310') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2310') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2320.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2320.ets new file mode 100644 index 0000000000000000000000000000000000000000..f9c82ee4ac1147207b57087c6d742d9207c31afa --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2320.ets @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2320 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + Button("click to generate UI snapshot") + .id('ui_snapshot_2320') + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Text(this.errcode).key('SNAPSHOT_2320') + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2330.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2330.ets new file mode 100644 index 0000000000000000000000000000000000000000..5eac3415825ad19b754bcfecbf25e62b5253aec5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2330.ets @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + +@Entry +@Component +struct UISnapshot2330 { + @State pixmap: image.PixelMap | undefined = undefined + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + @State errcode: string = '' + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r('app.media.img')).width(40).height(40).border({ color: Color.Black, width: 2 }) + Divider().height(10) + Text("按钮") + } + .width(100) + .id("builder") + } + + build() { + Column() { + + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("click to generate UI snapshot") + .id('ui_snapshot_2330') + .onClick(() => { + this.getUIContext().getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + this.errcode = JSON.stringify(error) + console.log("XXX: error is createFromBuilder callback: " + JSON.stringify(error)) + return; + } + this.pixmap?.release() + this.pixmap = pixmap + }, this.delay.delay, this.check.check, {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait}) + }).margin({ top: 50 }) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2330") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2330") + + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2340.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2340.ets new file mode 100644 index 0000000000000000000000000000000000000000..df7ad0631ff7c79519a4db1c419a4d200fa12a91 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2340.ets @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2340 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2340") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2340") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2350.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2350.ets new file mode 100644 index 0000000000000000000000000000000000000000..2dcb9e7d143a7d6e20957f62e8e3e43a747e273a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2350.ets @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2350 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2350") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2350") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2360.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2360.ets new file mode 100644 index 0000000000000000000000000000000000000000..d6ae44841463c1d4fbe2aab6ffa8e1a55aaf1ad1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2360.ets @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2360 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1) + @State check: TestCheckClass = new TestCheckClass(false) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_2360") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2360") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2360") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2370.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2370.ets new file mode 100644 index 0000000000000000000000000000000000000000..2efb113ac2ede20d7231be74df4f597556b170f1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2370.ets @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2370 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(211.11) + @State check: TestCheckClass = new TestCheckClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2370") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2370") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2380.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2380.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3eff196670c0627c82ab60e1330bdefe8124ec3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2380.ets @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2380 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_2380") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2380") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2380") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2390.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2390.ets new file mode 100644 index 0000000000000000000000000000000000000000..2027ca1529a8bb07f3a5b15d819d812c337bf7bb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2390.ets @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2390 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2390") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2390") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2400.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2400.ets new file mode 100644 index 0000000000000000000000000000000000000000..67b8337478b83822ea6038d8260d159b2f876139 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2400.ets @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2400 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2400") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2400") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2410.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2410.ets new file mode 100644 index 0000000000000000000000000000000000000000..7b80a3f56cf853dcc3e78f4fceb677147cf9c054 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2410.ets @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2410 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(null) + @State check: TestCheckClass = new TestCheckClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2410") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2410") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2420.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2420.ets new file mode 100644 index 0000000000000000000000000000000000000000..20e25f9f2f73cdb111e3760f2a6c1668eb4fc550 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2420.ets @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2420 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(null) + @State check: TestCheckClass = new TestCheckClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2420") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2420") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2430.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2430.ets new file mode 100644 index 0000000000000000000000000000000000000000..5049162daad59bf392fe34a6f14beda86b989367 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2430.ets @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2430 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2430") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2430") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2440.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2440.ets new file mode 100644 index 0000000000000000000000000000000000000000..c927ed8ee5c865c0e8f807b3756439b04d8b2688 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2440.ets @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2440 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1) + @State check: TestCheckClass = new TestCheckClass(true) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_2440") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2440") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2440") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2510.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2510.ets new file mode 100644 index 0000000000000000000000000000000000000000..abc76d7c45060233a72d918b9530aa2b6716e767 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2510.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2510 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2510") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2510") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2520.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2520.ets new file mode 100644 index 0000000000000000000000000000000000000000..afbe9cad775d35a793dddac509658dd4f27b44a1 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2520.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2520 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(null) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2520") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2520") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2530.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2530.ets new file mode 100644 index 0000000000000000000000000000000000000000..6366f6ffb6ab72cda9abb8b860b14ccfc4aadd3d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2530.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2530 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(0) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2530") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2530") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2540.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2540.ets new file mode 100644 index 0000000000000000000000000000000000000000..f32eb286836b0c58ecd2549079da3d65fbe07f07 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2540.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2540 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2540") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2540") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2550.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2550.ets new file mode 100644 index 0000000000000000000000000000000000000000..944e63233ce4c036e72ae66a96f5256d2c6761ca --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2550.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2550 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2550") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2550") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2560.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2560.ets new file mode 100644 index 0000000000000000000000000000000000000000..2b591d2450d04e3cc1a0c140fe1bb2b8703967dc --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2560.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2560 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2560") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2560") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2570.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2570.ets new file mode 100644 index 0000000000000000000000000000000000000000..577d54aa92f4f0dd42e2dd5678c91dd3b8759ba2 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2570.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2570 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2570") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2570") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2580.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2580.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e5a72d825b25475623a8549f984a64c87eca16f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2580.ets @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2580 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(false) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_2580") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2580") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2580") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2590.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2590.ets new file mode 100644 index 0000000000000000000000000000000000000000..a54d784fdec41982a5738b0f17b7da1172013edd --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2590.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2590 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2590") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2590") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2600.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2600.ets new file mode 100644 index 0000000000000000000000000000000000000000..104f46295fccc74ec02730a58d0323d86938a74c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2600.ets @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2600 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(true) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_2600") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2600") + Text(this.errcode).fontSize(20).key("SNAPSHOT_2600") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2610.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2610.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8f3f0cd2e933f974ffea1f871193285782bdbc0 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2610.ets @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2610 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_2610") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2610") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2610") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2620.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2620.ets new file mode 100644 index 0000000000000000000000000000000000000000..886077846b3257fcc493b562c4496749b47b2a81 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2620.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2620 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2620") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2620") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2630.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2630.ets new file mode 100644 index 0000000000000000000000000000000000000000..25857c287c1b1247fda418be81c6562da3df61d8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2630.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2630 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2630") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2630") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2640.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2640.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d4ccc20112277965fc388f9450f6dbc559f74e6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2640.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2640 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2640") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2640") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2650.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2650.ets new file mode 100644 index 0000000000000000000000000000000000000000..63420693b4bdbbe2b758494bf7de8fcb60225250 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2650.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2650 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2650") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2650") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2660.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2660.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e5ee6a551c1b90fd41ef2b5fe55a446ad3fa554 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2660.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2660 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2660") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2660") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2670.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2670.ets new file mode 100644 index 0000000000000000000000000000000000000000..55be664fa3c0e3da40fcba5ff868ad1d2f757bd5 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2670.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2670 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2670") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2670") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2680.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2680.ets new file mode 100644 index 0000000000000000000000000000000000000000..9546b4873811a4047e7bec0ee3b3dfdf33a00fee --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2680.ets @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2680 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_2680") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2680") + + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2680") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2690.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2690.ets new file mode 100644 index 0000000000000000000000000000000000000000..6bb12001a17301b0fa14476e0bba4da8de263d20 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2690.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2690 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2690") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2690") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2700.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2700.ets new file mode 100644 index 0000000000000000000000000000000000000000..371314f5e67ec66ee9b82f1c02ec664a98497e64 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2700.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2700 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(1) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2700") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2700") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2710.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2710.ets new file mode 100644 index 0000000000000000000000000000000000000000..2fcf64feda6ef3d8452e21516b54e1112aac9786 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2710.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2710 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2710") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2710") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2720.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2720.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f5127d0434ab19821bee083942c25aa9339b674 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2720.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2720 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(0.5) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2720") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2720") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2730.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2730.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a1b6e6da5579465fdd86893440fff1b9289290a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2730.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2730 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(undefined) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(14) + @State wait: TestWaitClass = new TestWaitClass(undefined) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2730") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2730") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2740.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2740.ets new file mode 100644 index 0000000000000000000000000000000000000000..6084fd58708ba007d03e226dd9fa1dfd67bccab9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2740.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2740 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(-1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2740") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2740") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2750.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2750.ets new file mode 100644 index 0000000000000000000000000000000000000000..f2018680ee224514c2a5bbe0af3f73b1291183e9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2750.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2750 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(null) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2750") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2750") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2760.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2760.ets new file mode 100644 index 0000000000000000000000000000000000000000..5da12cdbf2d4cb1b5d557af0174a3ebffe939c2a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2760.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2760 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2760") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2760") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2770.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2770.ets new file mode 100644 index 0000000000000000000000000000000000000000..4d0f492a152e98619608a74267482d52b81456e9 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2770.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2770 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(211.11) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(4) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2770") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2770") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2780.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2780.ets new file mode 100644 index 0000000000000000000000000000000000000000..b87cd65dc1ed96e540e2b70c85dc6d2dcf1f2930 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2780.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2780 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(null) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2780") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2780") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2790.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2790.ets new file mode 100644 index 0000000000000000000000000000000000000000..4f53443a0ef8febb357358416a541e47594b5df4 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2790.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2790 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(211.11) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2790") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2790") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2800.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2800.ets new file mode 100644 index 0000000000000000000000000000000000000000..8f097fff1fffa6844b7e80ab0a0d4f14996c7f9a --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2800.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2800 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2800") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2800") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2810.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2810.ets new file mode 100644 index 0000000000000000000000000000000000000000..29b9221a76beb1cada61cf666f0a5ca86133873d --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2810.ets @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2810 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1) + @State check: TestCheckClass = new TestCheckClass(undefined) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(null) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_2810") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + + + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_20810") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2810") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2820.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2820.ets new file mode 100644 index 0000000000000000000000000000000000000000..12ad180e09fde6a5f7c55c978be0e65a6e4a9e83 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2820.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2820 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(true) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2820") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2820") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2830.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2830.ets new file mode 100644 index 0000000000000000000000000000000000000000..12747a6d4b5b3bdc60e426b0cc505f0532090fdb --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2830.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2830 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(true) + @State scale1: TestScaleClass = new TestScaleClass(undefined) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2830") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2830") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2840.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2840.ets new file mode 100644 index 0000000000000000000000000000000000000000..ba373abbc712b9ea2304d1f887f489aa74261a18 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2840.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2840 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(300) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2840") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2840") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2860.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2860.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b04ff6e24e395d2456cf4419ebab3cfcc7f4021 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2860.ets @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2860 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(0) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(-1) + @State wait: TestWaitClass = new TestWaitClass(null) + @State nam:Visibility=Visibility.Visible + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + .visibility(this.nam) + + Button("Builder promise") + .id("ui_snapshot_2860") + .onClick(() => { + console.log("XXX:"+this.delay.delay+ this.check.check+this.scale1.scale+this.wait.wait) + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Button("隐藏").onClick((event: ClickEvent) => { + this.nam=Visibility.None + }).id("btnSNAPSHOT_2860") + + Text(this.errcode).fontSize(20).key("SNAPSHOT_2860") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2870.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2870.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a070b54d9efc067c58d52ebf4a3e89768be624c --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2870.ets @@ -0,0 +1,150 @@ + +import { image } from '@kit.ImageKit'; + + +@Entry +@Component +struct UISnapshot2870 { + @State pixmap: image.PixelMap | undefined = undefined + @State pixmap1: image.PixelMap | undefined | ResourceStr = $r("app.media.img") + @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.img") + uiContext: UIContext = this.getUIContext(); + @State str: string = "" + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('Test menu item 1') + .fontSize(20) + .width(100) + .height(50) + .textAlign(TextAlign.Center) + Divider().height(10) + Text('Test menu item 2') + .fontSize(20) + .width(100) + .height(50) + .textAlign(TextAlign.Center) + } + .width(100) + .id("builder") + } + + @Builder + RandomBuilder3() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.app_icon")) + .height(200) + .width(200) + .syncLoad(true) + } + .width(200) + .height(200) + .id("builder3") + } + + @Builder + RandomBuilder2() { + Column() { + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + @Builder + testWebImage() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image("https://copyright.bdstatic.com/vcg/creative/1434d89b9eca5356a80fc06124ef6c50.jpg") + .height(100) + .width(100) + .syncLoad(true) + } + .width(100) + .id("webImage") + } + + build() { + Column() { + Button("builder promise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.uiContext.getComponentSnapshot() + .createFromBuilder(() => { + this.testWebImage() + }, 300, false, { scale: 1, waitUntilRenderFinished: true }) + .then((pixmap: image.PixelMap) => { + this.pixmap = pixmap + }) + .catch((err: Error) => { + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + this.str = "XXX:error is createFromBuilderpronise" + }).margin(10) + .id("builderPromise") + + Button("builder callback") + .onClick(() => { + this.uiContext.getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder3() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.error("XXX: error: " + JSON.stringify(error)) + return; + } + this.pixmap = pixmap + }, 300, false, { scale: 0.5, waitUntilRenderFinished: undefined } + // 1000, true, {scale: 70, waitUntilRenderFinished: true} + // 0 + // 1 + // 100 + // 300 + // 1000 + // 5000 + // -1 + // -300 + // -5000 + // 0.99 + // undefined + // 20000 + // 100000000 + // + // true + // 0, true + // 300, false + // 1000, undefined, + // 300, , + // 300, false, {scale: 0.7, waitUntilRenderFinished:true} + // 500, true, {scale: 3, waitUntilRenderFinished:false} + // 0, true, {scale: 3, waitUntilRenderFinished:undefined} + // 0, false, {scale: 3, waitUntilRenderFinished:undefined} + // 500, false, {scale: 70, waitUntilRenderFinished:undefined} + ) + }) + + Button("get promise") + .id("gPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.get promise begin") + this.uiContext.getComponentSnapshot() + .get("image1", { scale: 1, waitUntilRenderFinished: false }) + .then((pixmap: image.PixelMap) => { + this.pixmap2 = pixmap + }) + .catch((err: Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + + Text(this.str).fontSize(18) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2880.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2880.ets new file mode 100644 index 0000000000000000000000000000000000000000..45387d249c0c108d1e91a74ddd36aa409de44d8f --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2880.ets @@ -0,0 +1,150 @@ + +import { image } from '@kit.ImageKit'; + + +@Entry +@Component +struct UISnapshot2880 { + @State pixmap: image.PixelMap | undefined = undefined + @State pixmap1: image.PixelMap | undefined | ResourceStr = $r("app.media.img") + @State pixmap2: image.PixelMap | undefined | ResourceStr = $r("app.media.img") + uiContext: UIContext = this.getUIContext(); + @State str: string = "" + + @Builder + RandomBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('Test menu item 1') + .fontSize(20) + .width(100) + .height(50) + .textAlign(TextAlign.Center) + Divider().height(10) + Text('Test menu item 2') + .fontSize(20) + .width(100) + .height(50) + .textAlign(TextAlign.Center) + } + .width(100) + .id("builder") + } + + @Builder + RandomBuilder3() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image($r("app.media.app_icon")) + .height(200) + .width(200) + .syncLoad(true) + } + .width(200) + .height(200) + .id("builder3") + } + + @Builder + RandomBuilder2() { + Column() { + Text("非Image") + .width(100) + .height(100) + .backgroundColor(Color.Green) + } + .width(200) + .height(200) + .backgroundColor(Color.Orange) + .id("builder2") + } + + @Builder + testWebImage() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Image("https://copyright.bdstatic.com/vcg/creative/1434d89b9eca5356a80fc06124ef6c50.jpg") + .height(100) + .width(100) + .syncLoad(true) + } + .width(100) + .id("webImage") + } + + build() { + Column() { + Button("builder promise") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.uiContext.getComponentSnapshot() + .createFromBuilder(() => { + this.testWebImage() + }, 300, false, { scale: 1, waitUntilRenderFinished: true }) + .then((pixmap: image.PixelMap) => { + this.pixmap = pixmap + }) + .catch((err: Error) => { + console.log("XXX: error is createFromBuilder promise " + err) + }) + console.log("XXX: componentSnapshot.createFromBuilder promise after") + this.str = "XXX:error is createFromBuilderpronise" + }).margin(10) + .id("builderPromise") + + Button("builder callback") + .onClick(() => { + this.uiContext.getComponentSnapshot().createFromBuilder(() => { + this.RandomBuilder3() + }, + (error: Error, pixmap: image.PixelMap) => { + if (error) { + console.error("XXX: error: " + JSON.stringify(error)) + return; + } + this.pixmap = pixmap + }, 300, false, { scale: 0.5, waitUntilRenderFinished: undefined } + // 1000, true, {scale: 70, waitUntilRenderFinished: true} + // 0 + // 1 + // 100 + // 300 + // 1000 + // 5000 + // -1 + // -300 + // -5000 + // 0.99 + // undefined + // 20000 + // 100000000 + // + // true + // 0, true + // 300, false + // 1000, undefined, + // 300, , + // 300, false, {scale: 0.7, waitUntilRenderFinished:true} + // 500, true, {scale: 3, waitUntilRenderFinished:false} + // 0, true, {scale: 3, waitUntilRenderFinished:undefined} + // 0, false, {scale: 3, waitUntilRenderFinished:undefined} + // 500, false, {scale: 70, waitUntilRenderFinished:undefined} + ) + }) + + Button("get promise") + .id("gPromise") + .onClick(() => { + console.log("XXX: componentSnapshot.get promise begin") + this.uiContext.getComponentSnapshot() + .get("image1", { scale: 1, waitUntilRenderFinished: false }) + .then((pixmap: image.PixelMap) => { + this.pixmap2 = pixmap + }) + .catch((err: Error) => { + console.log("XXX: error is get promise: " + err) + }) + console.log("XXX: componentSnapshot.get promise after") + }).margin(10) + + Text(this.str).fontSize(18) + } + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2940.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2940.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d831d142ba83b2fa94202fe80b0b12c7f818c01 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2940.ets @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2024 Huawei Device 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'; + + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} + +class TestDelayClass { + delay: number | undefined | null + + constructor(wait?: number | undefined | null) { + this.delay = wait + } +} + +class TestCheckClass { + check: boolean | undefined | null + + constructor(check?: boolean | undefined | null) { + this.check = check + } +} + + +@Entry +@Component +struct UISnapshot2940 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State delay: TestDelayClass = new TestDelayClass(1000) + @State check: TestCheckClass = new TestCheckClass(false) + @State scale1: TestScaleClass = new TestScaleClass(13) + @State wait: TestWaitClass = new TestWaitClass(false) + + @Builder + RandomBuilder2() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text("按钮1").border({ width: 1, color: Color.Green }).backgroundColor(Color.Yellow) + Divider().height(10) + Text("按钮2").border({ width: 1, color: Color.Yellow }).backgroundColor(Color.Red) + } + .width(100) + .id("builder2") + } + build() { + Column() { + Image(this.pixmap) + .margin(10) + .height(300) + .width(300) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2940") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.getUIContext().getComponentSnapshot().createFromBuilder(()=>{ + this.RandomBuilder2()}, + this.delay.delay, + this.check.check, + {scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait} + ) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }) + .catch((err:Error) => { + this.errcode = err + '' + console.log("XXX: error is createFromBuilder promise " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2940") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2950.ets b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2950.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf83ee0309657d23ab84d5a0829dca633ed79d18 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testability/pages/UISnapshot/UISnapshot2950.ets @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2024 Huawei Device 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, componentUtils } from '@kit.ArkUI'; +import { image } from '@kit.ImageKit'; + + +class TestScaleClass { + scale: number | undefined | null + + constructor(scale?: number | undefined | null) { + this.scale = scale + } +} + +class TestWaitClass { + wait: boolean | undefined | null + + constructor(wait?: boolean | undefined | null) { + this.wait = wait + } +} +@Entry +@Component +struct UISnapshot2950 { + @State pixmap: image.PixelMap | undefined = undefined + @State errcode: string = '' + @State scale1: TestScaleClass = new TestScaleClass(13) + @State wait: TestWaitClass = new TestWaitClass(false) + + build() { + Column() { + + Image($r('app.media.img')).width(200).height(200).id('image1') + Divider().height(10) + Image(this.pixmap) + .height(200) + .width(200) + .objectFit(ImageFit.None) + .border({ color: Color.Black, width: 2 }) + + Button("Builder promise") + .id("ui_snapshot_2950") + .onClick(() => { + console.log("XXX: componentSnapshot.createFromBuilder promise begin") + this.getUIContext().getComponentSnapshot().get("image1", { scale: this.scale1.scale, waitUntilRenderFinished: this.wait.wait }) + .then((pixmap: image.PixelMap) => { + this.pixmap?.release() + this.pixmap = pixmap + }).catch((err: Error) => { + this.errcode = "" + err + console.log("XXX: error is get promise: " + err) + }) + }).margin(10) + Text(this.errcode).fontSize(20).key("SNAPSHOT_2950") + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..c26fa1d9efb5d54d5e6b7e39ca0f440e53f4db12 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2024 Huawei Device 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 hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +async function onAbilityCreateCallback() { + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/module.json5 b/function/ui_compare_rh/uicompare/entry/src/ohosTest/module.json5 new file mode 100644 index 0000000000000000000000000000000000000000..f57793affdea19efb65943db431b022d42957ec6 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/module.json5 @@ -0,0 +1,69 @@ +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "requestPermissions": [ + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", + "usedScene": { + "abilities": [ + "EntryAbility" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.INTERNET" + }, + { + "name": "ohos.permission.READ_MEDIA" + }, + { + "name": "ohos.permission.CAPTURE_SCREEN" + }, + { + "name": "ohos.permission.ACCESS_SCREEN_LOCK_INNER" + }, + { + "name": "ohos.permission.UPDATE_CONFIGURATION" + } + ], + "abilities": [ + { + "name": "TestAbility", + "srcEntry": "./ets/testability/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "exported": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/color.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..03d835fb48e435eb83f00da8336d83c20986a115 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/color.json @@ -0,0 +1,24 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "Pink", + "value": "#ffc0cb" + }, + { + "name": "yellow", + "value": "#FFCFA613" + }, + { + "name": "blue", + "value": "#0000ff" + }, + { + "name": "colorRed", + "value": "#FF0000" + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/float.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..989acc491a1f2c97ded461ca1dc60a58faa0b666 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/float.json @@ -0,0 +1,8 @@ +{ + "float": [ + { + "name": "boardSize_10", + "value": "10" + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/integer.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/integer.json new file mode 100644 index 0000000000000000000000000000000000000000..0cf2364d45a04a8728c52846397b489032563833 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/integer.json @@ -0,0 +1,15 @@ +{ + "integer":[ + { + "name": "0", + "value": 0 + }, + { + "name": "20", + "value": 20 + },{ + "name": "50", + "value": 50 + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/string.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..273e23b03ea5c45382994f0c894f986377cb090e --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/element/string.json @@ -0,0 +1,56 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + }, + { + "name": "Font_size", + "value": "5vp" + }, + { + "name": "Font_pristina", + "value": "pristina" + }, + { + "name": "color_yellow", + "value": "#FFDDD52F" + }, + { + "name": "size_30", + "value": "30vp" + }, + { + "name": "boardSize_10", + "value": "0vp" + }, + { + "name": "fontfamily_1", + "value": "HarmonyOS Sans" + }, + { + "name": "span", + "value": "span" + }, + { + "name": "test_value", + "value": "-10" + }, + { + "name": "TestAbility_label_p", + "value": "100%" + }, + { + "name": "abc", + "value": "abc" + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/big_icon.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/big_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..7a32b59293c29076b7ff37af37dc09318aa26462 Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/big_icon.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/cat.jpg b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/cat.jpg new file mode 100644 index 0000000000000000000000000000000000000000..382ac7dc322871219388ca27f7c637447e8c9e77 Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/cat.jpg differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/closeeye.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/closeeye.png new file mode 100644 index 0000000000000000000000000000000000000000..c59a90fb37dd9cea9724d9e1b953767416981efc Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/closeeye.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/color.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/color.json new file mode 100644 index 0000000000000000000000000000000000000000..5e2848dc24cef89cfce3d8a902fc57706fa3eb22 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "Pink", + "value": "#FFC0CB" + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/icon.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/icon.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/img.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/img.png new file mode 100644 index 0000000000000000000000000000000000000000..f0db31a954039edac72e84a149dc09c608d3b6f4 Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/img.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/img2.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/img2.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/img2.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/openeye.png b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/openeye.png new file mode 100644 index 0000000000000000000000000000000000000000..e1bedb18a67926d59141af2726ce804a93b313db Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/media/openeye.png differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/profile/test_pages.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c25cc1ac1afc97f567fd80d7ba68a7db74b811d8 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/base/profile/test_pages.json @@ -0,0 +1,795 @@ +{ + "src": [ + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0020", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0030", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0040", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0050", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0060", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0070", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0080", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0090", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0100", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0110", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0140", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0150", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0160", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0170", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0180", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0190", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0200", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0210", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0220", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0230", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0240", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0250", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0260", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0270", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0280", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0310", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0320", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0330", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0340", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0470", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0480", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0490", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0500", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0510", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0520", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0530", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0540", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0550", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0560", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0610", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0620", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0630", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0640", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0650", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0660", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0670", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0840", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0850", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0860", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0870", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0880", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0890", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0910", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0920", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0930", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0940", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0950", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0960", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0970", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0980", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0990", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1000", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1010", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1040", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1050", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1060", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1070", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1080", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1090", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1100", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1110", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1120", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1170", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1180", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1190", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1200", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1210", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1220", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1230", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1240", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1270", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0570", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0580", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0680", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0690", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0700", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0710", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0740", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0750", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0770", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0780", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0760", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0790", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0900", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1020", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1250", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1260", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0020", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0030", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0040", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0050", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0060", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0070", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0080", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0090", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0100", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0110", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0120", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0130", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0140", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0150", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0160", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0170", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0180", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0190", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0200", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0210", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0220", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0230", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0240", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0250", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0260", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0270", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0280", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0290", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0300", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0310", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0320", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0330", + "testability/pages/ActionEventCommoneventFocusDefault/ActionEventCommoneventFocusDefault0340", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0060", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0230", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0040", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0110", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0100", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0020", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0010", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0070", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0080", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0090", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0050", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0250", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0240", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0160", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0140", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0150", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0030", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0720", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0800", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0810", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0830", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1030", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1130", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1140", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1150", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1160", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1280", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1290", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1300", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1310", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1380", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1390", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1400", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1410", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1420", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction1430", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0120", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0130", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0290", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0300", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0350", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0360", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0370", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0380", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0390", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0400", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0410", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0420", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0430", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0440", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0450", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0460", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0590", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0600", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0730", + "testability/pages/ActionEventCommoneventFocuseventInteraction/ActionEventCommoneventFocuseventInteraction0820", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0010", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0050", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0060", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0080", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0100", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0120", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0160", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0170", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0260", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0250", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0030", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0020", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0150", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0140", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0220", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0240", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0230", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0090", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0110", + "testability/pages/UIAttributesFocuscontrolInterface/UIAttributesFocuscontrolInterface0190", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0100", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0010", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0050", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0030", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0040", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0020", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0130", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0120", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0110", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0060", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0070", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0090", + "testability/pages/UIComponentCommonattrFocusenhancement/UIComponentCommonattrFocusenhancement0080", + "testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0010", + "testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0020", + "testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0030", + "testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0040", + "testability/pages/UIAttributesFocuscontrolInterAction/UIAttributesFocuscontrolInterAction0050", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0110", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0240", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0080", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0070", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0060", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0050", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0200", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0030", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0040", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0010", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0020", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0120", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0150", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0220", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0210", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0190", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0230", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0180", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0130", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0140", + "testability/pages/UISnapshot/UISnapshot0900", + "testability/pages/UISnapshot/UISnapshot0890", + "testability/pages/UISnapshot/UISnapshot0880", + "testability/pages/UISnapshot/UISnapshot0870", + "testability/pages/UISnapshot/UISnapshot0860", + "testability/pages/UISnapshot/UISnapshot0850", + "testability/pages/UISnapshot/UISnapshot0840", + "testability/pages/UISnapshot/UISnapshot0830", + "testability/pages/UISnapshot/UISnapshot0820", + "testability/pages/UISnapshot/UISnapshot0810", + "testability/pages/UISnapshot/UISnapshot0800", + "testability/pages/UISnapshot/UISnapshot0790", + "testability/pages/UISnapshot/UISnapshot0780", + "testability/pages/UISnapshot/UISnapshot0770", + "testability/pages/UISnapshot/UISnapshot0760", + "testability/pages/UISnapshot/UISnapshot0750", + "testability/pages/UISnapshot/UISnapshot0740", + "testability/pages/UISnapshot/UISnapshot0730", + "testability/pages/UISnapshot/UISnapshot0720", + "testability/pages/UISnapshot/UISnapshot0710", + "testability/pages/UISnapshot/UISnapshot0700", + "testability/pages/UISnapshot/UISnapshot0690", + "testability/pages/UISnapshot/UISnapshot0680", + "testability/pages/UISnapshot/UISnapshot0670", + "testability/pages/UISnapshot/UISnapshot0660", + "testability/pages/UISnapshot/UISnapshot0650", + "testability/pages/UISnapshot/UISnapshot0640", + "testability/pages/UISnapshot/UISnapshot0630", + "testability/pages/UISnapshot/UISnapshot0620", + "testability/pages/UISnapshot/UISnapshot0610", + "testability/pages/UISnapshot/UISnapshot0600", + "testability/pages/UISnapshot/UISnapshot0590", + "testability/pages/UISnapshot/UISnapshot0580", + "testability/pages/UISnapshot/UISnapshot0570", + "testability/pages/UISnapshot/UISnapshot0560", + "testability/pages/UISnapshot/UISnapshot0290", + "testability/pages/UISnapshot/UISnapshot0280", + "testability/pages/UISnapshot/UISnapshot1080", + "testability/pages/UISnapshot/UISnapshot1090", + "testability/pages/UISnapshot/UISnapshot1100", + "testability/pages/UISnapshot/UISnapshot1110", + "testability/pages/UISnapshot/UISnapshot1120", + "testability/pages/UISnapshot/UISnapshot1130", + "testability/pages/UISnapshot/UISnapshot1140", + "testability/pages/UISnapshot/UISnapshot1150", + "testability/pages/UISnapshot/UISnapshot1160", + "testability/pages/UISnapshot/UISnapshot1170", + "testability/pages/UISnapshot/UISnapshot1180", + "testability/pages/UISnapshot/UISnapshot1190", + "testability/pages/UISnapshot/UISnapshot1210", + "testability/pages/UISnapshot/UISnapshot1200", + "testability/pages/UISnapshot/UISnapshot1220", + "testability/pages/UISnapshot/UISnapshot1230", + "testability/pages/UISnapshot/UISnapshot1240", + "testability/pages/UISnapshot/UISnapshot1250", + "testability/pages/UISnapshot/UISnapshot1260", + "testability/pages/UISnapshot/UISnapshot1270", + "testability/pages/UISnapshot/UISnapshot1280", + "testability/pages/UISnapshot/UISnapshot1290", + "testability/pages/UISnapshot/UISnapshot1300", + "testability/pages/UISnapshot/UISnapshot1310", + "testability/pages/UISnapshot/UISnapshot1320", + "testability/pages/UISnapshot/UISnapshot1330", + "testability/pages/UISnapshot/UISnapshot1340", + "testability/pages/UISnapshot/UISnapshot1350", + "testability/pages/UISnapshot/UISnapshot1360", + "testability/pages/UISnapshot/UISnapshot1370", + "testability/pages/UISnapshot/UISnapshot1380", + "testability/pages/UISnapshot/UISnapshot1390", + "testability/pages/UISnapshot/UISnapshot1400", + "testability/pages/UISnapshot/UISnapshot1410", + "testability/pages/UISnapshot/UISnapshot1430", + "testability/pages/UISnapshot/UISnapshot1440", + "testability/pages/UISnapshot/UISnapshot1450", + "testability/pages/UISnapshot/UISnapshot1460", + "testability/pages/UISnapshot/UISnapshot1470", + "testability/pages/UISnapshot/UISnapshot1480", + "testability/pages/UISnapshot/UISnapshot1490", + "testability/pages/UISnapshot/UISnapshot1500", + "testability/pages/UISnapshot/UISnapshot1510", + "testability/pages/UISnapshot/UISnapshot1520", + "testability/pages/UISnapshot/UISnapshot1530", + "testability/pages/UISnapshot/UISnapshot1540", + "testability/pages/UISnapshot/UISnapshot1550", + "testability/pages/UISnapshot/UISnapshot1560", + "testability/pages/UISnapshot/UISnapshot1580", + "testability/pages/UISnapshot/UISnapshot1820", + "testability/pages/UISnapshot/UISnapshot1830", + "testability/pages/UISnapshot/UISnapshot1850", + "testability/pages/UISnapshot/UISnapshot1840", + "testability/pages/UISnapshot/UISnapshot1860", + "testability/pages/UISnapshot/UISnapshot1870", + "testability/pages/UISnapshot/UISnapshot1880", + "testability/pages/UISnapshot/UISnapshot1890", + "testability/pages/UISnapshot/UISnapshot1960", + "testability/pages/UISnapshot/UISnapshot1970", + "testability/pages/UISnapshot/UISnapshot1980", + "testability/pages/UISnapshot/UISnapshot1990", + "testability/pages/UISnapshot/UISnapshot2000", + "testability/pages/UISnapshot/UISnapshot2010", + "testability/pages/UISnapshot/UISnapshot2020", + "testability/pages/UISnapshot/UISnapshot2030", + "testability/pages/UISnapshot/UISnapshot2040", + "testability/pages/UISnapshot/UISnapshot2050", + "testability/pages/UISnapshot/UISnapshot2060", + "testability/pages/UISnapshot/UISnapshot2070", + "testability/pages/UISnapshot/UISnapshot2080", + "testability/pages/UISnapshot/UISnapshot2090", + "testability/pages/UISnapshot/UISnapshot2100", + "testability/pages/UISnapshot/UISnapshot2110", + "testability/pages/UISnapshot/UISnapshot2120", + "testability/pages/UISnapshot/UISnapshot2130", + "testability/pages/UISnapshot/UISnapshot2140", + "testability/pages/UISnapshot/UISnapshot2150", + "testability/pages/UISnapshot/UISnapshot2160", + "testability/pages/UISnapshot/UISnapshot2170", + "testability/pages/UISnapshot/UISnapshot2180", + "testability/pages/UISnapshot/UISnapshot2190", + "testability/pages/UISnapshot/UISnapshot2200", + "testability/pages/UISnapshot/UISnapshot2210", + "testability/pages/UISnapshot/UISnapshot2220", + "testability/pages/UISnapshot/UISnapshot2230", + "testability/pages/UISnapshot/UISnapshot2240", + "testability/pages/UISnapshot/UISnapshot2250", + "testability/pages/UISnapshot/UISnapshot2260", + "testability/pages/UISnapshot/UISnapshot2270", + "testability/pages/UISnapshot/UISnapshot2280", + "testability/pages/UISnapshot/UISnapshot2290", + "testability/pages/UISnapshot/UISnapshot2300", + "testability/pages/UISnapshot/UISnapshot2310", + "testability/pages/UISnapshot/UISnapshot2320", + "testability/pages/UISnapshot/UISnapshot2330", + "testability/pages/UISnapshot/UISnapshot2340", + "testability/pages/UISnapshot/UISnapshot2350", + "testability/pages/UISnapshot/UISnapshot2360", + "testability/pages/UISnapshot/UISnapshot2370", + "testability/pages/UISnapshot/UISnapshot2380", + "testability/pages/UISnapshot/UISnapshot2390", + "testability/pages/UISnapshot/UISnapshot2400", + "testability/pages/UISnapshot/UISnapshot2410", + "testability/pages/UISnapshot/UISnapshot2420", + "testability/pages/UISnapshot/UISnapshot2430", + "testability/pages/UISnapshot/UISnapshot2440", + "testability/pages/UISnapshot/UISnapshot2510", + "testability/pages/UISnapshot/UISnapshot2520", + "testability/pages/UISnapshot/UISnapshot2530", + "testability/pages/UISnapshot/UISnapshot2540", + "testability/pages/UISnapshot/UISnapshot2550", + "testability/pages/UISnapshot/UISnapshot2560", + "testability/pages/UISnapshot/UISnapshot2570", + "testability/pages/UISnapshot/UISnapshot2580", + "testability/pages/UISnapshot/UISnapshot2590", + "testability/pages/UISnapshot/UISnapshot2600", + "testability/pages/UISnapshot/UISnapshot2610", + "testability/pages/UISnapshot/UISnapshot2620", + "testability/pages/UISnapshot/UISnapshot2630", + "testability/pages/UISnapshot/UISnapshot2640", + "testability/pages/UISnapshot/UISnapshot2650", + "testability/pages/UISnapshot/UISnapshot2660", + "testability/pages/UISnapshot/UISnapshot2670", + "testability/pages/UISnapshot/UISnapshot2680", + "testability/pages/UISnapshot/UISnapshot2690", + "testability/pages/UISnapshot/UISnapshot2700", + "testability/pages/UISnapshot/UISnapshot2710", + "testability/pages/UISnapshot/UISnapshot2720", + "testability/pages/UISnapshot/UISnapshot2730", + "testability/pages/UISnapshot/UISnapshot2740", + "testability/pages/UISnapshot/UISnapshot2750", + "testability/pages/UISnapshot/UISnapshot2760", + "testability/pages/UISnapshot/UISnapshot2770", + "testability/pages/UISnapshot/UISnapshot2780", + "testability/pages/UISnapshot/UISnapshot2790", + "testability/pages/UISnapshot/UISnapshot2800", + "testability/pages/UISnapshot/UISnapshot2810", + "testability/pages/UISnapshot/UISnapshot2820", + "testability/pages/UISnapshot/UISnapshot2830", + "testability/pages/UISnapshot/UISnapshot2840", + "testability/pages/UISnapshot/UISnapshot2860", + "testability/pages/UISnapshot/UISnapshot2940", + "testability/pages/UISnapshot/UISnapshot2950", + "testability/pages/UISnapshot/UISnapshot1770", + "testability/pages/UISnapshot/UISnapshot1750", + "testability/pages/UISnapshot/UISnapshot1670", + "testability/pages/UISnapshot/UISnapshot1690", + "testability/pages/UISnapshot/UISnapshot1640", + "testability/pages/UISnapshot/UISnapshot1630", + "testability/pages/UISnapshot/UISnapshot1660", + "testability/pages/UISnapshot/UISnapshot1650", + "testability/pages/UISnapshot/UISnapshot1680", + "testability/pages/UISnapshot/UISnapshot1700", + "testability/pages/UISnapshot/UISnapshot1730", + "testability/pages/UISnapshot/UISnapshot1740", + "testability/pages/UISnapshot/UISnapshot1710", + "testability/pages/UISnapshot/UISnapshot1720", + "testability/pages/UISnapshot/UISnapshot0150", + "testability/pages/UISnapshot/UISnapshot0130", + "testability/pages/UISnapshot/UISnapshot0050", + "testability/pages/UISnapshot/UISnapshot0070", + "testability/pages/UISnapshot/UISnapshot0020", + "testability/pages/UISnapshot/UISnapshot0010", + "testability/pages/UISnapshot/UISnapshot0040", + "testability/pages/UISnapshot/UISnapshot0030", + "testability/pages/UISnapshot/UISnapshot0060", + "testability/pages/UISnapshot/UISnapshot0080", + "testability/pages/UISnapshot/UISnapshot0110", + "testability/pages/UISnapshot/UISnapshot0120", + "testability/pages/UISnapshot/UISnapshot0090", + "testability/pages/UISnapshot/UISnapshot0100", + "testability/pages/UISnapshot/UISnapshot0340", + "testability/pages/UISnapshot/UISnapshot0320", + "testability/pages/UISnapshot/UISnapshot0240", + "testability/pages/UISnapshot/UISnapshot0260", + "testability/pages/UISnapshot/UISnapshot0210", + "testability/pages/UISnapshot/UISnapshot0200", + "testability/pages/UISnapshot/UISnapshot0230", + "testability/pages/UISnapshot/UISnapshot0220", + "testability/pages/UISnapshot/UISnapshot0250", + "testability/pages/UISnapshot/UISnapshot0270", + "testability/pages/UISnapshot/UISnapshot0300", + "testability/pages/UISnapshot/UISnapshot0310", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0010", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0020", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0030", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0040", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0050", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0060", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0070", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0080", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0090", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0100", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0110", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0120", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0130", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0140", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0150", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0160", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0170", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0180", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0190", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0200", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0210", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0220", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0230", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0240", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0250", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0260", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0270", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0280", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0290", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0300", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0310", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0320", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0330", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0340", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0350", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0360", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0370", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0380", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0390", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0400", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0410", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0420", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0430", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0440", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0450", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0460", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0470", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0480", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0490", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0500", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0510", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0520", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0530", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0540", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0550", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0560", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0570", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0580", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0590", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0600", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0610", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0620", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0630", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0640", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0650", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0660", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0670", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0680", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0690", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0700", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0710", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0720", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0730", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0740", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0750", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0760", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0770", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0780", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0790", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0800", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0810", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0820", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0830", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0840", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0850", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0860", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0870", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0880", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0890", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0900", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0910", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0920", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0930", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0940", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0950", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0960", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0970", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0980", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute0990", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1000", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1010", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1020", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1030", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1040", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1050", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1060", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1070", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1080", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1090", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1100", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1110", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1120", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1130", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1140", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1150", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1160", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1170", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1180", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1190", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1200", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1210", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1220", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1230", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1240", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1250", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1260", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1270", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1280", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1290", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1300", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1310", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1320", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1330", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1340", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1350", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1360", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1370", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1380", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1390", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1400", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1410", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1420", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1430", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1440", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1450", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1460", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1470", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1480", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1490", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1500", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1510", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1520", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1530", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1540", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1550", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1560", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1570", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1580", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1590", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1600", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1610", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1620", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1630", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1640", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1650", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1660", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1670", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1680", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1690", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1700", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1710", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1720", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1730", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1740", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1750", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1760", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1770", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1780", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1790", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1800", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1810", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1820", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1830", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1840", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1850", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1860", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1870", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1880", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1890", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1900", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1910", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1920", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1930", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1940", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1950", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1960", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1970", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1980", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute1990", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2000", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2010", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2020", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2030", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2040", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2050", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2060", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2070", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2080", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2090", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2100", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2110", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2120", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2130", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2140", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2150", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2160", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2170", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2180", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2190", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2200", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2210", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2220", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2230", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2240", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2250", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2260", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2270", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2280", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2290", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2300", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2310", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2320", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2330", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2340", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2350", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2360", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2370", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2380", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2390", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2400", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2410", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2420", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2430", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2440", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2450", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2460", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2470", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2480", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2490", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2500", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2510", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2520", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0100", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0170", + "testability/pages/UIComponentCommonattrDrawingoptimization/UIComponentCommonattrDrawingoptimization0090", + "testability/pages/UIComponentSnapshotAttribute/UIComponentSnapshotAttribute2530", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0200", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0220", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0170", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0130", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0190", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0180", + "testability/pages/UIComponentCommonattrResult/UIComponentCommonattrResult0120", + "testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse001", + "testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse003", + "testability/pages/UIComponentCommonattrClearfocuse/UIComponentCommonattrClearfocuse002", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0010", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0020", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0030", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0040", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0050", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0060", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0070", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0080", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0090", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0100", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0110", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0120", + "testability/pages/ActionEventAttributeModifier/ActionEventAttributeModifier0130", + "testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0020", + "testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0030", + "testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0080", + "testability/pages/ActionEventCommoneventEventInterface/ActionEventCommoneventEventInterface0170", + "testability/pages/UISnapshot/UISnapshot0140", + "testability/pages/UISnapshot/UISnapshot0160", + "testability/pages/UISnapshot/UISnapshot0170", + "testability/pages/UISnapshot/UISnapshot0180", + "testability/pages/UISnapshot/UISnapshot0190", + "testability/pages/UISnapshot/UISnapshot0330", + "testability/pages/UISnapshot/UISnapshot0350", + "testability/pages/UISnapshot/UISnapshot0360", + "testability/pages/UISnapshot/UISnapshot0370", + "testability/pages/UISnapshot/UISnapshot0380", + "testability/pages/UISnapshot/UISnapshot0390", + "testability/pages/UISnapshot/UISnapshot0400", + "testability/pages/UISnapshot/UISnapshot0410", + "testability/pages/UISnapshot/UISnapshot0420", + "testability/pages/UISnapshot/UISnapshot0430", + "testability/pages/UISnapshot/UISnapshot0440", + "testability/pages/UISnapshot/UISnapshot0450", + "testability/pages/UISnapshot/UISnapshot0460", + "testability/pages/UISnapshot/UISnapshot0530", + "testability/pages/UISnapshot/UISnapshot0540", + "testability/pages/UISnapshot/UISnapshot0550", + "testability/pages/UISnapshot/UISnapshot0910", + "testability/pages/UISnapshot/UISnapshot0920", + "testability/pages/UISnapshot/UISnapshot0930", + "testability/pages/UISnapshot/UISnapshot0940", + "testability/pages/UISnapshot/UISnapshot0950", + "testability/pages/UISnapshot/UISnapshot0960", + "testability/pages/UISnapshot/UISnapshot0970", + "testability/pages/UISnapshot/UISnapshot0980", + "testability/pages/UISnapshot/UISnapshot0990", + "testability/pages/UISnapshot/UISnapshot1000", + "testability/pages/UISnapshot/UISnapshot1010", + "testability/pages/UISnapshot/UISnapshot1570", + "testability/pages/UISnapshot/UISnapshot1590", + "testability/pages/UISnapshot/UISnapshot1600", + "testability/pages/UISnapshot/UISnapshot1610", + "testability/pages/UISnapshot/UISnapshot1620", + "testability/pages/UISnapshot/UISnapshot1760", + "testability/pages/UISnapshot/UISnapshot1780", + "testability/pages/UISnapshot/UISnapshot1790", + "testability/pages/UISnapshot/UISnapshot1810", + "testability/pages/UISnapshot/UISnapshot1800", + "testability/pages/UISnapshot/UISnapshot2870", + "testability/pages/UISnapshot/UISnapshot2880" + ] +} diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/cat.jpg b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/cat.jpg new file mode 100644 index 0000000000000000000000000000000000000000..382ac7dc322871219388ca27f7c637447e8c9e77 Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/cat.jpg differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/font/own.ttf b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/font/own.ttf new file mode 100644 index 0000000000000000000000000000000000000000..aeddad7edaf7ec4d01f12a74b88a8ab20b9a068c Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/font/own.ttf differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/font/own1.ttf b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/font/own1.ttf new file mode 100644 index 0000000000000000000000000000000000000000..d8bf101deb779b9436f6d5ebb756757942ac84ed Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/font/own1.ttf differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/font/own2.TTF b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/font/own2.TTF new file mode 100644 index 0000000000000000000000000000000000000000..7e41fddd46e867ad55f7033ade8bb3bc26a5e21b Binary files /dev/null and b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/font/own2.TTF differ diff --git a/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/string.json b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d1049d56ac4487a3f44a6e5e0b26117519e7ea43 --- /dev/null +++ b/function/ui_compare_rh/uicompare/entry/src/ohosTest/resources/rawfile/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "rawfile_string", + "value": "10vp" + } + ] +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/hvigor/hvigor-config.json5 b/function/ui_compare_rh/uicompare/hvigor/hvigor-config.json5 new file mode 100644 index 0000000000000000000000000000000000000000..64655e6970c2acdf5708226c4d5a584ca52b6f37 --- /dev/null +++ b/function/ui_compare_rh/uicompare/hvigor/hvigor-config.json5 @@ -0,0 +1,6 @@ +{ + "hvigorVersion": "3.2.4", + "dependencies": { + "@ohos/hvigor-ohos-plugin": "3.2.4" + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/hvigor/hvigor-wrapper.js b/function/ui_compare_rh/uicompare/hvigor/hvigor-wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..372eae8eb4a124095936f9cd78df5c6756746f3f --- /dev/null +++ b/function/ui_compare_rh/uicompare/hvigor/hvigor-wrapper.js @@ -0,0 +1 @@ +"use strict";var u=require("path"),D=require("os"),e=require("fs"),t=require("crypto"),r=require("child_process"),n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i={},C={},F=n&&n.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(C,"__esModule",{value:!0}),C.maxPathLength=C.isMac=C.isLinux=C.isWindows=void 0;const E=F(D),A="Windows_NT",o="Darwin";function a(){return E.default.type()===A}function c(){return E.default.type()===o}C.isWindows=a,C.isLinux=function(){return"Linux"===E.default.type()},C.isMac=c,C.maxPathLength=function(){return c()?1016:a()?259:4095},function(e){var t=n&&n.__createBinding||(Object.create?function(u,D,e,t){void 0===t&&(t=e);var r=Object.getOwnPropertyDescriptor(D,e);r&&!("get"in r?!D.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return D[e]}}),Object.defineProperty(u,t,r)}:function(u,D,e,t){void 0===t&&(t=e),u[t]=D[e]}),r=n&&n.__setModuleDefault||(Object.create?function(u,D){Object.defineProperty(u,"default",{enumerable:!0,value:D})}:function(u,D){u.default=D}),i=n&&n.__importStar||function(u){if(u&&u.__esModule)return u;var D={};if(null!=u)for(var e in u)"default"!==e&&Object.prototype.hasOwnProperty.call(u,e)&&t(D,u,e);return r(D,u),D};Object.defineProperty(e,"__esModule",{value:!0}),e.WORK_SPACE=e.HVIGOR_PROJECT_WRAPPER_HOME=e.HVIGOR_PROJECT_ROOT_DIR=e.HVIGOR_PROJECT_CACHES_HOME=e.HVIGOR_PNPM_STORE_PATH=e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=e.PROJECT_CACHES=e.HVIGOR_WRAPPER_TOOLS_HOME=e.HVIGOR_USER_HOME=e.DEFAULT_PACKAGE_JSON=e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME=e.PNPM=e.HVIGOR=e.NPM_TOOL=e.PNPM_TOOL=e.HVIGOR_ENGINE_PACKAGE_NAME=void 0;const F=i(D),E=i(u),A=C;e.HVIGOR_ENGINE_PACKAGE_NAME="@ohos/hvigor",e.PNPM_TOOL=(0,A.isWindows)()?"pnpm.cmd":"pnpm",e.NPM_TOOL=(0,A.isWindows)()?"npm.cmd":"npm",e.HVIGOR="hvigor",e.PNPM="pnpm",e.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME="hvigor-config.json5",e.DEFAULT_PACKAGE_JSON="package.json",e.HVIGOR_USER_HOME=E.resolve(F.homedir(),".hvigor"),e.HVIGOR_WRAPPER_TOOLS_HOME=E.resolve(e.HVIGOR_USER_HOME,"wrapper","tools"),e.PROJECT_CACHES="project_caches",e.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH=E.resolve(e.HVIGOR_WRAPPER_TOOLS_HOME,"node_modules",".bin",e.PNPM_TOOL),e.HVIGOR_PNPM_STORE_PATH=E.resolve(e.HVIGOR_USER_HOME,"caches"),e.HVIGOR_PROJECT_CACHES_HOME=E.resolve(e.HVIGOR_USER_HOME,e.PROJECT_CACHES),e.HVIGOR_PROJECT_ROOT_DIR=process.cwd(),e.HVIGOR_PROJECT_WRAPPER_HOME=E.resolve(e.HVIGOR_PROJECT_ROOT_DIR,e.HVIGOR),e.WORK_SPACE="workspace"}(i);var s={},l={};Object.defineProperty(l,"__esModule",{value:!0}),l.logInfoPrintConsole=l.logErrorAndExit=void 0,l.logErrorAndExit=function(u){u instanceof Error?console.error(u.message):console.error(u),process.exit(-1)},l.logInfoPrintConsole=function(u){console.log(u)};var B=n&&n.__createBinding||(Object.create?function(u,D,e,t){void 0===t&&(t=e);var r=Object.getOwnPropertyDescriptor(D,e);r&&!("get"in r?!D.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return D[e]}}),Object.defineProperty(u,t,r)}:function(u,D,e,t){void 0===t&&(t=e),u[t]=D[e]}),d=n&&n.__setModuleDefault||(Object.create?function(u,D){Object.defineProperty(u,"default",{enumerable:!0,value:D})}:function(u,D){u.default=D}),f=n&&n.__importStar||function(u){if(u&&u.__esModule)return u;var D={};if(null!=u)for(var e in u)"default"!==e&&Object.prototype.hasOwnProperty.call(u,e)&&B(D,u,e);return d(D,u),D};Object.defineProperty(s,"__esModule",{value:!0});var _=s.executeBuild=void 0;const p=f(e),O=f(u),h=l;_=s.executeBuild=function(u){const D=O.resolve(u,"node_modules","@ohos","hvigor","bin","hvigor.js");try{const u=p.realpathSync(D);require(u)}catch(e){(0,h.logErrorAndExit)(`Error: ENOENT: no such file ${D},delete ${u} and retry.`)}};var P={},v={};!function(u){var D=n&&n.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(u,"__esModule",{value:!0}),u.hashFile=u.hash=u.createHash=void 0;const r=D(t),i=D(e);u.createHash=(u="MD5")=>r.default.createHash(u);u.hash=(D,e)=>(0,u.createHash)(e).update(D).digest("hex");u.hashFile=(D,e)=>{if(i.default.existsSync(D))return(0,u.hash)(i.default.readFileSync(D,"utf-8"),e)}}(v);var g={},m={},R={};Object.defineProperty(R,"__esModule",{value:!0}),R.Unicode=void 0;class y{}R.Unicode=y,y.SPACE_SEPARATOR=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,y.ID_START=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,y.ID_CONTINUE=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,Object.defineProperty(m,"__esModule",{value:!0}),m.JudgeUtil=void 0;const I=R;m.JudgeUtil=class{static isIgnoreChar(u){return"string"==typeof u&&("\t"===u||"\v"===u||"\f"===u||" "===u||" "===u||"\ufeff"===u||"\n"===u||"\r"===u||"\u2028"===u||"\u2029"===u)}static isSpaceSeparator(u){return"string"==typeof u&&I.Unicode.SPACE_SEPARATOR.test(u)}static isIdStartChar(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||I.Unicode.ID_START.test(u))}static isIdContinueChar(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||"‌"===u||"‍"===u||I.Unicode.ID_CONTINUE.test(u))}static isDigitWithoutZero(u){return/[1-9]/.test(u)}static isDigit(u){return"string"==typeof u&&/[0-9]/.test(u)}static isHexDigit(u){return"string"==typeof u&&/[0-9A-Fa-f]/.test(u)}};var N=n&&n.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(g,"__esModule",{value:!0}),g.parseJsonText=g.parseJsonFile=void 0;const b=N(e),S=N(D),w=N(u),H=m;var x;!function(u){u[u.Char=0]="Char",u[u.EOF=1]="EOF",u[u.Identifier=2]="Identifier"}(x||(x={}));let M,T,V,G,j,J,W="start",U=[],L=0,$=1,k=0,K=!1,z="default",q="'",Z=1;function X(u,D=!1){T=String(u),W="start",U=[],L=0,$=1,k=0,G=void 0,K=D;do{M=Q(),nu[W]()}while("eof"!==M.type);return G}function Q(){for(z="default",j="",q="'",Z=1;;){J=Y();const u=Du[z]();if(u)return u}}function Y(){if(T[L])return String.fromCodePoint(T.codePointAt(L))}function uu(){const u=Y();return"\n"===u?($++,k=0):u?k+=u.length:k++,u&&(L+=u.length),u}g.parseJsonFile=function(u,D=!1,e="utf-8"){const t=b.default.readFileSync(w.default.resolve(u),{encoding:e});try{return X(t,D)}catch(D){if(D instanceof SyntaxError){const e=D.message.split("at");if(2===e.length)throw new Error(`${e[0].trim()}${S.default.EOL}\t at ${u}:${e[1].trim()}`)}throw new Error(`${u} is not in valid JSON/JSON5 format.`)}},g.parseJsonText=X;const Du={default(){switch(J){case"/":return uu(),void(z="comment");case void 0:return uu(),eu("eof")}if(!H.JudgeUtil.isIgnoreChar(J)&&!H.JudgeUtil.isSpaceSeparator(J))return Du[W]();uu()},start(){z="value"},beforePropertyName(){switch(J){case"$":case"_":return j=uu(),void(z="identifierName");case"\\":return uu(),void(z="identifierNameStartEscape");case"}":return eu("punctuator",uu());case'"':case"'":return q=J,uu(),void(z="string")}if(H.JudgeUtil.isIdStartChar(J))return j+=uu(),void(z="identifierName");throw Eu(x.Char,uu())},afterPropertyName(){if(":"===J)return eu("punctuator",uu());throw Eu(x.Char,uu())},beforePropertyValue(){z="value"},afterPropertyValue(){switch(J){case",":case"}":return eu("punctuator",uu())}throw Eu(x.Char,uu())},beforeArrayValue(){if("]"===J)return eu("punctuator",uu());z="value"},afterArrayValue(){switch(J){case",":case"]":return eu("punctuator",uu())}throw Eu(x.Char,uu())},end(){throw Eu(x.Char,uu())},comment(){switch(J){case"*":return uu(),void(z="multiLineComment");case"/":return uu(),void(z="singleLineComment")}throw Eu(x.Char,uu())},multiLineComment(){switch(J){case"*":return uu(),void(z="multiLineCommentAsterisk");case void 0:throw Eu(x.Char,uu())}uu()},multiLineCommentAsterisk(){switch(J){case"*":return void uu();case"/":return uu(),void(z="default");case void 0:throw Eu(x.Char,uu())}uu(),z="multiLineComment"},singleLineComment(){switch(J){case"\n":case"\r":case"\u2028":case"\u2029":return uu(),void(z="default");case void 0:return uu(),eu("eof")}uu()},value(){switch(J){case"{":case"[":return eu("punctuator",uu());case"n":return uu(),tu("ull"),eu("null",null);case"t":return uu(),tu("rue"),eu("boolean",!0);case"f":return uu(),tu("alse"),eu("boolean",!1);case"-":case"+":return"-"===uu()&&(Z=-1),void(z="numerical");case".":case"0":case"I":case"N":return void(z="numerical");case'"':case"'":return q=J,uu(),j="",void(z="string")}if(void 0===J||!H.JudgeUtil.isDigitWithoutZero(J))throw Eu(x.Char,uu());z="numerical"},numerical(){switch(J){case".":return j=uu(),void(z="decimalPointLeading");case"0":return j=uu(),void(z="zero");case"I":return uu(),tu("nfinity"),eu("numeric",Z*(1/0));case"N":return uu(),tu("aN"),eu("numeric",NaN)}if(void 0!==J&&H.JudgeUtil.isDigitWithoutZero(J))return j=uu(),void(z="decimalInteger");throw Eu(x.Char,uu())},zero(){switch(J){case".":case"e":case"E":return void(z="decimal");case"x":case"X":return j+=uu(),void(z="hexadecimal")}return eu("numeric",0)},decimalInteger(){switch(J){case".":case"e":case"E":return void(z="decimal")}if(!H.JudgeUtil.isDigit(J))return eu("numeric",Z*Number(j));j+=uu()},decimal(){switch(J){case".":j+=uu(),z="decimalFraction";break;case"e":case"E":j+=uu(),z="decimalExponent"}},decimalPointLeading(){if(H.JudgeUtil.isDigit(J))return j+=uu(),void(z="decimalFraction");throw Eu(x.Char,uu())},decimalFraction(){switch(J){case"e":case"E":return j+=uu(),void(z="decimalExponent")}if(!H.JudgeUtil.isDigit(J))return eu("numeric",Z*Number(j));j+=uu()},decimalExponent(){switch(J){case"+":case"-":return j+=uu(),void(z="decimalExponentSign")}if(H.JudgeUtil.isDigit(J))return j+=uu(),void(z="decimalExponentInteger");throw Eu(x.Char,uu())},decimalExponentSign(){if(H.JudgeUtil.isDigit(J))return j+=uu(),void(z="decimalExponentInteger");throw Eu(x.Char,uu())},decimalExponentInteger(){if(!H.JudgeUtil.isDigit(J))return eu("numeric",Z*Number(j));j+=uu()},hexadecimal(){if(H.JudgeUtil.isHexDigit(J))return j+=uu(),void(z="hexadecimalInteger");throw Eu(x.Char,uu())},hexadecimalInteger(){if(!H.JudgeUtil.isHexDigit(J))return eu("numeric",Z*Number(j));j+=uu()},identifierNameStartEscape(){if("u"!==J)throw Eu(x.Char,uu());uu();const u=ru();switch(u){case"$":case"_":break;default:if(!H.JudgeUtil.isIdStartChar(u))throw Eu(x.Identifier)}j+=u,z="identifierName"},identifierName(){switch(J){case"$":case"_":case"‌":case"‍":return void(j+=uu());case"\\":return uu(),void(z="identifierNameEscape")}if(!H.JudgeUtil.isIdContinueChar(J))return eu("identifier",j);j+=uu()},identifierNameEscape(){if("u"!==J)throw Eu(x.Char,uu());uu();const u=ru();switch(u){case"$":case"_":case"‌":case"‍":break;default:if(!H.JudgeUtil.isIdContinueChar(u))throw Eu(x.Identifier)}j+=u,z="identifierName"},string(){switch(J){case"\\":return uu(),void(j+=function(){const u=Y(),D=function(){switch(Y()){case"b":return uu(),"\b";case"f":return uu(),"\f";case"n":return uu(),"\n";case"r":return uu(),"\r";case"t":return uu(),"\t";case"v":return uu(),"\v"}return}();if(D)return D;switch(u){case"0":if(uu(),H.JudgeUtil.isDigit(Y()))throw Eu(x.Char,uu());return"\0";case"x":return uu(),function(){let u="",D=Y();if(!H.JudgeUtil.isHexDigit(D))throw Eu(x.Char,uu());if(u+=uu(),D=Y(),!H.JudgeUtil.isHexDigit(D))throw Eu(x.Char,uu());return u+=uu(),String.fromCodePoint(parseInt(u,16))}();case"u":return uu(),ru();case"\n":case"\u2028":case"\u2029":return uu(),"";case"\r":return uu(),"\n"===Y()&&uu(),""}if(void 0===u||H.JudgeUtil.isDigitWithoutZero(u))throw Eu(x.Char,uu());return uu()}());case'"':case"'":if(J===q){const u=eu("string",j);return uu(),u}return void(j+=uu());case"\n":case"\r":case void 0:throw Eu(x.Char,uu());case"\u2028":case"\u2029":!function(u){console.warn(`JSON5: '${Fu(u)}' in strings is not valid ECMAScript; consider escaping.`)}(J)}j+=uu()}};function eu(u,D){return{type:u,value:D,line:$,column:k}}function tu(u){for(const D of u){if(Y()!==D)throw Eu(x.Char,uu());uu()}}function ru(){let u="",D=4;for(;D-- >0;){const D=Y();if(!H.JudgeUtil.isHexDigit(D))throw Eu(x.Char,uu());u+=uu()}return String.fromCodePoint(parseInt(u,16))}const nu={start(){if("eof"===M.type)throw Eu(x.EOF);iu()},beforePropertyName(){switch(M.type){case"identifier":case"string":return V=M.value,void(W="afterPropertyName");case"punctuator":return void Cu();case"eof":throw Eu(x.EOF)}},afterPropertyName(){if("eof"===M.type)throw Eu(x.EOF);W="beforePropertyValue"},beforePropertyValue(){if("eof"===M.type)throw Eu(x.EOF);iu()},afterPropertyValue(){if("eof"===M.type)throw Eu(x.EOF);switch(M.value){case",":return void(W="beforePropertyName");case"}":Cu()}},beforeArrayValue(){if("eof"===M.type)throw Eu(x.EOF);"punctuator"!==M.type||"]"!==M.value?iu():Cu()},afterArrayValue(){if("eof"===M.type)throw Eu(x.EOF);switch(M.value){case",":return void(W="beforeArrayValue");case"]":Cu()}},end(){}};function iu(){const u=function(){let u;switch(M.type){case"punctuator":switch(M.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=M.value}return u}();if(K&&"object"==typeof u&&(u._line=$,u._column=k),void 0===G)G=u;else{const D=U[U.length-1];Array.isArray(D)?K&&"object"!=typeof u?D.push({value:u,_line:$,_column:k}):D.push(u):D[V]=K&&"object"!=typeof u?{value:u,_line:$,_column:k}:u}!function(u){if(u&&"object"==typeof u)U.push(u),W=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{const u=U[U.length-1];W=u?Array.isArray(u)?"afterArrayValue":"afterPropertyValue":"end"}}(u)}function Cu(){U.pop();const u=U[U.length-1];W=u?Array.isArray(u)?"afterArrayValue":"afterPropertyValue":"end"}function Fu(u){const D={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(D[u])return D[u];if(u<" "){const D=u.charCodeAt(0).toString(16);return`\\x${`00${D}`.substring(D.length)}`}return u}function Eu(u,D){let e="";switch(u){case x.Char:e=void 0===D?`JSON5: invalid end of input at ${$}:${k}`:`JSON5: invalid character '${Fu(D)}' at ${$}:${k}`;break;case x.EOF:e=`JSON5: invalid end of input at ${$}:${k}`;break;case x.Identifier:k-=5,e=`JSON5: invalid identifier character at ${$}:${k}`}const t=new Au(e);return t.lineNumber=$,t.columnNumber=k,t}class Au extends SyntaxError{}var ou={},au=n&&n.__createBinding||(Object.create?function(u,D,e,t){void 0===t&&(t=e);var r=Object.getOwnPropertyDescriptor(D,e);r&&!("get"in r?!D.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return D[e]}}),Object.defineProperty(u,t,r)}:function(u,D,e,t){void 0===t&&(t=e),u[t]=D[e]}),cu=n&&n.__setModuleDefault||(Object.create?function(u,D){Object.defineProperty(u,"default",{enumerable:!0,value:D})}:function(u,D){u.default=D}),su=n&&n.__importStar||function(u){if(u&&u.__esModule)return u;var D={};if(null!=u)for(var e in u)"default"!==e&&Object.prototype.hasOwnProperty.call(u,e)&&au(D,u,e);return cu(D,u),D},lu=n&&n.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(ou,"__esModule",{value:!0}),ou.isFileExists=ou.offlinePluginConversion=ou.executeCommand=ou.getNpmPath=ou.hasNpmPackInPaths=void 0;const Bu=r,du=lu(e),fu=su(u),_u=i,pu=l;ou.hasNpmPackInPaths=function(u,D){try{return require.resolve(u,{paths:[...D]}),!0}catch(u){return!1}},ou.getNpmPath=function(){const u=process.execPath;return fu.join(fu.dirname(u),_u.NPM_TOOL)},ou.executeCommand=function(u,D,e){0!==(0,Bu.spawnSync)(u,D,e).status&&(0,pu.logErrorAndExit)(`Error: ${u} ${D} execute failed.See above for details.`)},ou.offlinePluginConversion=function(u,D){return D.startsWith("file:")||D.endsWith(".tgz")?fu.resolve(u,_u.HVIGOR,D.replace("file:","")):D},ou.isFileExists=function(u){return du.default.existsSync(u)&&du.default.statSync(u).isFile()};var Ou=n&&n.__createBinding||(Object.create?function(u,D,e,t){void 0===t&&(t=e);var r=Object.getOwnPropertyDescriptor(D,e);r&&!("get"in r?!D.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return D[e]}}),Object.defineProperty(u,t,r)}:function(u,D,e,t){void 0===t&&(t=e),u[t]=D[e]}),hu=n&&n.__setModuleDefault||(Object.create?function(u,D){Object.defineProperty(u,"default",{enumerable:!0,value:D})}:function(u,D){u.default=D}),Pu=n&&n.__importStar||function(u){if(u&&u.__esModule)return u;var D={};if(null!=u)for(var e in u)"default"!==e&&Object.prototype.hasOwnProperty.call(u,e)&&Ou(D,u,e);return hu(D,u),D},vu=n&&n.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(P,"__esModule",{value:!0});var gu=P.initProjectWorkSpace=void 0;const mu=Pu(e),Ru=vu(D),yu=Pu(u),Iu=v,Nu=i,bu=g,Su=l,wu=ou;let Hu,xu,Mu;function Tu(u,D,e){return void 0!==e.dependencies&&(0,wu.offlinePluginConversion)(Nu.HVIGOR_PROJECT_ROOT_DIR,D.dependencies[u])===yu.normalize(e.dependencies[u])}function Vu(){const u=yu.join(Mu,Nu.WORK_SPACE);if((0,Su.logInfoPrintConsole)("Hvigor cleaning..."),!mu.existsSync(u))return;const D=mu.readdirSync(u);if(!D||0===D.length)return;const e=yu.resolve(Mu,"node_modules","@ohos","hvigor","bin","hvigor.js");mu.existsSync(e)&&(0,wu.executeCommand)(process.argv[0],[e,"--stop-daemon"],{});try{D.forEach((D=>{mu.rmSync(yu.resolve(u,D),{recursive:!0})}))}catch(D){(0,Su.logErrorAndExit)(`The hvigor build tool cannot be installed. Please manually clear the workspace directory and synchronize the project again.\n\n Workspace Path: ${u}.`)}}gu=P.initProjectWorkSpace=function(){if(Hu=function(){const u=yu.resolve(Nu.HVIGOR_PROJECT_WRAPPER_HOME,Nu.DEFAULT_HVIGOR_CONFIG_JSON_FILE_NAME);mu.existsSync(u)||(0,Su.logErrorAndExit)(`Error: Hvigor config file ${u} does not exist.`);return(0,bu.parseJsonFile)(u)}(),Mu=function(u){let D;D=function(u){let D=u.hvigorVersion;if(D.startsWith("file:")||D.endsWith(".tgz"))return!1;const e=u.dependencies,t=Object.getOwnPropertyNames(e);for(const u of t){const D=e[u];if(D.startsWith("file:")||D.endsWith(".tgz"))return!1}if(1===t.length&&"@ohos/hvigor-ohos-plugin"===t[0])return D>"2.5.0";return!1}(u)?function(u){let D=`${Nu.HVIGOR_ENGINE_PACKAGE_NAME}@${u.hvigorVersion}`;const e=u.dependencies;if(e){Object.getOwnPropertyNames(e).sort().forEach((u=>{D+=`,${u}@${e[u]}`}))}return(0,Iu.hash)(D)}(u):(0,Iu.hash)(process.cwd());return yu.resolve(Ru.default.homedir(),".hvigor","project_caches",D)}(Hu),xu=function(){const u=yu.resolve(Mu,Nu.WORK_SPACE,Nu.DEFAULT_PACKAGE_JSON);return mu.existsSync(u)?(0,bu.parseJsonFile)(u):{dependencies:{}}}(),!(0,wu.hasNpmPackInPaths)(Nu.HVIGOR_ENGINE_PACKAGE_NAME,[yu.join(Mu,Nu.WORK_SPACE)])||(0,wu.offlinePluginConversion)(Nu.HVIGOR_PROJECT_ROOT_DIR,Hu.hvigorVersion)!==xu.dependencies[Nu.HVIGOR_ENGINE_PACKAGE_NAME]||!function(){function u(u){const D=null==u?void 0:u.dependencies;return void 0===D?0:Object.getOwnPropertyNames(D).length}const D=u(Hu),e=u(xu);if(D+1!==e)return!1;for(const u in null==Hu?void 0:Hu.dependencies)if(!(0,wu.hasNpmPackInPaths)(u,[yu.join(Mu,Nu.WORK_SPACE)])||!Tu(u,Hu,xu))return!1;return!0}()){Vu();try{!function(){(0,Su.logInfoPrintConsole)("Hvigor installing...");for(const u in Hu.dependencies)Hu.dependencies[u]&&(Hu.dependencies[u]=(0,wu.offlinePluginConversion)(Nu.HVIGOR_PROJECT_ROOT_DIR,Hu.dependencies[u]));const u={dependencies:{...Hu.dependencies}};u.dependencies[Nu.HVIGOR_ENGINE_PACKAGE_NAME]=(0,wu.offlinePluginConversion)(Nu.HVIGOR_PROJECT_ROOT_DIR,Hu.hvigorVersion);const D=yu.join(Mu,Nu.WORK_SPACE);try{mu.mkdirSync(D,{recursive:!0});const e=yu.resolve(D,Nu.DEFAULT_PACKAGE_JSON);mu.writeFileSync(e,JSON.stringify(u))}catch(u){(0,Su.logErrorAndExit)(u)}(function(){const u=["config","set","store-dir",Nu.HVIGOR_PNPM_STORE_PATH],D={cwd:yu.join(Mu,Nu.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,wu.executeCommand)(Nu.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,u,D)})(),function(){const u=["install"],D={cwd:yu.join(Mu,Nu.WORK_SPACE),stdio:["inherit","inherit","inherit"]};(0,wu.executeCommand)(Nu.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH,u,D)}(),(0,Su.logInfoPrintConsole)("Hvigor install success.")}()}catch(u){Vu()}}return Mu};var Gu={};!function(t){var C=n&&n.__createBinding||(Object.create?function(u,D,e,t){void 0===t&&(t=e);var r=Object.getOwnPropertyDescriptor(D,e);r&&!("get"in r?!D.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return D[e]}}),Object.defineProperty(u,t,r)}:function(u,D,e,t){void 0===t&&(t=e),u[t]=D[e]}),F=n&&n.__setModuleDefault||(Object.create?function(u,D){Object.defineProperty(u,"default",{enumerable:!0,value:D})}:function(u,D){u.default=D}),E=n&&n.__importStar||function(u){if(u&&u.__esModule)return u;var D={};if(null!=u)for(var e in u)"default"!==e&&Object.prototype.hasOwnProperty.call(u,e)&&C(D,u,e);return F(D,u),D},A=n&&n.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(t,"__esModule",{value:!0}),t.executeInstallPnpm=t.isPnpmInstalled=t.environmentHandler=t.checkNpmConifg=t.PNPM_VERSION=void 0;const o=r,a=E(e),c=A(D),s=E(u),B=i,d=l,f=ou;t.PNPM_VERSION="7.30.0",t.checkNpmConifg=function(){const u=s.resolve(B.HVIGOR_PROJECT_ROOT_DIR,".npmrc"),D=s.resolve(c.default.homedir(),".npmrc");if((0,f.isFileExists)(u)||(0,f.isFileExists)(D))return;const e=(0,f.getNpmPath)(),t=(0,o.spawnSync)(e,["config","get","prefix"],{cwd:B.HVIGOR_PROJECT_ROOT_DIR});if(0!==t.status||!t.stdout)return void(0,d.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.");const r=s.resolve(`${t.stdout}`.replace(/[\r\n]/gi,""),".npmrc");(0,f.isFileExists)(r)||(0,d.logErrorAndExit)("Error: The hvigor depends on the npmrc file. Configure the npmrc file first.")},t.environmentHandler=function(){process.env["npm_config_update-notifier"]="false"},t.isPnpmInstalled=function(){return!!a.existsSync(B.HVIGOR_WRAPPER_PNPM_SCRIPT_PATH)&&(0,f.hasNpmPackInPaths)("pnpm",[B.HVIGOR_WRAPPER_TOOLS_HOME])},t.executeInstallPnpm=function(){(0,d.logInfoPrintConsole)(`Installing pnpm@${t.PNPM_VERSION}...`);const u=(0,f.getNpmPath)();!function(){const u=s.resolve(B.HVIGOR_WRAPPER_TOOLS_HOME,B.DEFAULT_PACKAGE_JSON);try{a.existsSync(B.HVIGOR_WRAPPER_TOOLS_HOME)||a.mkdirSync(B.HVIGOR_WRAPPER_TOOLS_HOME,{recursive:!0});const D={dependencies:{}};D.dependencies[B.PNPM]=t.PNPM_VERSION,a.writeFileSync(u,JSON.stringify(D))}catch(D){(0,d.logErrorAndExit)(`Error: EPERM: operation not permitted,create ${u} failed.`)}}(),(0,f.executeCommand)(u,["install","pnpm"],{cwd:B.HVIGOR_WRAPPER_TOOLS_HOME,stdio:["inherit","inherit","inherit"],env:process.env}),(0,d.logInfoPrintConsole)("Pnpm install success.")}}(Gu),function(){Gu.checkNpmConifg(),Gu.environmentHandler(),Gu.isPnpmInstalled()||Gu.executeInstallPnpm();const D=gu();_(u.join(D,i.WORK_SPACE))}(); \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/hvigorfile.ts b/function/ui_compare_rh/uicompare/hvigorfile.ts new file mode 100644 index 0000000000000000000000000000000000000000..6478186902c0c1ad7c966a929c7d6b7d8ae7a9f3 --- /dev/null +++ b/function/ui_compare_rh/uicompare/hvigorfile.ts @@ -0,0 +1,2 @@ +// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. +export { appTasks } from '@ohos/hvigor-ohos-plugin'; \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/hvigorw b/function/ui_compare_rh/uicompare/hvigorw new file mode 100644 index 0000000000000000000000000000000000000000..54aadd226b453397860013d328fd01031648fc31 --- /dev/null +++ b/function/ui_compare_rh/uicompare/hvigorw @@ -0,0 +1,48 @@ +#!/bin/bash + +# ---------------------------------------------------------------------------- +# Hvigor startup script, version 1.0.0 +# +# Required ENV vars: +# ------------------ +# NODE_HOME - location of a Node home dir +# or +# Add /usr/local/nodejs/bin to the PATH environment variable +# ---------------------------------------------------------------------------- + +HVIGOR_APP_HOME=$(dirname $(readlink -f $0)) +HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js +warn() { + echo "" + echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +error() { + echo "" + echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m" +} + +fail() { + error "$@" + exit 1 +} + +# Determine node to start hvigor wrapper script +if [ -n "${NODE_HOME}" ];then + EXECUTABLE_NODE="${NODE_HOME}/bin/node" + if [ ! -x "$EXECUTABLE_NODE" ];then + fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed" + fi +else + EXECUTABLE_NODE="node" + which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path" +fi + +# Check hvigor wrapper script +if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then + fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}" +fi + +# start hvigor-wrapper script +exec "${EXECUTABLE_NODE}" \ + "${HVIGOR_WRAPPER_SCRIPT}" "$@" diff --git a/function/ui_compare_rh/uicompare/hvigorw.bat b/function/ui_compare_rh/uicompare/hvigorw.bat new file mode 100644 index 0000000000000000000000000000000000000000..6861293e47dfd0186da380321b73be9033507e24 --- /dev/null +++ b/function/ui_compare_rh/uicompare/hvigorw.bat @@ -0,0 +1,64 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Hvigor startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js +set NODE_EXE=node.exe + +goto start + +:start +@rem Find node.exe +if defined NODE_HOME goto findNodeFromNodeHome + +%NODE_EXE% --version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:findNodeFromNodeHome +set NODE_HOME=%NODE_HOME:"=% +set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE% + +if exist "%NODE_EXE_PATH%" goto execute +echo. +echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH. +echo. +echo Please set the NODE_HOME variable in your environment to match the +echo location of your NodeJs installation. + +goto fail + +:execute +@rem Execute hvigor +"%NODE_EXE%" %WRAPPER_MODULE_PATH% %* + +if "%ERRORLEVEL%" == "0" goto hvigorwEnd + +:fail +exit /b 1 + +:hvigorwEnd +if "%OS%" == "Windows_NT" endlocal + +:end diff --git a/function/ui_compare_rh/uicompare/oh-package-lock.json5 b/function/ui_compare_rh/uicompare/oh-package-lock.json5 new file mode 100644 index 0000000000000000000000000000000000000000..1faa6b99d48e66baa345e65d2fa943a546f91182 --- /dev/null +++ b/function/ui_compare_rh/uicompare/oh-package-lock.json5 @@ -0,0 +1,15 @@ +{ + "lockfileVersion": 2, + "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", + "specifiers": { + "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6" + }, + "packages": { + "@ohos/hypium@1.0.6": { + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", + "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==", + "registryType": "ohpm", + "shasum": "3f5fed65372633233264b3447705b0831dfe7ea1" + } + } +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare/oh-package.json5 b/function/ui_compare_rh/uicompare/oh-package.json5 new file mode 100644 index 0000000000000000000000000000000000000000..e9c1666457f6b9c0b559b1e7098db3085e4a5d9d --- /dev/null +++ b/function/ui_compare_rh/uicompare/oh-package.json5 @@ -0,0 +1,13 @@ +{ + "modelVersion": "5.0.0", + "license": "", + "devDependencies": { + "@ohos/hypium": "1.0.16" + }, + "author": "", + "name": "uicompare", + "description": "Please describe the basic information.", + "main": "", + "version": "1.0.0", + "dependencies": {} +} \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare_tools/UiCompareTools_progress.py b/function/ui_compare_rh/uicompare_tools/UiCompareTools_progress.py new file mode 100644 index 0000000000000000000000000000000000000000..94ec622d4d9466e428eac2b5906a3df2745984bb --- /dev/null +++ b/function/ui_compare_rh/uicompare_tools/UiCompareTools_progress.py @@ -0,0 +1,2810 @@ +# -*- coding:utf-8 -*- + +import os + +import sys + +import time + +import json + +import openpyxl + +import threading + +import subprocess + +import filecmp + +import shutil + +from multiprocessing import Manager, Pool, Process + +import numpy as np + +from datetime import datetime + +from PIL import Image + +from PIL import ImageChops + +from itertools import product + + + +import argparse + +parser = argparse.ArgumentParser(description='manual to this script') + +parser.add_argument("--type", type=str) + +parser.add_argument("--excel", type=str) + +parser.add_argument("--dir", type=str) + +parser.add_argument("--hap", type=str) + +parser.add_argument("--json", type=str) + +args = parser.parse_args() + +mode = args.type + +excel_path = args.excel + +base_path = args.dir + +hap_path = args.hap + +json_path = args.json + + + +new_time = time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time())) + +now_time = str(new_time) + +dir_path = os.path.dirname(os.path.abspath(__file__)) + +reports_path = os.path.join(dir_path, "reports") + +html_path = "./mode.html" + +run_json_path = os.path.join(reports_path, "run_json_" + now_time) + +run_report_path = os.path.join(reports_path, "run_report_{}.html".format(now_time)) + +diff_report_path = os.path.join(reports_path, "diff_report_{}.html".format(now_time)) + +device_list = [] + +image_size_diff = [] + + + +def get_file_list(file_path, file_key): + + # 返回指定文件夹file_path下所有的特定文件名列表 + + file_list = [] + + if os.path.isdir(file_path) == False: + + print("当前路径{}非文件夹,请重新输入正确的文件夹路径后重试".format(file_path)) + + return [] + + elif os.path.exists(file_path) == False: + + print("当前路径{}不存在,请重新输入正确的文件夹路径后重试".format(file_path)) + + return [] + + for file in os.listdir(file_path): + + if file.endswith(file_key): + + file_list.append(file) + + return file_list + + + + + +def write_report_html(data, mode="0", image_path=""): + + if os.path.exists(html_path) == False: + + print("模板html不存在,未生成html报告") + + return + + if mode == "0": + + shutil.copy(html_path, run_report_path) + + module_data = "" + + total_data = "" + + print("report_data: ", data) + + for key, value in data.items(): + + if key == "Total_data": + + with open(run_report_path, "a") as f: + + f.write("""Save Image Path: + + + + + + + + + + + + + + + + + +
""" + image_path + """
Test Start/ End Time:""" + value["start_end_time"] + """Execution Time:""" + value["run_time"] + """
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MOUDULESTOTAL_TESTSPASSCASE_FAILGET_FAILPASS_RATE
""" + value["moudle_count"] + """""" + value["Total"] + """""" + value["Pass"] + """""" + value["Case_fail"] + """""" + value["Get_fail"] + """""" + value["Pass_rate"] + """
+ + + +""") + + else: + + if isinstance(value, int): + + continue + + total_data += """ + + + + """ + key + """ + + """ + str(value["Total"]) + """ + + """ + str(value["Pass"]) + """ + + """ + str(value["Case_fail"]) + """ + + """ + str(value["Get_fail"]) + """ + + """ + value["Pass_rate"] + """ + + + +""" + + title_flag = True + + for case_name, run_result, use_time in value["result_list"]: + + if run_result == "PASS": + + # 仅展示执行失败用例,执行成功的用例不展示 + + continue + + elif title_flag == True: + + module_data += """ + + + + + + + + + +
+ + """ + key + """ + +
+ + + + + + + + + + + + + + + + """ + + title_flag = False + + module_data += """ + + + + + + + + + + """ + + if title_flag == False: + + module_data += """ + +
ModuleTestsuiteTestcaseResult
""" + key + """""" + value["module_name"] + """""" + case_name + """""" + run_result + """
""" + + module_data += """ + + + + + + + +""" + + total_data += "" + + with open(run_report_path, "a") as f: + + f.write(total_data + module_data) + + print("获取图片报告已生成:", run_report_path) + + elif mode == "1": + + shutil.copy(html_path, diff_report_path) + + module_data = "" + + total_data = "" + + for key, value in data.items(): + + if key == "Total_data": + + with open(diff_report_path, "a") as f: + + f.write("""Diff Image Path: + + + + + + + + + + + + + + + + + +
""" + image_path + """
Test Start/ End Time:""" + value["start_end_time"] + """Execution Time:""" + value["run_time"] + """
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MOUDULESTOTAL_TESTSPASSCASE_FAILGET_FAILBASE_IMAGECOMPARE_FAILPASS_RATE
""" + value["moudle_count"] + """""" + value["Total"] + """""" + value["Pass"] + """""" + value["Case_fail"] + """""" + value["Get_fail"] + """""" + value["Base_image_fail"] + """""" + value["Compare_fail"] + """""" + value["Pass_rate"] + """
+ + """) + + else: + + if isinstance(value, int): + + continue + + total_data += """ + + + + """ + key + """ + + """ + str(value["Total"]) + """ + + """ + str(value["Pass"]) + """ + + """ + str(value["Case_fail"]) + """ + + """ + str(value["Get_fail"]) + """ + + """ + str(value["Base_image_fail"]) + """ + + """ + str(value["Compare_fail"]) + """ + + """ + value["Pass_rate"] + """ + + + +""" + + add_flag = True + + for case_name, run_result, use_time in value["result_list"]: + + if run_result == "PASS": + + # 仅展示对比失败用例,对比图片相同的用例不展示 + + continue + + else: + + if add_flag == True: + + # 仅在有对比失败用例时,才写入标题栏 + + module_data += """ + + + + + + + + + +
+ + """ + key + """ + +
+ + + + + + + + + + + + + + """ + + add_flag = False + + module_data += """ + + + + + + + + """ + + if add_flag == False: + + module_data += """ + +
ModuleTestcaseResult
""" + key + """""" + case_name + """""" + run_result + """
""" + + module_data += """ + + + + + + + + """ + + total_data += "" + + with open(diff_report_path, "a") as f: + + f.write(total_data + module_data) + + print("对比图片报告已生成:", diff_report_path) + + + + + +def run_cmd(command): + + # 执行cmd命令,返回执行日志 + + p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + + out, err = p.communicate() + + # print("out: ", out) + + # print("err: ", err) + + if err is None: + + return out.decode('utf-8') + + return err.decode('utf-8') + + + + + +def checkResult(command, keyword="", case_name=""): + + # 检查设备是否连接成功或用例执行成功 + + start_time = datetime.timestamp(datetime.now()) + + out = run_cmd(command) + + end_time = datetime.timestamp(datetime.now()) + + use_time = round(end_time - start_time, 3) + + if "#" not in command: + + # 批量执行,计算平均耗时 + + use_time = int(use_time / len(out.splitlines())) + + print("{0} run use_time: {1}s".format(case_name, use_time)) + + if "error: get bundle info failed" in out: + + print("【ERROR】测试应用hap未安装,请成功安装后重试\n", out) + + return "测试hap未安装" + + elif keyword in command: + + # 检查设备是否连接成功 + + if "[Empty]" in out: + + # 设备未连接时,显示“[Empty]” + + print("设备未连接,请连接设备或检查线路连接是否正常,UI工具将开始尝试重连") + + return case_name + " Devices connect fail" + + elif out == "": + + # 无hdc.exe + + return "不支持hdc命令, 仅支持hdc_std命令" + + elif len(out) > 15: + + return "设备已连接,可正常使用" + + elif "execute timeout" in out: + + return "timeout" + + elif "Not found entry_test/ets/" in out: + + return True + + elif "stream=Tests run: 0" in out: + + return False + + elif keyword != "list targets": + + image_name_list = [] + + error_case_list = [] + + command_list = [] + + # 获取用例名和失败用例名 + + index_flag = 0 + + for line_data in out.splitlines(): + + # print(index_flag, line_data) + + # 用例执行成功 + + if "OHOS_REPORT_STATUS_CODE: 0" in line_data: + + # 当前用例名 + + case_name = out.splitlines()[index_flag - 1].split("=")[1] + + image_name_list.append([case_name, "PASS", use_time]) + + print(case_name, " run succ !!!\n") + + elif "OHOS_REPORT_STATUS_CODE: -1" in line_data or "TestFinished-ResultCode: -1" in line_data: + + # 用例执行失败 + + if "TestFinished-ResultCode: -1" in line_data and index_flag >= 3: + + # 当前用例名 + + case_name = out.splitlines()[index_flag - 3].split("test=")[1] + + error_info = out.splitlines()[index_flag + 1].split(":")[1] + + print(out.splitlines()[index_flag + 1]) + + image_name_list.append([case_name, "CASE_FAIL: " + error_info, use_time]) + + elif "OHOS_REPORT_STATUS_CODE: -1" in line_data and index_flag >= 2: + + case_name = out.splitlines()[index_flag - 1].split("test=")[1] + + # 执行失败原因 + + error_info = out.splitlines()[index_flag - 2] + + print(case_name, " CASE_FAIL: " + error_info) + + image_name_list.append([case_name, "CASE_FAIL: " + error_info, use_time]) + + if "#" in command: + + # 单条用例 + + error_case_list.append((command, case_name)) + + elif command not in command_list: + + # 多条用例,只添加一次即可(因为多条用例无法执行单用例) + + error_case_list.append((command, case_name)) + + # 仅用来判断多用例执行失败情况 + + command_list.append(command) + + print(case_name, " run fail !!!\n") + + elif keyword in line_data: + + # 解析用例执行总结果 + + print(line_data) + + index_flag += 1 + + # print("image_name_list: ", image_name_list) + + return image_name_list, error_case_list + + else: + + return False + + + + + +def delete_pictures(bundle_name): + + # 删除设备中应用原有截图 + + app_list = run_cmd("hdc shell cd /data/app/el2/100/base/;ls") + + if bundle_name in app_list.split("\r\n"): + + # 删除指定应用文件夹内截图 + + app_path = "/data/app/el2/100/base/{}/haps/entry_test/files/".format(bundle_name) + + print(app_path) + + run_cmd("hdc shell rm -rf {}*".format(app_path)) + + time.sleep(1) + + out = run_cmd("hdc shell cd {};du -sk".format(app_path)).split(".")[0].strip() + + print(out) + + if "/bin/sh" in out: + + print("设备中不存在待删除图片!!!") + + return + + print("当前{0}文件夹内存(KB):{1}".format(bundle_name, out)) + + count = 0 + + while int(out) > 10 and count <= 30: + + out = run_cmd("hdc shell cd {};du -sk".format(app_path)).split(".")[0].strip() + + print("当前{0}文件夹内存(KB):{1}".format(bundle_name, out)) + + count += 1 + + time.sleep(5) + + print("设备中原有用例截图已全部删除!!!") + + else: + + print("设备中不存在待删除图片!!!") + + + + + +class UiCompareTools(): + + """ + + UI对比工具 + + """ + + def run_testcases(self, sn, data, base_path, excel_path, report_path, excel_name, mode='0'): + + # 遍历执行Execl用例,并将设备端webp文件保存至本地 + + # 设备解锁:兼容部分版本执行完用例设备会锁屏 + + # run_cmd('hdc -t {} shell uinput -T -m 1280 800 1280 800 1000'.format(sn)) + + # run_cmd('hdc -t {} shell uinput -T -m 500 2000 500 500 600'.format(sn)) + + print("excel_path: ", excel_path) + + install_flag = False + + bundle_name = "" + + class_name = "" + + result_list = [] + + pass_count = 0 + + case_fail = 0 + + get_fail = 0 + + run_flag = False + + for case in data: + + try: + + class_name = case[0] + + case_name = case[1] + + bundle_name = case[2] + + if case_name is None: + + run_flag = True + + else: + + run_flag = False + + # 先卸载该应用,避免设备上存在已安装同名应用导致测试hap无法安装 + + if install_flag == False: + + # 卸载、安装仅在执行第一条用例前执行一次 + + install_flag = True + + # 卸载hap + + if bundle_name is not None: + + run_cmd("hdc -t {0} uninstall {1}".format(sn, bundle_name)) + + # 安装hap + + hap_install_path = os.path.join(hap_path, excel_name + ".hap") + + print("hap_install_path: ", hap_install_path) + + if os.path.exists(hap_install_path) == False: + + # hap包路径不存在 + + for case in data: + + case_fail += 1 + + result_list.append( + + [case[1], "CASE_FAIL: The HAP path dose not exist: " + hap_install_path, "0"]) + + print("{}组件hap包{}安装路径不存在:{}".format(excel_name, bundle_name, hap_install_path)) + + break + + out = run_cmd("hdc -t {0} install {1}".format(sn, hap_install_path)) + + print("Install result: ", out) + + if "install failed" in out: + + # hap包安装失败 + + for case in data: + + case_fail += 1 + + result_list.append( + + [case[1], "CASE_FAIL: Failed to install the HAP: " + hap_install_path, "0"]) + + print("{}组件hap包{}安装失败: {}".format(excel_name, bundle_name, hap_install_path)) + + break + + + + # 单条执行 + + command = "hdc -t {3} shell aa test -b {0} -m entry_test -s unittest /ets/testrunner/OpenHarmonyTestRunner -s class {1}#{2} -w 180000 -s timeout 15000".format(case[2], case[0], case[1], sn) + + # 批量执行 + + if case_name is None: + + run_flag = True + + # 删除设备中图片 + + delete_pictures(bundle_name) + + command = "hdc -t {2} shell aa test -b {0} -m entry_test -s unittest /ets/testrunner/OpenHarmonyTestRunner -s class {1} -w 180000 -s timeout 15000".format(case[2], case[0], sn) + + result = checkResult(command, "stream=Tests run:", case_name) + + + + if result == True: + + command = command.replace("/ets/testrunner/OpenHarmonyTestRunner", "OpenHarmonyTestRunner") + + print("new command1: ", command) + + result = checkResult(command, "stream=Tests run:", case_name) + + + + if result == True: + + command = command.replace("OpenHarmonyTestRunner", "/ets/Testrunner/OpenHarmonyTestRunner") + + print("new command2: ", command) + + result = checkResult(command, "stream=Tests run:", case_name) + + + + count = 1 + + while result == "timeout" and count < 6: + + # 若用例执行超时,延长超时的时间5秒,最长延长至30秒,若仍超时,则判定用例执行失败 + + command = command.replace(str(15000 + 5000 * (count - 1)), str(15000 + 5000 * count)) + + print("new command3: ", command) + + result = checkResult(command, "stream=Tests run:", case_name) + + count += 1 + + + + # 存在失败用例,重新执行 + + count_error = 1 + + while run_flag == False and count_error <= 5: + + # 若执行失败,重试5次 + + if type(result) == tuple: + + if len(result) == 2 and len(result[1]) >= 1: + + print("重新执行失败用例:", result[1]) + + with open(report_path, "a") as file: + + for error_info in result[1]: + + file.write(class_name + ": " + error_info[1] + " run fail\n") + + # if run_flag == True: + + # # 删除设备中图片 + + # delete_pictures(bundle_name) + + result = checkResult(command, "stream=Tests run:", case_name) + + count_error += 1 + + else: + + break + + else: + + break + + + + if result == True or result == False: + + print("用例执行失败:{}".format(command)) + + result = [[[case_name, "CASE_FAIL: testcase not run", "0"]], []] + + elif result == "测试hap未安装": + + result = [[[case_name, "CASE_FAIL: Failed to install the HAP or The bundle name in the Excel is inconsistent with that in the HAP", "0"]], []] + + + + # 批量循环取图 + + if class_name and (case_name is None): + + row_num = 1 + + data_list = [] + + for case_name1, case_result, run_time in result[0]: + + # 用例执行成功,将设备中webp文件保存至本地 + + if case_result == "PASS": + + # 用例执行成功,才会创建保存图片的文件夹 + + if os.path.exists(base_path) == False: + + os.makedirs(base_path) + + print('base_path: ', base_path) + + webp_path = os.path.join(base_path, "IMG_%s.webp" % case_name1) + + device_webp = "data/app/el2/100/base/{0}/haps/entry_test/files/".format(case[2]) + + device_path = device_webp + "IMG_%s.webp" % case_name1 + + out_content2 = run_cmd("hdc -t %s file recv %s %s" % (sn, device_path, webp_path)) + + print(out_content2) + + if "FileTransfer finish" in out_content2: + + pass_count += 1 + + print("%s.webp文件保存成功\n" % case_name1) + + elif "no such file" in out_content2: + + get_fail += 1 + + file_path = out_content2.split("path:")[1] + + # 取图失败,更新用例执行结果数据 + + result[0][row_num - 1][1] = "GET_FAIL: save image fail: {}".format(file_path) + + print("设备中 %s 文件不存在,保存本地失败\n" % file_path) + + with open(report_path, "a") as file: + + file.write("%s: %s save fail: 设备中该文件不存在\n" % (class_name, case_name1)) + + else: + + count = 0 + + while count <= 30: + + # 增加延时,确保webp文件成功保存至本地 + + time.sleep(1) + + count += 1 + + if "FileTransfer finish" in out_content2: + + break + + else: + + case_fail += 1 + + # 数据存储至列表 + + data_list.append([row_num, class_name, case_name1, case[2], case_result]) + + row_num += 1 + + # 取完图后,删除设备中所有图片 + + delete_pictures(bundle_name) + + try: + + # 将用例执行结果写入Excel + + self.write_excel_data(excel_path, sheet_name=case[0], result_data=data_list) + + except Exception as e: + + print("【ERROR】write_excel_data: %s" % str(e)) + + + + # 执行单条取图 + + elif class_name and case_name: + + # 用例执行成功才从设备中取资源保存至本地 + + # 将用例执行结果写入Excel + + # try: + + # self.write_excel_data(excel_path, result_data=result[0], compare=2) + + # except Exception as e: + + # print("【ERROR】write_excel_data: %s" % str(e)) + + + + run_result = "" + + if type(result) == tuple: + + try: + + run_result = result[0][0][1] + + except: + + result[0][0] = [case_name, "CASE_FAIL: run testcase fail", "0"] + + run_result = result[0][0][1] + + # print("run_result: ", run_result) + + # 若用例执行成功,将设备中webp文件保存至本地 + + if run_result == "PASS": + + # 用例执行成功,才会创建保存图片的文件夹 + + if os.path.exists(base_path) == False: + + os.makedirs(base_path) + + # run_count = 2 + + # while run_count <= 2: + + # txt_path = os.path.join(base_path, case_name + ".txt") + + # remote_txt = "/storage/media/100/local/files/Documents/TXT_test.txt" + + # out_content2 = run_cmd("hdc -t %s file recv %s %s" % (sn, remote_txt, txt_path)) + + webp_path = os.path.join(base_path, case_name + ".webp") + + remote_webp = "data/app/el2/100/base/{0}/haps/entry_test/files/IMG_test.webp".format(case[2]) + + out_content2 = run_cmd("hdc -t %s file recv %s %s" % (sn, remote_webp, webp_path)) + + print(out_content2) + + if "FileTransfer finish" in out_content2: + + # 累加执行用例成功且成功取图的用例个数 + + pass_count += 1 + + print("%s: %s.webp文件保存成功\n" % (sn, case_name)) + + elif "no such file" in out_content2: + + # 取图失败,重新执行用例后再取图三次 + + print("设备中 %s 文件不存在,保存本地失败\n" % remote_webp) + + result = checkResult(command, "stream=Tests run:", case_name) + + if result == "PASS": + + # 用例执行成功再取图片 + + count = 0 + + while count < 3: + + time.sleep(5) + + out_content2 = run_cmd("hdc -t %s file recv %s %s" % (sn, remote_webp, webp_path)) + + print(out_content2) + + if "FileTransfer finish" in out_content2: + + pass_count += 1 + + print("%s: %s.webp文件保存成功\n" % (sn, case_name)) + + break + + count += 1 + + else: + + # 用例执行失败 + + case_fail += 1 + + else: + + count = 0 + + while count <= 30: + + # 增加延时,确保webp文件成功保存至本地 + + time.sleep(1) + + count += 1 + + if "FileTransfer finish" in out_content2: + + pass_count += 1 + + print("%s: %s.webp文件保存成功\n" % (sn, case_name)) + + break + + if "no such file" in out_content2: + + get_fail += 1 + + file_path = out_content2.split("path:")[1] + + # 取图失败,更新用例执行结果数据 + + result[0][0][1] = "GET_FAIL: save image fail: {}".format(file_path) + + print("设备%s中 %s 文件不存在,保存本地失败\n" % (sn, file_path)) + + with open(report_path, "a") as file: + + file.write("%s: %s save fail: 设备%s中该文件不存在\n" % (class_name, case_name, sn)) + + else: + + case_fail += 1 + + if len(result[0]) == 1: + + result_list.append(result[0][0]) + + except Exception as e: + + print("[ERROR] Get Image fail: ", str(e)) + + time.sleep(5) + + # 用例执行结束,卸载hap + + if bundle_name is not None: + + run_cmd("hdc -t %s uninstall %s" % (sn, bundle_name)) + + time.sleep(2) + + if mode == "0": + + print("{}.xlsx 中所有用例均已执行,基线图源均已获取".format(excel_name)) + + elif mode == "1": + + print("{}.xlsx 中所有用例均已执行,对比图源均已获取".format(excel_name)) + + if pass_count != len(result_list) - case_fail - get_fail: + + pass_count = len(result_list) - case_fail - get_fail + + if len(result_list) <= 0: + + total_num = case_fail + get_fail + + else: + + total_num = len(result_list) + + result_data = {"Total": total_num, + + "Pass": pass_count, + + "Case_fail": case_fail, + + "Get_fail": get_fail, + + "Pass_rate": str(int((pass_count/len(data))*100)) + "%", + + "result_list": result_list, + + "module_name": class_name} + + # print("result_data: ", result_data) + + return result_data + + + + def read_excel_data(self, excel_path): + + # 读取Excel表中类名和用例名 + + if os.path.exists(excel_path) == False: + + print("当前Excel路径不存在: %s" % excel_path) + + return False + + else: + + data_list = [] + + try: + + wb = openpyxl.load_workbook(excel_path) + + # 默认取第一张表 + + sheet = wb.worksheets[0] + + rows = sheet.max_row + + + + for row in range(1, rows): + + # 获取第二列的数据:类名 + + class_name = sheet.cell(row + 1, 2).value + + if class_name is None: + + print("Excel表中有效数据行数: ", row - 1) + + break + + # 获取第三列的数据:用例名 + + case_name = sheet.cell(row + 1, 3).value + + # 获取第四列的数据:bundle_name + + bundle_name = sheet.cell(row + 1, 4).value + + data_list.append((class_name, case_name, bundle_name)) + + print('data_list: ', data_list) + + except Exception as e: + + print(str(e)) + + return data_list + + + + def write_excel_data(self, report_path, sheet_name="Sheet1", result_data=[], x=1, compare=0): + + # 将执行报告数据写入Excel表中 + + if os.path.exists(excel_path) == False: + + print("当前Excel路径不存在: %s" % excel_path) + + return False + + print("write_excel_data: ", excel_path) + + # 读取Excel表数据 + + try: + + wb = openpyxl.load_workbook(excel_path) + + if compare == 2: + + # 默认取第一张表(执行单条用例) + + sheet = wb.worksheets[0] + + elif sheet_name in wb.sheetnames: + + sheet = wb[sheet_name] + + else: + + # 若sheet页不存在,创建新的sheet页 + + sheet = wb.create_sheet(sheet_name) + + print("add sheet %s succ" % sheet_name) + + if compare == 0: + + sheet.append(["序号", "类名", "用例名", "bundle name", "生成图片结果"]) + + print("标题写入完成") + + elif compare == 1: + + sheet.append(["用例名", "对比结果", "耗时"]) + + for testcase in result_data: + + sheet.append(testcase) + + print("对比结果写入完成") + + wb.save(excel_path) + + # 写入result数据 + + rows = sheet.max_row + + cols = sheet.max_column + + if compare == 0 or compare == 2: + + if result_data == []: + + print("[ERROR] write excel data error") + + elif len(result_data) == 1: + + # 单条用例 + + for num in range(1, rows + 1): + + # print("num: ", num) + + if sheet.cell(num, 3).value == result_data[0][0]: + + for i in range(5, 100): + + if sheet.cell(num, i).value is None: + + sheet.cell(num, i, result_data[0][1]) + + if num == 2: + + print("单条用例:报告时间写入完成") + + sheet.cell(1, i, now_time) + + break + + break + + else: + + # 多条用例 + + if sheet.cell(x + 1, 1).value is None: + + # 首次写入 + + for data in result_data: + + sheet.append([data[0], data[1], data[2], data[3], data[4]]) + + print("write %s succ" % data[2]) + + else: + + # 非首次写入 + + if sheet.cell(rows, cols + 1).value is None: + + sheet.cell(1, cols + 1, now_time) + + print("多条用例:报告时间写入完成") + + cols += 1 + + for data in result_data: + + sheet.cell(data[0] + 1, cols, data[4]) + + print("add write %s succ" % data[2]) + + wb.save(excel_path) + + if sheet.cell(2, 1).value is None: + + # 删除空行 + + sheet.delete_rows(2) + + # 保存Excel文件 + + wb.save(excel_path) + + print('result_data: %s succ' % result_data) + + except Exception as e: + + with open(report_path, "a") as r1: + + r1.write("write Excel data error: {}\n".format(excel_path)) + + print(str(e), type(e)) + + if "Permission denied" in str(e): + + print("【ERROR】请先关闭本地已打开的Excel表格,再重新执行") + + + + def get_diff_files(self, excel_path, base_path, compare_path, run_result, now_time): + + # 比较两个文件夹中所有的webp文件,返回所有不同的文件名 + + base_path_exists = True + + if os.path.isdir(base_path) == False: + + base_path_exists = False + + print("{}基线图源文件夹路径不存在".format(base_path)) + + report_diff_list = [] + + case_fail_count = 0 + + get_fail_count = 0 + + base_image_fail = 0 + + compare_fail = 0 + + pass_count = 0 + + for case_name, case_result, use_time in run_result["result_list"]: + + if case_result == "PASS": + + baseImage_path = os.path.join(base_path, case_name + ".webp") + + compareImage_path = os.path.join(compare_path, case_name + ".webp") + + print("baseImage_path: ", baseImage_path) + + print("compareImage_path: ", compareImage_path) + + use_time = "0" + + if base_path_exists == False: + + # 基线图源文件夹路径不存在 + + base_image_fail += 1 + + case_result = "BASE_IMAGE: BaseImage moudle path does not exist: {}".format(base_path) + + elif os.path.exists(baseImage_path) == False: + + # 基线图源文件不存在 + + base_image_fail += 1 + + case_result = "BASE_IMAGE: BaseImage does not exist: {}".format(baseImage_path) + + elif os.path.exists(compareImage_path) == False: + + # 对比图片文件不存在 + + get_fail_count += 1 + + case_result = "GET_FAIL: Save image fail: {}".format(compareImage_path) + + else: + + start_time = datetime.timestamp(datetime.now()) + + # 对比图片,不同时会生成差异图 + + if self.compare_files(baseImage_path, compareImage_path) == False: + + case_result = "COMPARE_FAIL" + + compare_fail += 1 + + else: + + case_result = "PASS" + + pass_count += 1 + + end_time = datetime.timestamp(datetime.now()) + + use_time = str(round(end_time - start_time, 3)) + + elif "CASE_FAIL" in case_result: + + case_fail_count += 1 + + elif "GET_FAIL" in case_result: + + get_fail_count += 1 + + # 将用例执行结果数据保存至列表 + + report_diff_list.append([case_name, case_result, use_time]) + + + + # 将对比执行结果写入Excel + + # self.write_excel_data(excel_path, sheet_name="diff_%s" % now_time, result_data=report_diff_list, compare=1) + + case_count = run_result["Total"] + + if case_count == 0: + + pass_rate = 0 + + else: + + # 防止除数为0,导致异常 + + pass_rate = int(pass_count / case_count * 100) + + if pass_count != case_count - case_fail_count - get_fail_count - base_image_fail - compare_fail: + + pass_count = case_count - case_fail_count - get_fail_count - base_image_fail - compare_fail + + result_data = {"Total": case_count, + + "Pass": pass_count, + + "Case_fail": case_fail_count, + + "Get_fail": get_fail_count, + + "Base_image_fail": base_image_fail, + + "Compare_fail": compare_fail, + + "Pass_rate": str(pass_rate) + "%", + + "result_list": report_diff_list} + + print(result_data) + + return result_data + + + + def modify_image_color(self, num, height_unit, width, img_array, dst): + + # 修改图片像素颜色 + + height_1 = num * height_unit + + height_2 = (num + 1) * height_unit + + for h, w in product(range(height_1, height_2), range(width)): + + (b, g, r) = img_array[h, w] + + if (b, g, r) == (0, 0, 0): # 黑色 + + img_array[h, w] = (255, 255, 255) # 白色 + + else: + + img_array[h, w] = (255, 0, 0) # 剩余差异部分红色显示 + + dst[h, w] = img_array[h, w] + + return dst + + + + def compare_files(self, file1, file2): + + # 比较两个webp文件,如果它们相同则返回True,否则返回False + + if os.path.exists(file1) == False: + + print("当前文件路径不存在,请确认后重试:", file1) + + return False + + if os.path.exists(file2) == False: + + print("当前文件路径不存在,请确认后重试:", file2) + + return False + + # if filecmp.cmp(file1, file2) == True: + + if self.compare_file(file1, file2) == True: + + print("两张图片内容:完全相同") + + return True + + else: + + """ + + 比较图片,如果有不同则生成展示不同的图片 + + @参数一: file1: 基线图片的路径 + + @参数二: file2: 对比图片的路径 + + """ + + module_name = file1.split("\\")[-2] + + diff_path = os.path.join(reports_path, "diff_" + now_time, module_name) + + print("diff_path: ", diff_path) + + if os.path.exists(diff_path) == False: + + os.makedirs(diff_path) + + try: + + image_one = Image.open(file1) + + image_two = Image.open(file2) + + except Exception as e: + + print(str(e)) + + return False + + size1 = image_one.size + + size2 = image_two.size + + print("BaseImage size: {}\nCompareImage size: {}".format(size1, size2)) + + if size1 != size2: + + # 两张图片大小不一致, 无需对比,且不会生成差异图 + + if module_name not in image_size_diff: + + image_size_diff.append(module_name) + + path = os.path.join(reports_path, module_name + ".txt") + + with open(path, "a") as file: + + file.write("截图大小不一致组件列表: %s !!!\n" % str(image_size_diff)) + + with open(report_path, "a") as file: + + file.write("截图大小不一致组件列表: %s !!!\n" % str(image_size_diff)) + + return False + + try: + + diff = ImageChops.difference(image_one, image_two) + + if diff.getbbox() is None: + + # 两张图片相同 + + return True + + img_array = np.array(diff) # 把图像转成数组格式img = np.asarray(image) + + shape = img_array.shape + + height = shape[0] + + width = shape[1] + + dst = np.zeros((height, width, 3)) + + # for h, w in product(range(height), range(width)): + + # (b, g, r) = img_array[h, w] + + # if (b, g, r) == (0, 0, 0): # 黑色 + + # img_array[h, w] = (255, 255, 255) # 白色 + + # else: + + # img_array[h, w] = (255, 0, 0) # 剩余差异部分红色显示 + + # dst[h, w] = img_array[h, w] + + black_pixels = np.where( + + (img_array[:, :, 0] == 0) & (img_array[:, :, 1] == 0) & (img_array[:, :, 2] == 0)) + + dst[black_pixels] = [255, 255, 255] + + other_pixels = np.where( + + (img_array[:, :, 0] != 0) | (img_array[:, :, 1] != 0) | (img_array[:, :, 2] != 0)) + + dst[other_pixels] = [255, 0, 0] + + diff_image = Image.fromarray(np.uint8(dst)) + + print("【+】We are the not same!") + + # 保存差异图、基线图和对比图到diff_path下,命名规则:用例名_diff,用例名_base,用例名_compare + + case_name = file1.split("\\")[-1].split(".")[0] + + diff_save_path = os.path.join(diff_path, case_name + '_diff.webp') + + base_image_path = os.path.join(diff_path, case_name + '_base.webp') + + compare_image_path = os.path.join(diff_path, case_name + '_compare.webp') + + diff_image.save(diff_save_path) + + shutil.copy(file1, base_image_path) + + shutil.copy(file2, compare_image_path) + + except ValueError as e: + + text = ("表示图片大小和box对应的宽度不一致,参考API说明:Pastes another image into this image." + + "The box argument is either a 2-tuple giving the upper left corner, a 4-tuple defining the left, upper, " + + "right, and lower pixel coordinate, or None (same as (0, 0)). If a 4-tuple is given, the size of the pasted " + + "image must match the size of the region.使用2纬的box避免上述问题") + + print("【{0}】{1}".format(e, text)) + + print("两张图片内容:存在差异") + + return False + + + + def compare_file(self, file1, file2): + + with open(file1, "rb") as f1: + + data1 = f1.read() + + with open(file2, "rb") as f2: + + data2 = f2.read() + + return data1 == data2 + + + + def generate_report(self, different_files, report_path): + + # 生成报告显示具体哪个webp文件不同 + + if len(different_files) == 0: + + print("两个文件夹中的所有webp文件都相同。") + + return + + + + report = "以下图片在两个文件夹中存在差异:\n" + + for file in different_files: + + report += f"{file}\n" + + with open(report_path, "w") as r1: + + r1.write(report) + + print("webp文件比对完成,已生成报告:", report_path) + + + + + +def connect_device(device_list): + + # 检查设备是否成功连接 + + time.sleep(3) + + result = run_cmd("hdc list targets") + + now_device_list = result.split("\r\n")[-1] + + print("应连接设备 %d 台" % len(device_list)) + + + + # 先循环等待是否全部连接成功 + + count = 0 + + while len(device_list) != len(now_device_list) and count < 5: + + time.sleep(2) + + count += 1 + + + + # 获取未连接设备sn号 + + disconnect_device = [] + + if len(device_list) != len(now_device_list): + + for device in device_list: + + if device not in now_device_list: + + disconnect_device.append(device) + + else: + + print("设备均已成功连接PC") + + + + # 重试拉起未连接设备hdc,再查询 + + if len(disconnect_device) >= 1: + + print("设备连接异常, 开始重连设备") + + for sn in disconnect_device: + + for i in range(1, 16): + + SN = run_cmd("hdc -t {} shell power-shell setmode 602".format(sn)) + + time.sleep(2) + + # print("SN: ", SN) + + if "[Fail]" in SN: + + print("重连第 %d 次" % i) + + continue + + else: + + break + + run_cmd("hdc -t {} shell power-shell display -s 0".format(sn)) + + if len(device_list) == len(run_cmd("hdc list targets").split("\r\n")[-1]): + + print("设备均已成功连接PC") + + else: + + # 更新设备列表 + + device_list = run_cmd("hdc list targets").split("\r\n")[-1] + + return device_list + + + + + +def delete_and_reboot(sn): + + # 跑用例前删包,重启操作 + + run_cmd("hdc -t {} shell mount -o remount,rw /sys_prod".format(sn)) + + run_cmd("hdc -t {} shell rm -rf /sys_prod/app/SystemResourcesOverlay".format(sn)) + + # 重启设备 + + #run_cmd("hdc -t {} shell reboot".format(sn)) + + #print("设备 {} 重启中,请耐心等待50秒......".format(sn)) + + #time.sleep(50) + + # 当前设备类型 + + device = run_cmd('hdc -t {} shell param get const.product.model'.format(sn)) + + if "Fail" in device: + + # 设备断连,尝试重连 + + connect_device(device_list) + + else: + + print("当前设备类型:", device) + + # 解锁设备 + + if "WGR" in device: + + # 若是WGR需点击屏幕中间才可解锁 + + run_cmd('hdc -t {} shell uinput -T -m 1280 800 1280 800 1000'.format(sn)) + + elif "NOH" in device: + + # 手机:滑动界面即可解锁 + + run_cmd('hdc -t {} shell uinput -T -m 500 2000 500 500 600'.format(sn)) + + else: + + # 设备断连,尝试重连 + + connect_device([sn]) + + run_cmd('hdc -t {} shell uinput -T -m 1280 800 1280 800 1000'.format(sn)) + + run_cmd('hdc -t {} shell uinput -T -m 500 2000 500 500 600'.format(sn)) + + # 设置设备常亮 + + out = run_cmd('hdc -t {} shell power-shell setmode 602'.format(sn)) + + if "Mode Success" in out: + + print("当前设备 {} 已设置常亮!!!".format(sn)) + + # 调低亮度,确保有足够电量进行测试 + + run_cmd('hdc -t {} shell power-shell display -s 0'.format(sn)) + + else: + + print("当前设备 {} 连接异常,请成功连接设备后重新执行".format(sn)) + + + + + +def run_get_image(args): + + # 获取基线图 + + # device_dict, excel_path, excel_name, report_path, base_path, now_time, dir_path + + global device_dict + + device_dict = args[0] + + excel_path = args[1] + + excel_name = args[2] + + report_path = args[3] + + now_time = args[5] + + dir_path = args[6] + + print(excel_name, " before run device_dict: ", device_dict) + + if len(device_dict) == 1: + + for key, value in device_dict.items(): + + sn = key + + elif len(device_dict) > 1: + + sn = device_dict.keys()[0] + + # print("sn: ", sn) + + run_flag = False + + if device_dict[sn] == True: + + # 有空闲设备时,占用并更新设备状态不可用(False) + + tmp = device_dict + + tmp[sn] = False + + device_dict = tmp + + print(excel_name, " running device_dict: ", device_dict) + + elif device_dict[sn] == False: + + index = 0 + + # 单个组件执行用例超过50分钟,可能该设备已闲置,启用该设备 + + while run_flag == False and index < 50 * 60: + + for device, status in device_dict.items(): + + # 监测到有空闲设备时 + + if status == True: + + # 有空闲设备时,占用并更新设备状态不可用(False) + + tmp = device_dict + + tmp[device] = False + + device_dict = tmp + + sn = device + + run_flag = True + + print(excel_name, " running device_dict: ", device_dict) + + break + + if run_flag == True: + + # 有空闲设备时,退出循环,开始执行用例 + + break + + # 等待直到出现空闲设备 + + time.sleep(1) + + index += 1 + + global base_path + + base_path = os.path.join(dir_path, "BaseImages_" + now_time) + + print('base_path: ', base_path) + + # 实例化对象 + + uiTools = UiCompareTools() + + data = uiTools.read_excel_data(excel_path) + + result_dict = {} + + if data != False: + + save_image_path = os.path.join(base_path, excel_name) + + try: + + case_result = uiTools.run_testcases(sn, data, save_image_path, excel_path, report_path, excel_name, mode="0") + + result_dict[excel_name] = case_result + + # 将本次执行结果保存至json文件中,确保遇到异常中断,仍可生成总的html报告 + + if os.path.exists(run_json_path) == False: + + os.makedirs(run_json_path) + + json_data_path = os.path.join(run_json_path, excel_name + ".json") + + with open(json_data_path, "w") as f: + + json.dump(result_dict, f) + + # print("成功写入json文件:", result_dict) + + except Exception as e: + + print("[ERROR] get BaseImage fail: ", str(e)) + + print("result_dict: ", result_dict) + + # 用例执行完,更新当前设备状态为可用(True) + + device_dict[sn] = True + + print(excel_name, " after run device_dict: ", device_dict) + + else: + + print("[ERROR] The Excel path does not exist !!!") + + return device_dict, result_dict + + + + + +def run_compare_image(args): + + # 获取对比图,并对比图片 + + # device_dict, excel_path, excel_name, report_path, base_path, now_time, dir_path + + global device_dict + + device_dict = args[0] + + excel_path = args[1] + + excel_name = args[2] + + report_path = args[3] + + base_path = args[4] + + now_time = args[5] + + dir_path = args[6] + + print(excel_name, " before run device_dict: ", device_dict) + + if len(device_dict) == 1: + + for key, value in device_dict.items(): + + sn = key + + elif len(device_dict) > 1: + + sn = device_dict.keys()[0] + + # print("sn: ", sn) + + run_flag = False + + if device_dict[sn] == True: + + # 有空闲设备时,占用并更新设备状态不可用(False) + + tmp = device_dict + + tmp[sn] = False + + device_dict = tmp + + print(excel_name, " running device_dict: ", device_dict) + + elif device_dict[sn] == False: + + index = 0 + + # 单个组件执行用例超过50分钟,可能该设备已闲置,启用该设备 + + while run_flag == False and index < 50*60: + + for device, status in device_dict.items(): + + # 监测到有空闲设备时 + + if status == True: + + # 有空闲设备时,占用并更新设备状态不可用(False) + + tmp = device_dict + + tmp[device] = False + + device_dict = tmp + + sn = device + + run_flag = True + + print(excel_name, " running device_dict: ", device_dict) + + break + + if run_flag == True: + + # 有空闲设备时,退出循环,开始执行用例 + + break + + # 等待直到出现空闲设备 + + time.sleep(1) + + index += 1 + + + + compare_path = os.path.join(dir_path, "CompareImages_" + now_time) + + print('compare_path: ', compare_path) + + count = 0 + + # 校验基线图片路径是否合法 + + while os.path.isdir(base_path) == False or os.path.exists(base_path) == False: + + if os.path.isdir(base_path) == False: + + base_path = input("路径非文件夹,请重新输入基线图源文件夹所在路径:") + + elif os.path.exists(base_path) == False: + + base_path = input("路径不存在,请重新输入基线图源文件夹所在路径:") + + count += 1 + + if os.path.isdir(base_path) == True and os.path.exists(base_path) == True: + + # 路径输入正确,跳出循环继续往下执行 + + break + + if count == 3: + + # 输入三次非法参数,程序退出 + + sys.exit(0) + + + + # 实例化对象 + + uiTools = UiCompareTools() + + data = uiTools.read_excel_data(excel_path) + + diff_dict = {} + + if data != False: + + # 基线图片路径 + + base_image_path = os.path.join(base_path, excel_name) + + # 对比图片路径 + + save_image_path = os.path.join(compare_path, excel_name) + + # 执行生成对比图片用例,并将执行和保存图片的结果写入Excel表中 + + uiTools = UiCompareTools() + + try: + + case_result = uiTools.run_testcases(sn, data, save_image_path, excel_path, report_path, excel_name, mode="1") + + # 用例执行完,更新当前设备状态为可用(True) + + device_dict[sn] = True + + # 开始对比图片,并将对比结果写入Excel表中,有差异时生成差异图保存至reports\diff_XXX\module_name\XXX.webp + + different_files = uiTools.get_diff_files(excel_path, base_image_path, save_image_path, case_result, now_time) + + # 将执行用例的结果、保存图片的结果与对比图片的结果合并,得到最终展示至报告中的结果 + + # 更新该模块用例总数 + + if different_files["Total"] < len(different_files["result_list"]): + + different_files["Total"] = len(different_files["result_list"]) + + # 将该模块数据添加至字典 + + diff_dict[excel_name] = different_files + + # 将本次执行结果保存至json文件中,确保遇到异常中断,仍可生成总的html报告 + + if os.path.exists(run_json_path) == False: + + os.makedirs(run_json_path) + + json_data_path = os.path.join(run_json_path, excel_name + "_diff.json") + + with open(json_data_path, "w") as f: + + json.dump(diff_dict, f) + + print("成功写入json文件:", result_dict) + + + + # 生成对比报告 + + report_diff_path = os.path.join(reports_path, "report_diff_{0}.txt".format(now_time)) + + uiTools.generate_report(different_files["result_list"], report_diff_path) + + except Exception as e: + + print("[ERROR] run Compare fail: ", str(e)) + + print("{}.xlsx 中所有用例图片均已对比完成".format(excel_name)) + + print("diff_dict: ", diff_dict) + + else: + + print("[ERROR] The Excel path does not exist !!!") + + print(excel_name, " after run device_dict: ", device_dict) + + return device_dict, diff_dict + + + + + +if __name__ == '__main__': + + # 程序入口 + + # 1小时后开始生成基线图 + + # time.sleep(1 * 60 * 60) + + start_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) + + start_time_second = datetime.timestamp(datetime.now()) + + # 创建reports文件夹 + + if os.path.exists(reports_path) == False: + + os.makedirs(reports_path) + + result_list = [] + + if mode == "0" or mode == "1": + + # 判断用例数据的Excel所在文件夹内是否包含有效数据(必须为xlsx格式的Excel) + + count = 0 + + while os.path.exists(excel_path) == False: + + excel_path = input("路径不存在,请重新输入Excel所在文件夹路径:") + + count += 1 + + if os.path.exists(excel_path) == False and count == 3: + + # 尝试三次错误输入后,退出程序 + + sys.exit(0) + + + + # 获取所有Excel表的全路径 + + excel_name_list = [] + + excel_path_list = [] + + if os.path.exists(excel_path) == True: + + excel_name_list = get_file_list(excel_path, ".xlsx") + + count = 0 + + # 路径无效时,尝试三次输入 + + while len(excel_name_list) == 0: + + excel_path = input("路径中不存在xlsx格式的Excel文件,请检查后重新输入Excel所在文件夹路径:") + + excel_name_list = get_file_list(excel_path, ".xlsx") + + count += 1 + + if len(excel_name_list) == 0 and count == 3: + + # 尝试三次错误输入后,退出程序 + + sys.exit(0) + + # 路径有效时,获取全路径列表 + + for excel_name in excel_name_list: + + excel_full_path = os.path.join(excel_path, excel_name) + + excel_name = excel_name.split(".")[0] + + excel_path_list.append((excel_full_path, excel_name)) + + + + flag = 0 + + func_name = "" + + while flag < 3: + + if mode == "0": + + # 获取基线图 + + func_name = run_get_image + + break + + elif mode == "1": + + # 对比图片 + + func_name = run_compare_image + + break + + else: + + mode = input("您输入有误,请重新输入(输入0可获取基线图源,输入1可对比图片):") + + flag += 1 + + if flag == 3: + + # 错输三次,退出程序 + + sys.exit(0) + + report_path = os.path.join(reports_path, "reports_run_%s.txt" % now_time) + + + + # 兼容本地无hdc.exe的情况 + + content = run_cmd("hdc list targets") + + print("当前设备SN号: \n", content) + + if content == "": + + position = run_cmd("where hdc_std") + + print("本地hdc_std.exe所在路径: ", position) + + position = position.splitlines()[0] + + print("本地hdc_std.exe所在第一个路径: ", position) + + shutil.copy(position, position.replace("hdc_std.exe", "hdc.exe")) + + content = run_cmd("hdc list targets") + + + + device_list = content.split("\r\n")[:-1] + + print("device_list: ", device_list) + + # 最大进程数,即连接设备数 + + process_num = len(device_list) + + # 跑用例前删包,重启操作 + + if process_num == 1: + + # 单台设备 + + delete_and_reboot(device_list[0]) + + print("单设备执行") + + elif process_num > 1: + + # 多设备、多进程 + + print("多设备、多进程执行") + + with Pool(process_num) as p: + + outputs = p.map(delete_and_reboot, device_list) + + # 关闭进程池 + + p.terminate() + + # 检查设备是否成功连接,若连接异常尝试重连 + + connect_device(device_list) + + + + # 利用进程池Pool自动帮我们管理子进程 + + excel_num = len(excel_path_list) + + device_num = len(device_list) + + print("excel_path_list: ", excel_path_list) + + dir_path = os.path.join(dir_path) + + + + if mode == "0": + + base_path = "" + + + + if device_num == 1: + + # 仅连接单台设备时 + + device_dict = {device_list[0]: True} + + for excel_path, excel_name in excel_path_list: + + result_data = [] + + if mode == "0": + + result_data = run_get_image((device_dict, excel_path, excel_name, report_path, base_path, now_time, dir_path)) + + elif mode == "1": + + result_data = run_compare_image( + + (device_dict, excel_path, excel_name, report_path, base_path, now_time, dir_path)) + + else: + + print("您输入的type有误,请您重新输入!") + + sys.exit(0) + + result_list.append(result_data) + + elif device_num > 1: + + # 连接多台设备时 + + # 未执行用例前,所有设备均可用(True) + + device_dict = Manager().dict() + + for device in device_list: + + device_dict[device] = True + + # 最大进程数:PC已连接的设备数 + + p = Pool(device_num) + + res_l = [] + + excel_index = 0 + + for excel_path, excel_name in excel_path_list: + + res = p.apply_async(func_name, ((device_dict, excel_path, excel_name, report_path, base_path, now_time, dir_path),)) + + res_l.append(res) + + excel_index += 1 + + p.close() + + p.join() + + + + for res in res_l: + + # 汇总用例执行结果 + + result_list.append(res.get()) + + # 关闭进程池 + + p.terminate() + + if mode == "2": + + # 获取所有的json路径 + + all_json_path = [] + + json_name_list = get_file_list(json_path, ".json") + + if "_diff.json" in json_name_list[0]: + + mode = "1" + + else: + + mode = "0" + + base_path = "" + + for json_name in json_name_list: + + all_json_path.append(os.path.join(json_path, json_name)) + + print("all_json_path: ", all_json_path) + + for json_data_path in all_json_path: + + with open(json_data_path, "r") as f: + + data = json.loads(f.read()) + + # print("解析后json文件:", data) + + result_list.append(({}, data)) + + + + end_time = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) + + end_time_second = datetime.timestamp(datetime.now()) + + run_time = end_time_second - start_time_second + + moudle_count = len(result_list) + + total_count = 0 + + pass_count = 0 + + case_fail_count = 0 + + get_fail_count = 0 + + + + if mode == "0": + + # 获取基线图 + + result_dict = {} + + for run_dict in result_list: + + for key, value in run_dict[1].items(): + + result_dict[key] = value + + total_count += value["Total"] + + pass_count += value["Pass"] + + case_fail_count += value["Case_fail"] + + get_fail_count += value["Get_fail"] + + if total_count == 0: + + pass_rate = 0 + + else: + + pass_rate = int(pass_count / total_count * 100) + + # if pass_count != total_count - case_fail_count - get_fail_count: + + # pass_count = total_count - case_fail_count - get_fail_count + + result_dict["Total_data"] = {"moudle_count": str(moudle_count), + + "Total": str(total_count), + + "Pass": str(pass_count), + + "Case_fail": str(case_fail_count), + + "Get_fail": str(get_fail_count), + + "Pass_rate": str(pass_rate) + "%", + + "start_end_time": str(start_time) + "/ " + str(end_time), + + "run_time": str(time.strftime("%H:%M:%S", time.gmtime(run_time))) + + } + + # 生成获取基线图的html报告 + + write_report_html(result_dict, mode="0", image_path=base_path) + + print("获取图片结束,result_dict: ", result_dict) + + elif mode == "1": + + # 与基线图对比,并生成差异图和报告 + + base_image_fail_count = 0 + + compare_fail_count = 0 + + diff_dict = {} + + for run_dict in result_list: + + for key, value in run_dict[1].items(): + + diff_dict[key] = value + + # 累加获取各状态总数 + + total_count += value["Total"] + + pass_count += value["Pass"] + + case_fail_count += value["Case_fail"] + + get_fail_count += value["Get_fail"] + + base_image_fail_count += value["Base_image_fail"] + + compare_fail_count += value["Compare_fail"] + + if total_count == 0: + + pass_rate = 0 + + else: + + pass_rate = int(pass_count / total_count * 100) + + diff_dict["Total_data"] = {"moudle_count": str(moudle_count), + + "Total": str(total_count), + + "Pass": str(pass_count), + + "Case_fail": str(case_fail_count), + + "Get_fail": str(get_fail_count), + + "Base_image_fail": str(base_image_fail_count), + + "Compare_fail": str(compare_fail_count), + + "Pass_rate": str(pass_rate) + "%", + + "start_end_time": str(start_time) + "/ " + str(end_time), + + "run_time": str(time.strftime("%H:%M:%S", time.gmtime(run_time)))} + + diff_path = os.path.join(reports_path, "diff_" + str(now_time)) + + # 生成对比图片后的html报告 + + write_report_html(diff_dict, mode="1", image_path=diff_path) + + print("对比图片结束,diff_dict: ", diff_dict) + diff --git a/function/ui_compare_rh/uicompare_tools/excel/actionSheet.xlsx b/function/ui_compare_rh/uicompare_tools/excel/actionSheet.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..d8c3be79f5bf717b930196cf91fe131ad3c18ad6 Binary files /dev/null and b/function/ui_compare_rh/uicompare_tools/excel/actionSheet.xlsx differ diff --git a/function/ui_compare_rh/uicompare_tools/excel/uicompare.xlsx b/function/ui_compare_rh/uicompare_tools/excel/uicompare.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..8d0255136e1831e0437d42d19471ca5fdf3733c4 Binary files /dev/null and b/function/ui_compare_rh/uicompare_tools/excel/uicompare.xlsx differ diff --git a/function/ui_compare_rh/uicompare_tools/mode.html b/function/ui_compare_rh/uicompare_tools/mode.html new file mode 100644 index 0000000000000000000000000000000000000000..c56f5b11a876b0ac7afc98f4b4895e32baacc4a9 --- /dev/null +++ b/function/ui_compare_rh/uicompare_tools/mode.html @@ -0,0 +1,432 @@ + + + + + <!--{title_name}--> + + + + + + + + +
+ + + + + + + + + + + + + +
Test Summary
Platform:PhoneTest Type:Test
Device Name:7001005458*************e1c8933900 + \ No newline at end of file diff --git a/function/ui_compare_rh/uicompare_tools/run.bat b/function/ui_compare_rh/uicompare_tools/run.bat new file mode 100644 index 0000000000000000000000000000000000000000..900108445dfae615d0d224a0c3a637091f06ccc9 --- /dev/null +++ b/function/ui_compare_rh/uicompare_tools/run.bat @@ -0,0 +1,22 @@ + +@ECHO OFF +reg add HKEY_CURRENT_USER\Console /v QuickEdit /t REG_DWORD /d 00000000 /f +echo "======使用说明======" +echo "--type: 输入0:获取基线图,输入1:对比生成差异图,输入2:生成总html报告" +echo "--excel: 用例数据的Excel所在文件夹路径(Excel仅支持xlsx格式)" +echo "--dir: 基础图源文件夹所在路径(type=1时必填)" +echo "--hap: 用例hap文件夹所在路径(必填)" +echo "--json: 执行用例生成的 json文件所在文件夹路径(type=2时必填)" +echo "入参范例:--type0--excel D:\UI\All_Excel\--hap D:\UI\hap" +echo "入参范例:--type1--excel D:\UI\All_Excel\--dir D:\UI\BaseImages_20230504_174004 --hap D:\UI\hap" +echo "入参范例:--type2--json D:\UI\run_json_20230810_163907\" +echo "温馨提示:执行用例前,请先确保已关闭上述路径中所有的Excel表,否则将会导致用例结果写入Excel后保存失败" +echo "======使用说明======" + + +set /p param= 输入入参: + + +python UiCompareTools_progress.py %param% + +pause \ No newline at end of file