diff --git a/arkui/ace_ets_components_ux/BUILD.gn b/arkui/ace_ets_components_ux/BUILD.gn index 99e780d6a7e76f83d61b6c750376c80db7374c92..7cb861234dbd28ddab30c9ea0ae393107961978a 100644 --- a/arkui/ace_ets_components_ux/BUILD.gn +++ b/arkui/ace_ets_components_ux/BUILD.gn @@ -20,6 +20,7 @@ group("componentUxTest") { "ace_ets_component_radio:ActsAceRadioTest", "ace_ets_component_select:ActsAceSelectTest", "ace_ets_component_sidebar:ActsAceSideBarTest", + "ace_ets_component_slider:ActsAceSliderTest", "ace_ets_component_tabs:ActsAceTabsTest", "ace_ets_component_text:ActsAceTextTest", "ace_ets_component_textpicker:ActsAceTextPickerTest", diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/AppScope/app.json b/arkui/ace_ets_components_ux/ace_ets_component_slider/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..91d44499f5fc117b73eb135bc0f1827bbdc2b29e --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.slidertest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/AppScope/resources/base/element/string.json b/arkui/ace_ets_components_ux/ace_ets_component_slider/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..30af7cfee6766dda361b893d1565490dc145fdf0 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"MyApplication" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/AppScope/resources/base/media/app_icon.png b/arkui/ace_ets_components_ux/ace_ets_component_slider/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_components_ux/ace_ets_component_slider/AppScope/resources/base/media/app_icon.png differ diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/BUILD.gn b/arkui/ace_ets_components_ux/ace_ets_component_slider/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c12100b251c7c7dd086c847579434545c69ff665 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAceSliderTest") { + hap_profile = "src/main/module.json" + js_build_mode = "debug" + deps = [ + ":ace_ets_component_slider_js_assets", + ":ace_ets_component_slider_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAceSliderTest" + part_name = "ace_engine" + subsystem_name = "arkui" +} + +ohos_app_scope("ace_ets_component_slider_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("ace_ets_component_slider_js_assets") { + source_dir = "src/main/ets" +} + +ohos_resources("ace_ets_component_slider_resources") { + sources = [ "src/main/resources" ] + deps = [ ":ace_ets_component_slider_profile" ] + hap_profile = "src/main/module.json" +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/Test.json b/arkui/ace_ets_components_ux/ace_ets_component_slider/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..091fba3dd67dea3623ffc9838a42662aaa016b11 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.slidertest", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 240000 + }, + "kits": [{ + "test-file-name": [ + "ActsAceSliderTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602" + ] + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/signature/openharmony_sx.p7b b/arkui/ace_ets_components_ux/ace_ets_component_slider/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..40de35c36eed6cf44a0f1335b7eda35a75dddb24 Binary files /dev/null and b/arkui/ace_ets_components_ux/ace_ets_component_slider/signature/openharmony_sx.p7b differ diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/TestAbility/TestAbility.ets b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/TestAbility/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..6cf23a977bde79dec0ab9cb41c370d069294035f --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/TestAbility/TestAbility.ets @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import hilog from '@ohos.hilog'; +import Ability from '@ohos.app.ability.UIAbility' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import testsuite from '../test/List.test' +import Window from '@ohos.window' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + } + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + onWindowStageCreate(windowStage: Window.WindowStage) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('TestAbility/pages/Index', (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + onWindowStageDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + onForeground() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + onBackground() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/TestAbility/pages/Index.ets b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/TestAbility/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..42edfcfdc6d9b208cddeecfe6f7808ae48a07753 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/TestAbility/pages/Index.ets @@ -0,0 +1,1077 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +//@ts-nocheck +import events_emitter from '@ohos.events.emitter'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import { Hypium } from '@ohos/hypium'; +import hilog from '@ohos.hilog'; +import testsuite from '../../test/List.test' +@Entry +@Component +struct SliderTest { + aboutToAppear(){ + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + @State message: string = 'Hello Worlds' + @State str: string = '200' + @State inSetValueOne: number = 40; + circle = new Circle({ width: '280px', height: '280px' }).fill('#FFFF0000') + Ellipse = new Ellipse({ width: '280px', height: '280px' }).fill('#FFFF0000') + Path = new Path({ width: '280px', height: '280px' }).fill('#FFFF0000') + Rect = new Rect({ width: '280px', height: '280px' }).fill('#FFFF0000') + private sliderImage: SliderBlockStyle = { type: 1, image: $r('app.media.icon') } + private sliderShapeCircle: SliderBlockStyle = { type: 2, shape: this.circle } + private sliderShapeEllipse: SliderBlockStyle = { type: 2, shape: this.Ellipse } + private sliderShapePath: SliderBlockStyle = { type: 2, shape: this.Path } + private sliderShapeRect: SliderBlockStyle = { type: 2, shape: this.Rect } + private sliderDefault: SliderBlockStyle = { type: 0 } + build() { + Row() { + Column() { + List({ space: 0, initialIndex: 0 }){ + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_0100') + .blockBorderColor(0xffa500) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_0200') + .blockBorderColor('#ffc709e9') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_0300') + .blockBorderColor(Color.Pink) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_0400') + .blockBorderColor($r("app.color.start_block_Border_Color")) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_0500') + .blockBorderColor(null) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_0600') + .blockBorderColor("rgb(0,255,255)") + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_0700') + .blockBorderColor(0x00ff00) + .backgroundColor(Color.Pink) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_0800') + .blockBorderColor(undefined) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_0900') + .blockBorderColor('bgr(138,43,226)') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_1000') + .blockBorderColor('') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_1100') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_1200') + .blockBorderColor(0xffa500) + .blockBorderColor('#ffc709e9') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderColor_1300') + .blockBorderColor(0xffa500) + .blockBorderColor('bgr(138,43,226)') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_0100') + .blockBorderWidth(5) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_0200') + .blockBorderWidth('5px') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_0300') + .blockBorderWidth($r("app.string.block_border_width_test")) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_0400') + .blockBorderWidth('') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_0500') + .blockBorderWidth(null) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_0600') + .blockBorderWidth(undefined) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_0700') + .blockBorderWidth(0) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_0800') + .blockBorderWidth(-1) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_0900') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_1000') + .blockBorderWidth(5) + .blockBorderWidth(7) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_1100') + .blockBorderWidth(5) + .blockBorderWidth(undefined) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_1200') + .blockBorderWidth('asdf%^7') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockBorderWidth_1300') + .blockBorderWidth(5) + .width(7) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_0100') + .stepColor(0xffa500) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_0200') + .stepColor('#ffc709e9') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_0300') + .stepColor(Color.Pink) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_0400') + .stepColor($r("app.color.start_Step_Color")) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_0500') + .stepColor(null) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_0600') + .stepColor("rgb(0,255,255)") + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_0700') + .stepColor(0x00ff00) + .backgroundColor(Color.Pink) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_0800') + .stepColor(undefined) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_0900') + .stepColor('bgr(138,43,226)') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_1000') + .stepColor('') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_1100') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_1200') + .stepColor(0xffa500) + .stepColor('#ffc709e9') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepColor_1300') + .stepColor(0xffa500) + .stepColor('bgr(138,43,226)') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_0100') + .trackBorderRadius(0) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_0200') + .trackBorderRadius(10) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_0300') + .trackBorderRadius('60px') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_0400') + .trackBorderRadius('120%') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_0500') + .trackBorderRadius($r("app.string.trach_border_radius_test")) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_0600') + .trackBorderRadius("") + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_0700') + .trackBorderRadius(null) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_0800') + .trackBorderRadius(undefined) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_0900') + .trackBorderRadius(-1) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_1000') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_1100') + .trackBorderRadius(10) + .trackBorderRadius(40) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_1200') + .trackBorderRadius(10) + .trackBorderRadius(undefined) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_1300') + .trackBorderRadius("asdf#$8") + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_trackBorderRadius_1400') + .trackBorderRadius(0) + .size(null) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_0100') + .blockSize({ width: 0, height: 0 }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_0200') + .blockSize({ width: 5, height: 5 }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_0300') + .blockSize({ width: 15, height: 20 }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_0400') + .blockSize({ width: 12, height: 12 }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_0500') + .blockSize({ width: "20px", height: "20px" }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_0600') + .blockSize({ width: "120%", height: "120%" }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_0700') + .blockSize({ + width: $r("app.string.block_size_width_test"), + height: $r("app.string.block_size_height_test") + }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_0800') + .blockSize({ width: " ", height: " " }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_0900') + .blockSize({ width: null, height: null }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_1000') + .blockSize({ width: undefined, height: undefined }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_1100') + .blockSize({ width: -1, height: -1 }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_1200') + .blockSize({ width: -1, height: 15 }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_1300') + .blockSize({ width: "15", height: "-1" }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_1400') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_1500') + .blockSize({ width: 15, height: 20 }) + .blockSize({ width: "20fp", height: "25fp" }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_1600') + .blockSize({ width: 15, height: 20 }) + .blockSize({ width: -1, height: -1 }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_1700') + .blockSize({ width: "asdf#$8", height: "asdf#$8" }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockSize_1800') + .blockSize({ width: "20lsp", height: "20lsp" }) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_0100') + .stepSize(0) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_0200') + .stepSize(10) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_0300') + .stepSize("60px") + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_0400') + .stepSize("120%") + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_0500') + .stepSize($r("app.string.step_size_test")) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_0600') + .stepSize("") + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_0700') + .stepSize(null) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_0800') + .stepSize(undefined) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_0900') + .stepSize(-1) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_1000') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_1100') + .stepSize(10) + .stepSize(40) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_1200') + .stepSize(10) + .stepSize(undefined) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_1300') + .stepSize("asdf#$8") + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_stepSize_1400') + .stepSize(10) + .size(null) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_Test_0100') + .blockBorderColor('#ffc709e9') + .blockBorderWidth(10) + .stepColor('#fff10202') + .trackBorderRadius(15) + .blockSize({ width: 10, height: 10 }) + .stepSize(10) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_0100') + .blockStyle(this.sliderDefault) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_0200') + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_0300') + .blockStyle(this.sliderImage) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_0400') + .blockStyle(this.sliderShapeCircle) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_0500') + .blockStyle(this.sliderShapeEllipse) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_0600') + .blockStyle(this.sliderShapePath) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_0700') + .blockStyle(this.sliderShapeRect) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_0800') + .blockStyle(this.sliderDefault) + .blockStyle(this.sliderShapeCircle) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_0900') + .blockStyle(this.sliderImage) + .blockStyle(null) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_1000') + .blockStyle(" ") + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_1100') + .blockStyle(null) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_1200') + .blockStyle(undefined) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_1300') + .blockStyle(-1) + } + ListItem() { + Slider({ + value: this.inSetValueOne, + min: 0, + max: 100, + style: SliderStyle.InSet + }) + .key('ArkUX_Stage_Slider_blockStyle_1400') + .blockStyle(this.sliderShapeCircle) + .size(null) + } + } + } + .width('100%') + } + .height('100%') + } +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..d6c662824093f9339085214d247c6247faa86ae9 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }) + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/test/List.test.ets b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b348accf6dc96c7acdf2eabb98cef7cde95b5a2a --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import sliderTest from './SliderTest' + +export default function testsuite() { + sliderTest() +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/test/SliderTest.ets b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/test/SliderTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..dcb92f79cf264e6c08edac7eb711631521a9b66f --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/test/SliderTest.ets @@ -0,0 +1,497 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +//@ts-nocheck +import hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter'; + +function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve("ok") + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) +} + +export default function sliderTest() { + describe('ActsAbilityTest', function () { + + /* + * @tc.number ArkUX_Stage_Slider_blockBorderColor_0100 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to 0xffa500 + */ + it('ArkUX_Stage_Slider_blockBorderColor_0100', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_0100] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_0100'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_0100 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#FFFFA500"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_0100 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_0200 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to "ffc709e9" + */ + it('ArkUX_Stage_Slider_blockBorderColor_0200', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_0200] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_0200'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_0200 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#FFC709E9"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_0200 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_0300 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to Color.Pink + */ + it('ArkUX_Stage_Slider_blockBorderColor_0300', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_0300] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_0300'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_0300 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#FFFFC0CB"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_0300 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_0400 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to $r("app.color.start_block_Border_Color") + */ + it('ArkUX_Stage_Slider_blockBorderColor_0400', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_0400] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_0400'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_0400 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#FF19D41C"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_0400 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_0500 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to null + */ + it('ArkUX_Stage_Slider_blockBorderColor_0500', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_0500] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_0500'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_0500 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#00000000"); + done() + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_0500 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_0600 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to "rgb(0,255,255)" + */ + it('ArkUX_Stage_Slider_blockBorderColor_0600', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_0600] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_0600'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_0600 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#FF00FFFF"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_0600 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_0700 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to 0x00ff00 and set the backgroundColor attribute to Color.Pink + */ + it('ArkUX_Stage_Slider_blockBorderColor_0700', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_0700] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_0700'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_0700 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#FF00FF00"); + done(); + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_blockBorderColor_0700 ERROR: ' + JSON.stringify(err)); + done() + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_0800 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to undefined + */ + it('ArkUX_Stage_Slider_blockBorderColor_0800', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_0800] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_0800'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_0800 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#00000000"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_0800 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_0900 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to "bgr(138,43,226)" + */ + it('ArkUX_Stage_Slider_blockBorderColor_0900', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_0900] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_0900'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_0900 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#00000000"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_0900 ERROR: ' + JSON.stringify(err)); + done() + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_1000 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to " " + */ + it('ArkUX_Stage_Slider_blockBorderColor_1000', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_1000] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_1000'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_1000 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#00000000"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_1000 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_1100 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Do not set the blockBorderColor + */ + it('ArkUX_Stage_Slider_blockBorderColor_1100', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_1100] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_1100'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_1100 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#00000000"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_1100 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_1200 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to 0xffa500a and then set the blockBorderColor attribute to "#ffc709e9" + */ + it('ArkUX_Stage_Slider_blockBorderColor_1200', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_1200] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_1200'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_1200 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#FFC709E9"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_1200 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderColor_1300 + * @tc.name Test the blockBorderColor property of the Slider component + * @tc.desc Set the blockBorderColor attribute to 0xffa500 and then set the blockBorderColor attribute to "bgr(138,43,226)" + */ + it('ArkUX_Stage_Slider_blockBorderColor_1300', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderColor_1300] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderColor_1300'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_blockBorderColor_1300 is" + JSON.stringify(obj.$attrs.blockBorderColor)); + expect(obj.$attrs.blockBorderColor).assertEqual("#FFFFA500"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_1300 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderWidth_0100 + * @tc.name Test the blockBorderWidth property of the Slider component + * @tc.desc Set the blockBorderWidth attribute to 5 + */ + it('ArkUX_Stage_Slider_blockBorderWidth_0100', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderWidth_0100] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderWidth_0100'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_Slider_blockBorderWidth_0100 is" + JSON.stringify(obj.$attrs.blockBorderWidth)); + expect(obj.$attrs.blockBorderWidth).assertEqual("5.00vp"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_1100 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderWidth_0200 + * @tc.name Test the blockBorderWidth property of the Slider component + * @tc.desc Set the blockBorderWidth attribute to "5px" + */ + it('ArkUX_Stage_Slider_blockBorderWidth_0200', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderWidth_0200] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderWidth_0200'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_Slider_blockBorderWidth_0200 is" + JSON.stringify(obj.$attrs.blockBorderWidth)); + expect(obj.$attrs.blockBorderWidth).assertEqual("5.00px"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderWidth_0200 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderWidth_0300 + * @tc.name Test the blockBorderWidth property of the Slider component + * @tc.desc Set the blockBorderWidth attribute to $r("app.string.block_border_width_test") + */ + it('ArkUX_Stage_Slider_blockBorderWidth_0300', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderWidth_0300] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderWidth_0300'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_Slider_blockBorderWidth_0300 is" + JSON.stringify(obj.$attrs.blockBorderWidth)); + expect(obj.$attrs.blockBorderWidth).assertEqual("7.00vp"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderColor_1100 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderWidth_0400 + * @tc.name Test the blockBorderWidth property of the Slider component + * @tc.desc Set the blockBorderWidth attribute to ' ' + */ + it('ArkUX_Stage_Slider_blockBorderWidth_0400', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderWidth_0400] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderWidth_0400'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_Slider_blockBorderWidth_0400 is" + JSON.stringify(obj.$attrs.blockBorderWidth)); + expect(obj.$attrs.blockBorderWidth).assertEqual("0.00vp"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderWidth_0400 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderWidth_0500 + * @tc.name Test the blockBorderWidth property of the Slider component + * @tc.desc Set the blockBorderWidth attribute to null + */ + it('ArkUX_Stage_Slider_blockBorderWidth_0500', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderWidth_0500] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderWidth_0500'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_Slider_blockBorderWidth_0500 is" + JSON.stringify(obj.$attrs.blockBorderWidth)); + expect(obj.$attrs.blockBorderWidth).assertEqual("0.00px"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderWidth_0500 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderWidth_0600 + * @tc.name Test the blockBorderWidth property of the Slider component + * @tc.desc Set the blockBorderWidth attribute to undefined + */ + it('ArkUX_Stage_Slider_blockBorderWidth_0600', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderWidth_0600] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderWidth_0600'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_Slider_blockBorderWidth_0600 is" + JSON.stringify(obj.$attrs.blockBorderWidth)); + expect(obj.$attrs.blockBorderWidth).assertEqual("0.00px"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderWidth_0600 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderWidth_0700 + * @tc.name Test the blockBorderWidth property of the Slider component + * @tc.desc Set the blockBorderWidth attribute to 0 + */ + it('ArkUX_Stage_Slider_blockBorderWidth_0700', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderWidth_0700] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderWidth_0700'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_Slider_blockBorderWidth_0700 is" + JSON.stringify(obj.$attrs.blockBorderWidth)); + expect(obj.$attrs.blockBorderWidth).assertEqual("0.00vp"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderWidth_0700 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + + /** + * @tc.number ArkUX_Stage_Slider_blockBorderWidth_0800 + * @tc.name Test the blockBorderWidth property of the Slider component + * @tc.desc Set the blockBorderWidth attribute to -1 + */ + it('ArkUX_Stage_Slider_blockBorderWidth_0800', 0, async function (done) { + console.info('[ArkUX_Stage_Slider_blockBorderWidth_0800] START'); + setTimeout(() => { + try { + let strJson = getInspectorByKey('ArkUX_Stage_Slider_blockBorderWidth_0800'); + let obj = JSON.parse(strJson); + console.info("----ArkUX_Stage_Slider_blockBorderWidth_0800 is" + JSON.stringify(obj.$attrs.blockBorderWidth)); + expect(obj.$attrs.blockBorderWidth).assertEqual("0.00px"); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUX_Stage_Slider_blockBorderWidth_0800 ERROR: ' + JSON.stringify(err)); + done(); + } + }, 500) + }) + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/module.json b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..2b03fde2a1898cf911b3b3f2f94a553bca8ebb86 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/module.json @@ -0,0 +1,41 @@ +{ + "module": { + "name": "phone", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], + "abilities": [ + { + "name": "TestAbility", + "srcEntrance": "./ets/TestAbility/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "visible": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/element/color.json b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..b3bb2acef059f4fc10bcbc9fb889f4a55b7127e8 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/element/color.json @@ -0,0 +1,16 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "start_block_Border_Color", + "value": "#FF19D41C" + }, + { + "name": "start_Step_Color", + "value": "#FF19D41C" + } + ] + } \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/element/string.json b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..fb3431b079b41c6ca8e522ee06874146b3e34692 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/element/string.json @@ -0,0 +1,41 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + }, + { + "name": "block_border_width_test", + "value": "7" + }, + { + "name": "trach_border_radius_test", + "value": "50" + }, + { + "name": "block_size_test", + "value": "50" + }, + { + "name": "step_size_test", + "value": "50vp" + }, + { + "name":"block_size_width_test", + "value":"50vp" + }, + { + "name":"block_size_height_test", + "value":"50vp" + }, + + ] + } \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/media/icon.png b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/media/icon.png differ diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/profile/test_pages.json b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..77e90731b5a38d861663029b483df3d3ac9ec74b --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "TestAbility/pages/Index" + ] +}