From 53efd9c3cb2d89404ac8a449384a85c9e847516d Mon Sep 17 00:00:00 2001 From: sunjiakun Date: Tue, 6 Jun 2023 10:31:12 +0800 Subject: [PATCH] addSliderClickeffect Signed-off-by: sunjiakun --- arkui/ace_ets_components_ux/BUILD.gn | 1 + .../AppScope/app.json | 19 + .../resources/base/element/string.json | 8 + .../resources/base/media/app_icon.png | Bin 0 -> 6790 bytes .../ace_ets_component_clickeffect/BUILD.gn | 43 ++ .../ace_ets_component_clickeffect/Test.json | 27 + .../signature/openharmony_sx.p7b | Bin 0 -> 3446 bytes .../src/main/ets/TestAbility/TestAbility.ets | 63 ++ .../src/main/ets/TestAbility/pages/Index.ets | 209 ++++++ .../ets/TestRunner/OpenHarmonyTestRunner.ts | 84 +++ .../src/main/ets/test/List.test.ets | 19 + .../src/main/ets/test/clickeffect.ets | 392 ++++++++++ .../src/main/module.json | 37 + .../main/resources/base/element/color.json | 8 + .../main/resources/base/element/string.json | 32 + .../src/main/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/test_pages.json | 5 + .../ace_ets_component_slider/Test.json | 2 +- .../ets/TestAbility/pages/SliderTestSec.ets | 184 +++++ .../src/main/ets/test/List.test.ets | 2 + .../src/main/ets/test/SliderTestSec.ets | 668 ++++++++++++++++++ .../src/main/module.json | 2 +- .../main/resources/base/element/string.json | 4 + .../resources/base/profile/test_pages.json | 3 +- 24 files changed, 1809 insertions(+), 3 deletions(-) create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/AppScope/app.json create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/AppScope/resources/base/element/string.json create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/AppScope/resources/base/media/app_icon.png create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/BUILD.gn create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/Test.json create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/signature/openharmony_sx.p7b create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestAbility/TestAbility.ets create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestAbility/pages/Index.ets create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/test/List.test.ets create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/test/clickeffect.ets create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/module.json create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/element/color.json create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/element/string.json create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/media/icon.png create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/profile/test_pages.json create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/TestAbility/pages/SliderTestSec.ets create mode 100644 arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/test/SliderTestSec.ets diff --git a/arkui/ace_ets_components_ux/BUILD.gn b/arkui/ace_ets_components_ux/BUILD.gn index ce2dc475e..acee0332e 100644 --- a/arkui/ace_ets_components_ux/BUILD.gn +++ b/arkui/ace_ets_components_ux/BUILD.gn @@ -18,6 +18,7 @@ group("componentUxTest") { "ace_ets_component_badge:ActsAcebadgeTest", "ace_ets_component_button:ActsAceButtonTest", "ace_ets_component_checkbox:ActsAceCheckboxTest", + "ace_ets_component_clickeffect:ActsAceClickEffectTest", "ace_ets_component_datapanel:ActsAceDatapanelTest", "ace_ets_component_datepicker:ActsAceDatePickerTest", "ace_ets_component_progress:ActsAceProgressTest", diff --git a/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/AppScope/app.json b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/AppScope/app.json new file mode 100644 index 000000000..32010143c --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.clickeffecttest", + "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_clickeffect/AppScope/resources/base/element/string.json b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/AppScope/resources/base/element/string.json new file mode 100644 index 000000000..30af7cfee --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/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_clickeffect/AppScope/resources/base/media/app_icon.png b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ES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kui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestAbility/TestAbility.ets new file mode 100644 index 000000000..b3248533a --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestAbility/TestAbility.ets @@ -0,0 +1,63 @@ +/* + * 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'); + } +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestAbility/pages/Index.ets b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestAbility/pages/Index.ets new file mode 100644 index 000000000..1e2e645e8 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestAbility/pages/Index.ets @@ -0,0 +1,209 @@ +/* + * 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 ClickEffectTest { + 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) + } + + build() { + Row() { + Column() { + List({ space: 0, initialIndex: 0 }) { + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.LIGHT }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_1') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.MIDDLE }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_2') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.HEAVY }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_3') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.LIGHT, scale: 0 }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_4') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.LIGHT, scale: 1 }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_5') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.LIGHT, scale: 0.5 }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_6') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.LIGHT, scale: 0.8 }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_7') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.LIGHT, scale: -1 }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_8') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: null, scale: 0.1 }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_9') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: undefined, scale: 0 }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_10') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: 0.2 }) + .clickEffect({ level: ClickEffectLevel.HEAVY, scale: 0.1 }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_11') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.MIDDLE }) + .clickEffect({ level: null }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_12') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: null }) + .clickEffect({ level: ClickEffectLevel.MIDDLE }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_13') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.HEAVY, scale: null }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_14') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: ClickEffectLevel.MIDDLE, scale: undefined }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_15') + } + ListItem() { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor(0xed6f21) + .switchPointColor(0xe5ffffff) + .clickEffect({ level: undefined, scale: null }) + .onChange((isOn: boolean) => { + console.info('Component status:' + isOn) + }) + .key('clickEffect_16') + } + } + .alignListItem(ListItemAlign.Center) + } + .width('100%') + } + .height('100%') + } +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 000000000..9e1abddd7 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,84 @@ +/* + * 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): Promise { + 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(); + let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'; + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback); + let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName; + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters); + let 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, d) => { + 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'); + } +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/test/List.test.ets b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/test/List.test.ets new file mode 100644 index 000000000..85d0c2821 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/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 clickeffectTest from './clickeffect' + +export default function testsuite() { + clickeffectTest() +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/test/clickeffect.ets b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/test/clickeffect.ets new file mode 100644 index 000000000..bf8fa4962 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/ets/test/clickeffect.ets @@ -0,0 +1,392 @@ +/* + * 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 { describe, beforeEach, afterEach, it, expect } from '@ohos/hypium' +let emitKey = "emitUserAgent"; +export default function clickeffectTest() { + describe('ActsClickEffectTest', function () { + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_0100 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc Set the parameter to Light level with default scale + */ + it('ArkUXII_Stage_ClickEffect_Toggle_0100', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_0100 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_1'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_0100]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('0'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.900000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_0100 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_0200 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc Set the parameter to Middle level with default scale + */ + it('ArkUXII_Stage_ClickEffect_Toggle_0200', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_0200 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_2'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_0200]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('1'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.950000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_0200 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_0300 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc Set the parameter to Heavy level with default scale + */ + it('ArkUXII_Stage_ClickEffect_Toggle_0300', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_0300 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_3'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_0300]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('2'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.950000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_0300 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_0400 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc Set the level to Light and set scale to 0 + */ + it('ArkUXII_Stage_ClickEffect_Toggle_0400', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_0400 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_4'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_0400]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('0'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.000000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_0400 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_0500 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc Set the level to Light and set scale to 1 + */ + it('ArkUXII_Stage_ClickEffect_Toggle_0500', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_0500 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_5'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_0500]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('0'); + expect(obj.$attrs.clickEffect.scale).assertEqual('1.000000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_0500 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_0600 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc Set the level to Light and set scale to 0.5 + */ + it('ArkUXII_Stage_ClickEffect_Toggle_0600', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Options_0600 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_6'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_0600]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('0'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.500000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_0600 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_0700 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc Set the level to Light and set scale to 0.8 + */ + it('ArkUXII_Stage_ClickEffect_Toggle_0700', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_0700 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_7'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_0700]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('0'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.800000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_0700 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_0800 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc Set the level to Light and set scale to -1 + */ + it('ArkUXII_Stage_ClickEffect_Toggle_0800', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_0800 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_8'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_0800]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('0'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.900000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_0800 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_0900 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc Set the level to null and set scale to 0.1 + */ + it('ArkUXII_Stage_ClickEffect_Toggle_0900', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_0900 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_9'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_0900]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('0'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.100000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_0900 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_1000 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc Set the level to undefine and set scale to 0 + */ + it('ArkUXII_Stage_ClickEffect_Toggle_1000', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_1000 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_10'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_1000]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('0'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.000000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_1000 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_1100 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc First Set the level to Middle, set the scale to 0.2 + * Second Set the level to Heavy, set the scale to 0.1 + */ + it('ArkUXII_Stage_ClickEffect_Toggle_1100', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Options_01000 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_11'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_1100]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('2'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.100000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_1100 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_1200 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc First Set the level to Middle + * Second Set the level to null + */ + it('ArkUXII_Stage_ClickEffect_Toggle_1200', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_1200 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_12'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_1200]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('0'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.900000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_1200 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_1300 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc First Set the level to null + * Second Set the level to Middle + */ + it('ArkUXII_Stage_ClickEffect_Toggle_1300', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_1300 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_13'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_1300]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('1'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.950000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_1300 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_1400 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc First Set the level to Heavy and set the scale to null + */ + it('ArkUXII_Stage_ClickEffect_Toggle_1400', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_1400 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_14'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_1400]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('2'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.950000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_1400 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_1500 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc First Set the level to Middle and set the scale to undefined + */ + it('ArkUXII_Stage_ClickEffect_Toggle_1500', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_1500 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_15'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_1500]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('1'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.950000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_1500 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + + /** + * @tc.number ArkUXII_Stage_ClickEffect_Toggle_1600 + * @tc.name Test the ClickEffect properties of the Toogle_Switch component + * @tc.desc First Set the level to undefined and set the scale to null + */ + it('ArkUXII_Stage_ClickEffect_Toggle_1600', 0, async function (done) { + console.info("ArkUXII_Stage_ClickEffect_Toggle_1600 start"); + setTimeout(() => { + try { + let strJson = getInspectorByKey('clickEffect_16'); + let obj = JSON.parse(strJson); + console.info("[ArkUXII_Stage_ClickEffect_Toggle_1600]:" + JSON.stringify(obj.$attrs.clickEffect)); + expect(obj.$attrs.clickEffect.level).assertEqual('0'); + expect(obj.$attrs.clickEffect.scale).assertEqual('0.900000'); + done(); + } catch (err) { + expect().assertFail(); + console.info('ArkUXII_Stage_ClickEffect_Toggle_1600 ERR ' + JSON.stringify(err)); + done(); + } + }, 500) + }); + }) +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/module.json b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/module.json new file mode 100644 index 000000000..5be6f421a --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "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_clickeffect/src/main/resources/base/element/color.json b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/element/color.json new file mode 100644 index 000000000..3c712962d --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/element/string.json b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/element/string.json new file mode 100644 index 000000000..c91ea0a91 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + }, + { + "name": "Divider_width", + "value": "10px" + }, + { + "name": "Divider_startMargin", + "value": "5px" + }, + { + "name": "Divider_endMargin", + "value": "5px" + }, + { + "name": "Check_Mark_Size_test", + "value": "50" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/media/icon.png b/arkui/ace_ets_components_ux/ace_ets_component_clickeffect/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c GIT binary patch literal 6790 zcmX|G1ymHk)?T_}Vd;>R?p|tHQo6fg38|$UVM!6BLrPFWk?s;$LOP{GmJpBl$qoSA!PUg~PA65-S00{{S`XKG6NkG0RgjEntPrmV+?0|00mu7;+5 zrdpa{2QLqPJ4Y{j7=Mrl{BaxrkdY69+c~(w{Fv-v&aR%aEI&JYSeRTLWm!zbv;?)_ ziZB;fwGbbeL5Q}YLx`J$lp~A09KK8t_z}PZ=4ZzgdeKtgoc+o5EvN9A1K1_<>M?MBqb#!ASf&# zEX?<)!RH(7>1P+j=jqG(58}TVN-$psA6K}atCuI!KTJD&FMmH-78ZejBm)0qc{ESp z|LuG1{QnBUJRg_E=h1#XMWt2%fcoN@l7eAS!Es?Q+;XsRNPhiiE=@AqlLkJzF`O18 zbsbSmKN=aaq8k3NFYZfDWpKmM!coBU0(XnL8R{4=i|wi{!uWYM2je{U{B*K2PVdu&=E zTq*-XsEsJ$u5H4g6DIm2Y!DN`>^v|AqlwuCD;w45K0@eqauiqWf7l&o)+YLHm~|L~ z7$0v5mkobriU!H<@mVJHLlmQqzQ3d6Rh_-|%Yy2li*tHO>_vcnuZ7OR_xkAIuIU&x z-|8Y0wj|6|a6_I(v91y%k_kNw6pnkNdxjqG8!%Vz_d%c_!X+6-;1`GC9_FpjoHev5fEV7RhJ>r=mh-jp$fqbqRJ=obwdgLDVP5+s zy1=_DWG0Y-Jb3t^WXmkr(d9~08k-|#Ly zaNOmT(^9tIb&eb4%CzIT zAm3CUtWSr1t4?h1kk#NBi{U|pJslvME{q|_eS^3En>SOqSxyuN1x;Is@8~m?*>}** znrRFArP!K_52RpX*&JHMR<^lVdm8ypJ}0R(SD(51j;6@ni$6bQ+2XL+R^|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m6<3<{%{yXiH# zos5Rv1L+8fUKJLo%P>4I&$}ypages res : onPageShow") + } + private valueChangeCallBack=(eventData)=> { + console.info("key==> page valueChangeCallBack"); + if (eventData != null) { + console.info("valueChangeCallBack:" + JSON.stringify(eventData)); + if(eventData.data.value=="true"){ + if( eventData.data.content=="no") { + this.valueNo = true; + } + if( eventData.data.content=="null") { + this.value = true + this.isStr = false + this.isNum = false + this.isNUll = true + } + if( eventData.data.content=="undefined") { + this.value = true + this.isStr = false + this.isNum = false + this.isNUll = false + } + if( eventData.data.content=="ResourceTest") { + this.Style = SliderStyle.InSet + this.resFalg = true + } + } + if(eventData.data.value=="false"){ + if( eventData.data.content=="no") { + this.valueNo = false; + } + if( eventData.data.content=="null") { + this.value = false + this.isStr = false + this.isNum = false + this.isNUll = true + } + if( eventData.data.content=="undefined") { + this.value = false + this.isStr = false + this.isNum = false + this.isNUll = false + } + if( eventData.data.content=="ResourceTest") { + this.Style = SliderStyle.OutSet + this.resFalg = false + } + } + if(eventData.data.value=="trueStr") { + this.Style = SliderStyle.InSet + this.isStr = true + this.value = true + this.content = eventData.data.content; + } + if(eventData.data.value=="falseStr") { + this.Style = SliderStyle.OutSet + this.value = false + this.isStr = true + this.content = eventData.data.content; + } + if(eventData.data.value=="trueNum") { + this.isStr = false + this.isNum = true + this.value = true + this.num = Number(eventData.data.content); + } + if(eventData.data.value=="falseNum") { + this.value = false + this.isStr = false + this.isNum = true + this.num = Number(eventData.data.content); + } + } + + } + aboutToAppear() { + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + + @State ValueOne: number = 40; + @State ValueTwo: number = 40; + @State ValueThi: number = 40; + @State ValueFour: number = 40; + @State value:boolean = false; + @State isStr:boolean = false; + @State isNum:boolean = false; + @State isNUll:boolean = false; + @State valueNo:boolean = false; + @State resFalg:boolean = false; + @State content:string = ""; + @State style:enum = SliderStyle.InSet; + @State direction:enum =Axis.Vertical; + + build() { + Row() { + Column() { + Slider({ + value: this.ValueOne, + min: 0, + max: 100, + style: this.Style + }) + .showTips(this.value,this.isStr?this.content:(this.isNum?this.num:(this.isNUll? null:undefined))) + .onChange((value: number, mode: SliderChangeMode) => { + this.ValueOne = value + console.info('value:' + value + 'mode:' + mode.toString()) + }) + .key('Slider') + Slider({ + value: this.ValueTwo, + min: 0, + max: 100, + style: this.Style + }) + .showTips(this.valueNo) + .onChange((value: number, mode: SliderChangeMode) => { + this.ValueTwo = value + console.info('value:' + value + 'mode:' + mode.toString()) + }) + .key('SliderNoContent') + Row(){ + Slider({ + value: this.ValueThi, + step: 10, + style: this.Style, + direction:Axis.Vertical + }) + .height(300) + .showSteps(true) + .showTips(this.resFalg,$r("app.string.sliderTest")) + .onChange((value: number, mode: SliderChangeMode) => { + this.ValueThi = value + console.info('value:' + value + 'mode:' + mode.toString()) + }) + .key('SliderResourceTest') + Slider({ + value: this.ValueFour, + step: 10, + style: this.Style, + direction:Axis.Vertical + }) + .height(300) + .showSteps(true) + .onChange((value: number, mode: SliderChangeMode) => { + this.ValueFour = value + console.info('value:' + value + 'mode:' + mode.toString()) + }) + .key('SliderNoShowTips') + } + } + .width('100%') + } + .height('100%') + } +} \ 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 index b348accf6..d57a728bf 100644 --- 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 @@ -13,7 +13,9 @@ * limitations under the License. */ import sliderTest from './SliderTest' +import SliderTestSec from './SliderTestSec' export default function testsuite() { sliderTest() + SliderTestSec() } \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/test/SliderTestSec.ets b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/test/SliderTestSec.ets new file mode 100644 index 000000000..5bbf91932 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_slider/src/main/ets/test/SliderTestSec.ets @@ -0,0 +1,668 @@ +/* + * 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import events_emitter from '@ohos.events.emitter'; +import router from '@system.router'; + +function sleep(time){ + return new Promise((resolve,reject)=>{ + setTimeout(()=>{ + resolve("ok") + },time) + }).then(()=>{ + console.info(`sleep ${time} over...`) + }) +} +async function forKey(Key,text) { + console.info("web afterEach start:"+Key); + try { + let backData = { + data: { + "value": Key, + "content": text, + } + } + let backEvent = { + eventId:10, + priority:events_emitter.EventPriority.LOW + } + console.info("start send emitKey"); + events_emitter.emit(backEvent, backData); + } catch (err) { + console.info("emit emitKey err: " + JSON.stringify(err)); + } + sleep(2000); +} +export default function SliderTestSec() { + describe('SliderTestSec', function () { + + beforeEach(async function (done) { + let options = { + uri: "TestAbility/pages/SliderTestSec", + } + try { + router.clear(); + let pages = router.getState(); + console.info("get SliderTestSec state success " + JSON.stringify(pages)); + if (!("SliderTestSec" == pages.name)) { + console.info("get SliderTestSec state success " + JSON.stringify(pages.name)); + let result = await router.push(options) + console.info("push SliderTestSec page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push SliderTestSec page error " + JSON.stringify(err)); + } + await sleep(2) + done() + }); + + /** + * @tc.number ArkUX_Stage_Slider_showTips_0100 + * @tc.name Set the Slider component showTips property with the parameter (value: true) + * @tc.desc Verify that the Slider component only sets the showTips attribute value parameter + * to a bubble type and no custom text + */ + it('ArkUX_Stage_Slider_showTips_0100',0, async function (done) { + await sleep(1000) + await forKey("true","no"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('SliderNoContent'); + console.info('ArkUX_Stage_Slider_showTips_0100 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_0100 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_0100 obj $attr :'+ JSON.stringify(obj.$attrs)); + console.info('ArkUX_Stage_Slider_showTips_0100 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_0100 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual(undefined) + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_0100 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_0200 + * @tc.name Set the Slider component showTips property with the parameter (value:false) + * @tc.desc Verify that the Slider component only sets the showTips attribute value parameter + * to a bubble free type and no custom text + */ + it('ArkUX_Stage_Slider_showTips_0200',0, async function (done) { + await sleep(1000) + await forKey("false","no"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('SliderNoContent'); + console.info('ArkUX_Stage_Slider_showTips_0200 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_0200 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_0200 obj $attr :'+ JSON.stringify(obj.$attrs)); + console.info('ArkUX_Stage_Slider_showTips_0200 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_0200 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("false") + expect(obj.$attrs.content).assertEqual(undefined) + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_0200 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_0300 + * @tc.name Set the Slider component showTips attribute with parameters (value: false, content: "test"). + * @tc.desc Verify that the Slider component sets the showTips attribute value parameter to a bubble free + * type, and also sets the custom text 'test'. The custom text setting is successful + */ + it('ArkUX_Stage_Slider_showTips_0300',0, async function (done) { + await forKey("falseStr","test"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_0300 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_0300 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_0300 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_0300 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("false") + expect(obj.$attrs.content).assertEqual("test") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_0300 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_0400 + * @tc.name Set the showTips property of Slider to (value:false, content:"ab$12@"). + * @tc.desc Verify that the Slider component has set the showTips attribute value parameter to a bubble free + * type, and set the custom text 'ab $12 @'. The custom text setting was successful + */ + it('ArkUX_Stage_Slider_showTips_0400',0, async function (done) { + await sleep(1000) + await forKey("falseStr","ab$12@"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_0400 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_0400 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_0400 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_0400 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("false") + expect(obj.$attrs.content).assertEqual("ab$12@") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_0400 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_0500 + * @tc.name Set the showTips property of the Slider component to (value:false, content:Resources). + * @tc.desc Verify that the Slider component has set the showTips attribute value parameter to a bubble free + * type, and set the resource reference type. The custom text has been successfully set + */ + it('ArkUX_Stage_Slider_showTips_0500',0, async function (done) { + await forKey("false","ResourceTest"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('SliderResourceTest'); + console.info('ArkUX_Stage_Slider_showTips_0500 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_0500 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_0500 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_0500 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("false") + expect(obj.$attrs.content).assertEqual("ResourceTest") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_0500 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_0600 + * @tc.name Set the showTips property of the Slider to (value:false, content:""). + * @tc.desc Verify that the Slider component showTips property parameter value is set to a bubble free type, + * while also setting the text to '' + */ + it('ArkUX_Stage_Slider_showTips_0600',0, async function (done) { + await sleep(1000) + await forKey("falseStr",""); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_0600 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_0600 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_0600 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_0600 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("false") + expect(obj.$attrs.content).assertEqual("") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_0600 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_0700 + * @tc.name Set the showTips property of the Slider to (value:true,content:"test"). + * @tc.desc Verify that the Slider component showTips property parameter value is set to true with bubble + * type, and the text is custom text + */ + it('ArkUX_Stage_Slider_showTips_0700',0, async function (done) { + await sleep(1000) + await forKey("trueStr","test"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_0700 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_0700 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_0700 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_0700 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual("test") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_0700 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_0800 + * @tc.name Set the showTips property of the Slider to (value:true,content:"ab$12@"). + * @tc.desc Verify that the Slider component showTips property parameter value is of bubble + * type, and the text is custom text with special symbols + */ + it('ArkUX_Stage_Slider_showTips_0800',0, async function (done) { + await sleep(1000) + await forKey("trueStr","ab$12@"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_0800 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_0800 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_0800 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_0800 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual("ab$12@") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_0800 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_0900 + * @tc.name Set the showTips property of the Slider component (value:true,content:resources) + * @tc.desc Verify that the Slider component showTips attribute parameter value is of bubble + * type and content is of reference type $r ("app. string. sliderTest") + */ + it('ArkUX_Stage_Slider_showTips_0900',0, async function (done) { + await forKey("true","ResourceTest"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('SliderResourceTest'); + console.info('ArkUX_Stage_Slider_showTips_0900 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_0900 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_0900 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_0900 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual("ResourceTest") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_0900 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_1000 + * @tc.name Set the showTips property of the Slider component (value:true,content:"") + * @tc.desc Verify that the Slider component showTips attribute parameter value is of + * bubble type, and the content is' ' + */ + it('ArkUX_Stage_Slider_showTips_1000',0, async function (done) { + await sleep(1000) + await forKey("trueStr",""); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_1000 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_1000 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_1000 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_1000 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual("") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_1300 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_1100 + * @tc.name Continuously set the Slider component showTips property, passing in normal values multiple times + * @tc.desc Verify that the Slider component showTips attribute has been passed in multiple times with normal + * values, and the content text is the last setting + */ + it('ArkUX_Stage_Slider_showTips_1100',0, async function (done) { + await sleep(1000) + await forKey("falseStr","no"); + await forKey("trueStr","test"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_1100 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_1100 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_1100 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_1100 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual("test") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_1100 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_1200 + * @tc.name Set the showTips property of the Slider to (value:false, content:null). + * @tc.desc Verify that the parameter value of the Slider component showTips attribute is of bubble free type, + * content is of outlier, and the result is no user-defined text + */ + it('ArkUX_Stage_Slider_showTips_1200',0, async function (done) { + await sleep(1000) + await forKey("false","null"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_1200 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_1200 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_1200 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_1200 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("false") + expect(obj.$attrs.content).assertEqual(undefined) + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_1200 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_1300 + * @tc.name Set the Slider component showTips attribute parameter for (value: false, content: undefined) + * @tc.desc Verify that the parameter value of the Slider component showTips attribute is of bubble free type, + * content is of outlier, and the result is no user-defined text + */ + it('ArkUX_Stage_Slider_showTips_1300',0, async function (done) { + await sleep(1000) + await forKey("false","undefined"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_1300 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_1300 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_1300 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_1300 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("false") + expect(obj.$attrs.content).assertEqual(undefined) + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_1300 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_1400 + * @tc.name Set the showTips property of the Slider to (value:false,content:1234). + * @tc.desc Verify that the parameter value of the Slider component showTips attribute is of bubble free type, + * content is of outlier, and the result is no user-defined text + */ + it('ArkUX_Stage_Slider_showTips_1400',0, async function (done) { + await sleep(1000) + await forKey("falseNum","123"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_1400 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_1400 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_1400 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_1400 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("false") + expect(obj.$attrs.content).assertEqual(undefined) + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_1400 err :' + JSON.stringify(err)) + done() + } + }) + + + + /** + * @tc.number ArkUX_Stage_Slider_showTips_1500 + * @tc.name Set the showTips property of the Slider component (value:true,content:null). + * @tc.desc Verify and set the Slider component showTips attribute parameter value as the type with bubbles, + * content as the outlier, and obtain the result as no user-defined text + */ + it('ArkUX_Stage_Slider_showTips_1500',0, async function (done) { + await sleep(1000) + await forKey("true","null"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_1500 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_1500 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_1500 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_1500 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual(undefined) + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_1400 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_1600 + * @tc.name Set the Slider component showTips attributes (value: true, content: undefined) + * @tc.desc Verify and set the Slider component showTips attribute parameter value as the type with bubbles, + * content as the outlier, and obtain the result as no user-defined text + */ + it('ArkUX_Stage_Slider_showTips_1600',0, async function (done) { + await sleep(1000) + await forKey("true","undefined"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_1600 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_1600 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_1600 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_1600 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual(undefined) + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_1600 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_1700 + * @tc.name Set the showTips property of the Slider component (value:true,content:1234) + * @tc.desc Verify and set the Slider component showTips attribute parameter value as the type with bubbles, + * content as the outlier, and obtain the result as no user-defined text + */ + it('ArkUX_Stage_Slider_showTips_1700',0, async function (done) { + await sleep(1000) + await forKey("trueNum","123"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_1700 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_1700 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_1700 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_1700 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual(undefined) + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_1700 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_1800 + * @tc.name Continuously set the Slider component showTips attribute, + * and set the content to an invalid value the last time + * @tc.desc Verify that the Slider component showTips property is set continuously, and the last time it is + * set to an invalid value, the result obtained is no custom text. + */ + it('ArkUX_Stage_Slider_showTips_1800',0, async function (done) { + await sleep(1000) + await forKey("trueStr","test"); + await sleep(1000) + await forKey("true","null"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_1800 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_1800 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_1800 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_1800 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual(undefined) + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_1800 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_1900 + * @tc.name Set the showTips attribute of the Slider component continuously, + * and pass in the outlier and then the normal value + * @tc.desc Verify that the Slider component showTips attribute is set continuously. After passing in the + outlier,the normal value is passed in. The result is the last set normal value + */ + it('ArkUX_Stage_Slider_showTips_1900',0, async function (done) { + await sleep(1000) + await forKey("true","null"); + await sleep(1000) + await forKey("trueStr","test"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_1900 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_1900 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_1900 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_1900 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual("test") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_1900 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_2000 + * @tc.name Do not set the Slider component showTips property + * @tc.desc Verify that the Slider component showTips property is not set and the + * result is no bubbles or text appearing + */ + it('ArkUX_Stage_Slider_showTips_2000',0, async function (done) { + try{ + let strJson = getInspectorByKey('SliderNoShowTips'); + console.info('ArkUX_Stage_Slider_showTips_2000 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_2000 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_2000 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_2000 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("false") + expect(obj.$attrs.content).assertEqual(undefined) + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_2100 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_2100 + * @tc.name Slider custom text display + * @tc.desc Set the parameter to an overly long string + */ + it('ArkUX_Stage_Slider_showTips_2100',0, async function (done) { + await forKey("trueStr","aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_2100 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_2100 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_2100 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_2100 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_2100 err :' + JSON.stringify(err)) + done() + } + }) + + /** + * @tc.number ArkUX_Stage_Slider_showTips_2200 + * @tc.name Slider custom text display + * @tc.desc Set the parameter to a string with line breaks + */ + it('ArkUX_Stage_Slider_showTips_2200',0, async function (done) { + await forKey("trueStr","aaa\nbbb"); + await sleep(1000) + try{ + let strJson = getInspectorByKey('Slider'); + console.info('ArkUX_Stage_Slider_showTips_2200 START :' + JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info('ArkUX_Stage_Slider_showTips_2200 obj :' + JSON.stringify(obj)); + console.info('ArkUX_Stage_Slider_showTips_2200 obj $attrs.showTips :'+ JSON.stringify(obj.$attrs.showTips)); + console.info('ArkUX_Stage_Slider_showTips_2200 obj $attrs.content :'+ JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.showTips).assertEqual("true") + expect(obj.$attrs.content).assertEqual("aaa\nbbb") + done() + } catch (err) { + expect().assertFail() + console.info('ArkUX_Stage_Slider_showTips_2200 err :' + JSON.stringify(err)) + done() + } + }) + + }) +} \ 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 index 2b03fde2a..41203db25 100644 --- 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 @@ -1,6 +1,6 @@ { "module": { - "name": "phone", + "name": "entry_test", "type": "feature", "description": "$string:module_test_desc", "mainElement": "TestAbility", 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 index 4ac461b47..aeec32c52 100644 --- 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 @@ -35,6 +35,10 @@ { "name":"block_size_height_test", "value":"50vp" + }, + { + "name": "sliderTest", + "value": "ResourceTest" } ] } \ No newline at end of file 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 index 77e90731b..238907d31 100644 --- 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 @@ -1,5 +1,6 @@ { "src": [ - "TestAbility/pages/Index" + "TestAbility/pages/Index", + "TestAbility/pages/SliderTestSec" ] } -- GitLab