diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/2.png b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/icon.png similarity index 100% rename from sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/2.png rename to sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/icon.png diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/List.test.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/List.test.ets index 48dcc1bbbd6854b038a041533145d2b13d83fe36..885fef6bdc1cbbc407112ca25d070302489f88e4 100644 --- a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/List.test.ets +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/List.test.ets @@ -32,7 +32,6 @@ import UiComponentTextInputTwoWayBinding from './UiComponentTextInputTwoWayBindi import UiComponentTextShareMenu from './UiComponentTextShareMenu/UiComponentTextShareMenu.test' import UiComponentTextTranslateMenu from './UiComponentTextTranslateMenu/UiComponentTextTranslateMenu.test' export default function testsuite() { - UiTestCase(); UiComponentTextCommonLineSpace(); UiComponentTextRicheditor(); diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D.test.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7bcda08ddea5e3f5e5a5a734a81cbff646b2657e --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/test/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D.test.ets @@ -0,0 +1,1069 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, Level } from '@ohos/hypium' +import Settings from '../model/Settings' +import windowSnap from '../model/snapShot' +import Logger from '../model/Logger' +import Utils from '../model/Utils' +import { Driver, ON,Component ,MouseButton } from '@ohos.UiTest' +/* + * SUB_ACE_UI_ATTRIBUTES_FONT_INTERFACE_0010:设置文本颜色 + * + * Settings.createWindow(config.url): + * 创建窗口,更改窗口基本配置,更改方式详见model/Settings createWindow方法 + * + * windowSnap.snapShot(globalThis.context): + * 窗口截屏&图片文件保存,存储在设备端 + * 存储文件固定,单挑用例执行后覆盖,用于自动化UI对比 + * 支持调试更改文件名为时间戳格式,更改model/snapShot createAndGetFile方法 注释L35,放开L32,L33 + * + * Logger日志使用方法: + * import Logger form './model/Logger' + * Logger.info(TAG,`config = ${config}, err = ${JSON.stringify(exception)}`) + * */ + +export default function UiComponentCanvasMatrix2D() { + + describe('UiComponentCanvasMatrix2D', () => { + afterEach(async (done: Function) => { + if (Settings.windowClass == undefined) { + return + } + + Settings.windowClass.destroyWindow((err) => { + if (err.code) { + Logger.error('TEST', `Failed to destroy the window. Cause : ${JSON.stringify(err)}`) + return; + } + Logger.info('TEST', `Succeeded in destroy the window.`); + }) + await Utils.sleep(1000); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0110 + * @tc.name In the Canvas component, set the sepia in the filter to 0.5 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0110', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0110 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D01") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0110 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0130 + * @tc.name In the Canvas component, set the sepia in the filter to 0 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0130', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0130 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D02") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0130 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0250 + * @tc.name In the Canvas component, set the invert in the filter to -1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0250', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0250 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D03") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0250 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0270 + * @tc.name In the Canvas component, set the invert in the filter to 0.5 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0270', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0270 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D04") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0270 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0150 + * @tc.name In the Canvas component, the sepia is not set + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0150', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0150 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D05") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0150 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0390 + * @tc.name In the Canvas component, the brightness is set to 0.5 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0390', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0390 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D06") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0390 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0210 + * @tc.name In the Canvas component, the hugrotate is set to 0 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0210', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0210 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D07") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0210 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0230 + * @tc.name In the Canvas component, the hugrotate is set to 180 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0230', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0230 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D08") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0230 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0380 + * @tc.name In the Canvas component, the brightness is set to 0.3 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0380', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0380 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D09") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0380 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0370 + * @tc.name In the Canvas component, the brightness is set to 0 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0370', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0370 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D10") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0370 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0340 + * @tc.name In the Canvas component, the opacity is set to 1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0340', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0340 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D11") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0340 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0080 + * @tc.name In the Canvas component, the grayscale is set to 2 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0080', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0080 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D12") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0080 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0070 + * @tc.name In the Canvas component, the grayscale is set to 1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0070', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0070 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D13") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0070 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0060 + * @tc.name In the Canvas component, the grayscale is set to 0.5 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0060', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0060 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D14") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0060 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0040 + * @tc.name In the Canvas component, the grayscale is set to -1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0040', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0040 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D15") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0040 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0120 + * @tc.name In the Canvas component, the sepia is set to 1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0120', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0120 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D16") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0120 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0100 + * @tc.name In the Canvas component, the sepia is set to -1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0100', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0100 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D17") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0100 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0400 + * @tc.name In the Canvas component, the sepia is set to 1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0400', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0400 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D18") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0400 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0410 + * @tc.name In the Canvas component, the contrast is set to default + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0410', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0410 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D19") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0410 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0450 + * @tc.name In the Canvas component, the contrast is set to 3 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0450', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0450 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D20") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0450 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0430 + * @tc.name In the Canvas component, the contrast is set to 0.5 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0430', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0430 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D21") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0430 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0440 + * @tc.name In the Canvas component, the contrast is set to 1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0440', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0440 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D22") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0440 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0420 + * @tc.name In the Canvas component, the contrast is set to 0 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0420', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0420 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D23") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0420 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0200 + * @tc.name In the Canvas component, the saturate is set to 3 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0200', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0200 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D24") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0200 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0180 + * @tc.name In the Canvas component, the saturate is set to 0.5 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0180', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0180 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D25") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0180 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0170 + * @tc.name In the Canvas component, the saturate is set to 0 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0170', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0170 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D26") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0170 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0190 + * @tc.name In the Canvas component, the saturate is set to 1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0190', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0190 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D27") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0190 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0160 + * @tc.name In the Canvas component, the saturate is not set + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0160', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0160 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D28") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0160 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0260 + * @tc.name In the Canvas component, the invert is set to 0 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0260', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0260 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D29") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0260 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0220 + * @tc.name In the Canvas component, the invert is set to 90 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0220', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0220 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D30") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0220 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0240 + * @tc.name In the Canvas component, the invert is set to 360 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0240', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0240 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D31") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0240 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0320 + * @tc.name In the Canvas component, the opacity is set to 0 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0320', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0320 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D32") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0320 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0330 + * @tc.name In the Canvas component, the opacity is set to 0.5 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0330', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0330 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D33") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0330 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0300 + * @tc.name In the Canvas component, the opacity is set to defult + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0300', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0300 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D34") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0300 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0490 + * @tc.name In the Canvas component, the blur is set to 5 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0490', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0490 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D35") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0490 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0470 + * @tc.name In the Canvas component, the blur is set to 0 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0470', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0470 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D36") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0470 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0480 + * @tc.name In the Canvas component, the blur is set to 3 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0480', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0480 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D37") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0480 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0600 + * @tc.name In the Canvas component, the direction is set to rtl + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0600', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0600 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D38") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0600 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0310 + * @tc.name In the Canvas component, the opacity is set to -11 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0310', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0310 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D39") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0310 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0460 + * @tc.name In the Canvas component, the blur is set to default + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0460', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0460 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D40") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0460 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0360 + * @tc.name In the Canvas component, the brightness is set to -1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0360', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0360 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D41") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0360 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0280 + * @tc.name In the Canvas component, the invert is set to 1 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0280', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0280 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D42") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0280 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0350 + * @tc.name In the Canvas component, the brightness is set to default + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0350', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0350 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D43") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0350 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0590 + * @tc.name In the Canvas component, the direction is set to ltr + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0590', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0590 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D44") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0590 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0050 + * @tc.name In the Canvas component, the grayscale is set to 0 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0050', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0050 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D45") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0050 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0090 + * @tc.name In the Canvas component, the grayscale is not set + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0090', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0090 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D46") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0090 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0140 + * @tc.name In the Canvas component, the sepia is set to 2 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0140', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0140 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D47") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0140 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0290 + * @tc.name In the Canvas component, the invert is set to 2 + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0290', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0290 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D48") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0290 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0570 + * @tc.name In the Canvas component, the imageSmoothingEnabled is set to true + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0570', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0570 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D49") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0570 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0580 + * @tc.name In the Canvas component, the imageSmoothingEnabled is set to false + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0580', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0580 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D50") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0580 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0540 + * @tc.name In the Canvas component, the imageSmoothingQuality is set to low + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0540', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0540 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D51") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0540 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0550 + * @tc.name In the Canvas component, the imageSmoothingQuality is set to medium + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0550', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0550 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D52") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0550 finish.`); + done() + }) + + /* + * @tc.number SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0560 + * @tc.name In the Canvas component, the imageSmoothingQuality is set to high + * @tc.desc Function test + * @tc.size MediumTest + * @tc.type Function + * @tc.level 3 + */ + it('SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0560', Level.LEVEL3, async (done: Function) => { + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0560 start.`); + Settings.createWindow("testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D53") + let driver: Driver = Driver.create(); + await driver.waitForIdle(500, 2000) + windowSnap.snapShot() + await Utils.sleep(1000) + Logger.info('TEST', `SUB_ACE_UI_COMPONENT_CANVAS_MATRIX2D_CANVASPATTERN_0560 finish.`); + done() + }) + + }) +} + + + + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D01.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D01.ets new file mode 100644 index 0000000000000000000000000000000000000000..2510e263006f403a07787c74a6577c4a7d536bf9 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D01.ets @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D01 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('sepia is 0.5') + .fontSize(15) + .height(100) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'sepia(0.5)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('sepia is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D02.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D02.ets new file mode 100644 index 0000000000000000000000000000000000000000..e5617ba23df4196336a4527ca013bbe42720aea3 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D02.ets @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D02 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('sepia is 0') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'sepia(0)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('sepia is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D03.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D03.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6fa90be4c4e4593c430c9585bcbc28d7e2c0ca4 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D03.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D03 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('invert is -1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'invert(-1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('invert is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D04.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D04.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4cab3a922bcea5c1eb8881e3614bf12b04c7702 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D04.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D04 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('invert is 0.5') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'invert(0.5)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('invert is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D05.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D05.ets new file mode 100644 index 0000000000000000000000000000000000000000..7865e45215d4817634dbf003c55e1a3a16d419e4 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D05.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D05 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('sepia is 0') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'sepia(0)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('sepia is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D06.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D06.ets new file mode 100644 index 0000000000000000000000000000000000000000..9be806d3a584c9343eabf25d26ede48a80803106 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D06.ets @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D06 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('brightness is 0.5') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'brightness(0.5)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('brightness is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .height(100) + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D07.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D07.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1cc1f69ad210f86eb631862904e1a259602c181 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D07.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D07 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('hue-rotate is 0') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'hue-rotate(0deg)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('hue-rotate is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D08.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D08.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ae4a7bcd5005a6e3380bfa4c44a3b30ab16ebd9 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D08.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D08 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('hue-rotate is 0.5') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'hue-rotate(180deg)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('hue-rotate is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D09.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D09.ets new file mode 100644 index 0000000000000000000000000000000000000000..d13d18545abe78e9381051c140e839715365a470 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D09.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D09 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('brightness is 0.3') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'brightness(0.3)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('brightness is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .height(100) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D10.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D10.ets new file mode 100644 index 0000000000000000000000000000000000000000..5a980ace525f3312071315a891f6350363236456 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D10.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D10 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('brightness is 0') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'brightness(0)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('brightness is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .height(100) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D11.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D11.ets new file mode 100644 index 0000000000000000000000000000000000000000..763f390996de8e16a95b6b80567a2d7fd16bf460 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D11.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D11 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('opacity is 1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'opacity(1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('opacity is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D12.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D12.ets new file mode 100644 index 0000000000000000000000000000000000000000..9cea9dc2ca5c975dd42a6ca05eebd5aeadfb64e0 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D12.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D12 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('grayscale is 2') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'grayscale(2)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('grayscale is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D13.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D13.ets new file mode 100644 index 0000000000000000000000000000000000000000..1317fa3a9054069757dc043931a55877954ea6a1 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D13.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D13 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('grayscale is 1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'grayscale(1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('grayscale is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D14.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D14.ets new file mode 100644 index 0000000000000000000000000000000000000000..5bcc2d443e2c17cb24124de52deabf790b38e0cc --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D14.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D14 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('grayscale is 0.5') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'grayscale(0.5)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('grayscale is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D15.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D15.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f8981af8f023cdd60b0763b932767aa8052e19d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D15.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D15 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('grayscale is -1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'grayscale(-1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('grayscale is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .height(100) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D16.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D16.ets new file mode 100644 index 0000000000000000000000000000000000000000..3787481dee8a3e4534fd0545ff4bc9b72bd3a55d --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D16.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D16 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('sepia is 1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'sepia(1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('sepia is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D17.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D17.ets new file mode 100644 index 0000000000000000000000000000000000000000..58fc71ddada7cad904b523c1381b82d6d778c88f --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D17.ets @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D17 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('sepia is -1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'sepia(-1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('sepia is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .height(100) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D18.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D18.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2a90152ebd7d7931b3f1e466008393ef1b558ca --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D18.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D18 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('brightness is 1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'brightness(1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('brightness is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .height(100) + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D19.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D19.ets new file mode 100644 index 0000000000000000000000000000000000000000..4cba5c78c5fd9b9d96fbf1b7348a2500cdbe0905 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D19.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D19 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('contrast is default') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'contrast(1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('contrast is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .height(100) + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D20.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D20.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ce3a50c05eaf14a2e26ebbcb5cb6e74afeff18a --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D20.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D20 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('contrast is 3') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'contrast(3)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('contrast is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .height(100) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D21.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D21.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f8acc18cc26ea9c189d7f1cac84deb4bd28e6ef --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D21.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D21 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('contrast is 0.5') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'contrast(0.5)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('contrast is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .height(100) + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D22.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D22.ets new file mode 100644 index 0000000000000000000000000000000000000000..00d2e1160f9ed38ea809b49e953bfe9d9fe00979 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D22.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D22 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('contrast is 1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'contrast(1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('contrast is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .height(100) + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D23.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D23.ets new file mode 100644 index 0000000000000000000000000000000000000000..41936aa841d721af8b5ee9f59c7c4d4043f2d686 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D23.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D23 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('contrast is 0') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'contrast(0)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('contrast is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .height(100) + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D24.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D24.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecc580d7409e618bb3e5f11d69a274f190607684 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D24.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D24 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('saturate is 3') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'saturate(3)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('saturate is not set') + .fontSize(15) + .height(100) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D25.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D25.ets new file mode 100644 index 0000000000000000000000000000000000000000..a532b84084cd4cc97db075e5781c3b3cbcc71d98 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D25.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D25 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('saturate is 0.5') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'saturate(0.5)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('saturate is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .height(100) + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D26.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D26.ets new file mode 100644 index 0000000000000000000000000000000000000000..a8f11d4e5a58d1ec186fcb9361f2a326c70165cb --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D26.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D26 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('saturate is 0') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'saturate(0)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('saturate is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .height(100) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D27.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D27.ets new file mode 100644 index 0000000000000000000000000000000000000000..97f88e2d4b5b4d63ec854a0a0ab77d44148037e0 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D27.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D27 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('saturate is 1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'saturate(1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('saturate is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .height(100) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D28.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D28.ets new file mode 100644 index 0000000000000000000000000000000000000000..4071290de86c6192591d9bc45b6642bbb0a82792 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D28.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D28 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('saturate is default') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'saturate(none)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('saturate is not set') + .fontSize(15) + .height(100) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D29.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D29.ets new file mode 100644 index 0000000000000000000000000000000000000000..e01497d2bb08eac07c8b808158e4859e4b7eb271 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D29.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D29 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('invert is 0') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'invert(0)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('invert is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .height(100) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D30.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D30.ets new file mode 100644 index 0000000000000000000000000000000000000000..613d36fbe9c142271ff84315e97e7bc07b68f255 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D30.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D30 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('hueRotate is 90') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'hue-rotate(90deg)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('hueRotate is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .height(100) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D31.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D31.ets new file mode 100644 index 0000000000000000000000000000000000000000..9f6fe42ddecd33b627d940c54e341437492b4648 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D31.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D31 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('hueRotate is 360') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'hue-rotate(360deg)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('hueRotate is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .height(100) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D32.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D32.ets new file mode 100644 index 0000000000000000000000000000000000000000..45976a4ef1cb7c303b9615d69edc5bbdaf84f614 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D32.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D32 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('opacity is 0') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'opacity(0)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('opacity is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .height(100) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D33.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D33.ets new file mode 100644 index 0000000000000000000000000000000000000000..f13850058d22cf31fc2e1c36c6834f94ef6f81cb --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D33.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D33 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('opacity is 0.5') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .height(100) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'opacity(0.5)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('opacity is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .height(100) + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D34.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D34.ets new file mode 100644 index 0000000000000000000000000000000000000000..fabee2271a8bf43ef5e850a502c988dd255b4c2f --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D34.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D34 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('opacity is default') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'opacity(none)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('opacity is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .height(100) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D35.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D35.ets new file mode 100644 index 0000000000000000000000000000000000000000..6bfe8981a6fd346b36378d12c38b5a93dc3b24e2 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D35.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D35 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('blur is 5') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'blur(5px)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('blur is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .height(100) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D36.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D36.ets new file mode 100644 index 0000000000000000000000000000000000000000..128c6a07b07daf8bb19821148e593df107234788 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D36.ets @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D36 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('blur is 0') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'blur(0px)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('blur is not set') + .fontSize(15) + .height(100) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D37.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D37.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6e6602bc03ec6c484b348a3113ebbde6415b185 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D37.ets @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D37 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('blur is 3') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'blur(3px)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('blur is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D38.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D38.ets new file mode 100644 index 0000000000000000000000000000000000000000..c91665f88cc0dfc1fa9aad715c221176756f18b4 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D38.ets @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D38 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('direction is rtl') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + console.log('context onReady') + ctx.direction = "rtl"; + this.context.font = '10px' + this.context.fillText("hello world!",10,10) + this.context.font = '10px' + this.context.strokeText("hello world!",10,10) + }) + + Text('direction is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .height(100) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + console.log('context2 onReady') + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + }) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D39.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D39.ets new file mode 100644 index 0000000000000000000000000000000000000000..e853783a7eb6e4de2b96e7d2c9283c75d11aada9 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D39.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D39 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('opacity is -11') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'opacity(-11)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('opacity is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .height(100) + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D40.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D40.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a48ace23b5164b2fa0e938f257592facca43208 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D40.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D40 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('blur is default') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'blur(none)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('blur is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D41.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D41.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ad637ad27d6ed7557cf26424ba6128f6552f5cd --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D41.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D41 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('brightness is -1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'brightness(-1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('brightness is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D42.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D42.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f74e2f30d9b27358cc414ecf6b85f640f6a8954 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D42.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D42 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('invert is 1') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .height(100) + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'invert(1)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('invert is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .height(100) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D43.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D43.ets new file mode 100644 index 0000000000000000000000000000000000000000..dab33b38a61853acdcdbc9249b3037d43c2f4187 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D43.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D43 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('brightness is default') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'brightness(none)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('brightness is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D44.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D44.ets new file mode 100644 index 0000000000000000000000000000000000000000..79e0dc8dd5e69b3f3911f94541aa49951d1cfcfb --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D44.ets @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D44 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('direction is ltr') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + console.log('context onReady') + ctx.direction = "ltr"; + this.context.font = '10px' + this.context.fillText("hello world!",10,10) + this.context.font = '10px' + this.context.strokeText("hello world!",10,10) + }) + + Text('direction is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + console.log('context2 onReady') + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + }) + } + .width('100%') + .height('100%') + } +} diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D45.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D45.ets new file mode 100644 index 0000000000000000000000000000000000000000..e25006a8575c20716d2257344608f48f49e90bfe --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D45.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D45 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('grayscale is 0') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'grayscale(0)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('grayscale is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D46.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D46.ets new file mode 100644 index 0000000000000000000000000000000000000000..a7b0c1c922f41755c4c86e59f2e6808036ff0d82 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D46.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D46 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('grayscale is default') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'grayscale(none)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('grayscale is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D47.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D47.ets new file mode 100644 index 0000000000000000000000000000000000000000..d14f684ce63e175a4ab50413556c17d786805935 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D47.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D47 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('sepia is 2') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'sepia(2)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('sepia is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D48.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D48.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1a798c8a9ff6efd78b63717b569a20488642c6a --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D48.ets @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D48 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('invert is 2') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.filter = 'invert(2)' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('invert is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D49.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D49.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8abf9e36024d64d15287d21a82c45be555bf87f --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D49.ets @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D49 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('imageSmoothing is true') + .fontSize(15) + .height(100) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.imageSmoothingEnabled = true + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('imageSmoothing is false') + .fontSize(15) + .height(100) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.imageSmoothingEnabled = false + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D50.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D50.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ecef12175cf0e635eddf702affb12ad7b9497f0 --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D50.ets @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D50 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('imageSmoothing is true') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.imageSmoothingEnabled = true + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('imageSmoothing is false') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.imageSmoothingEnabled = false + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D51.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D51.ets new file mode 100644 index 0000000000000000000000000000000000000000..a49bc1ce526d0009f1b28101e44883ebe3d58b8c --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D51.ets @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D51 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Quality is low') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.imageSmoothingQuality = 'low' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('Quality is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .height(100) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.imageSmoothingEnabled = false + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D52.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D52.ets new file mode 100644 index 0000000000000000000000000000000000000000..bbac311b504631e0e1d4d48c215a477ae389cf6b --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D52.ets @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D52 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Quality is medium') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.imageSmoothingQuality = 'medium' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('Quality is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .height(100) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.imageSmoothingEnabled = false + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D53.ets b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D53.ets new file mode 100644 index 0000000000000000000000000000000000000000..2277e64c8a0268d0636325fd3021da4b7e59f5fb --- /dev/null +++ b/sample/ui_compare/uiCompareTest_02/entry/src/ohosTest/ets/testability/pages/UiComponentCanvasMatrix2D/UiComponentCanvasMatrix2D53.ets @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2025 Shenzhen Kaihong Digital Industry Development Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct UiComponentCanvasMatrix2D53 { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private settings2: RenderingContextSettings = new RenderingContextSettings(true) + private context2: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings2) + private img:ImageBitmap = new ImageBitmap('/icon.png'); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Quality is high') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context + let img = this.img + ctx.imageSmoothingQuality = 'high' + ctx.drawImage(img, 0, 0, 100, 100); + this.context.font = '10px' + this.context.fillText("hello world",10,10) + this.context.font = '10px' + this.context.strokeText("hello world",10,10) + console.log('context onReady') + }) + + Text('Quality is not set') + .fontSize(15) + .fontColor(0xCCCCCC) + .width('90%') + .border({ width: 1 }) + .lineHeight(20) + .margin(30) + .padding(10) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .height(100) + Canvas(this.context2) + .width('40%') + .height('40%') + .backgroundColor('#ffff00') + .enableAnalyzer(true) + .onReady(() => { + let ctx = this.context2 + let img = this.img + ctx.imageSmoothingEnabled = false + ctx.drawImage(img, 0, 0, 100, 100); + this.context2.font = '10px' + this.context2.fillText("hello world",10,10) + this.context2.font = '10px' + this.context2.strokeText("hello world",10,10) + console.log('context2 onReady') + }) + } + .width('100%') + .height('100%') + } +} +