未验证 提交 ed411cdc 编写于 作者: O openharmony_ci 提交者: Gitee

!8919 UX二期Slider及点击回弹相关XTS

Merge pull request !8919 from sunjiakun/UXII8.1
......@@ -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",
......
{
"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
{
"string":[
{
"name":"app_name",
"value":"MyApplication"
}
]
}
\ No newline at end of file
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAceClickEffectTest") {
hap_profile = "src/main/module.json"
js_build_mode = "debug"
deps = [
":ace_ets_component_clickeffect_js_assets",
":ace_ets_component_clickeffect_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAceClickEffectTest"
part_name = "ace_engine"
subsystem_name = "arkui"
}
ohos_app_scope("ace_ets_component_clickeffect_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("ace_ets_component_clickeffect_js_assets") {
source_dir = "src/main/ets"
}
ohos_resources("ace_ets_component_clickeffect_resources") {
sources = [ "src/main/resources" ]
deps = [ ":ace_ets_component_clickeffect_profile" ]
hap_profile = "src/main/module.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.clickeffecttest",
"module-name": "entry_test",
"shell-timeout": "600000",
"testcase-timeout": 240000
},
"kits": [
{
"test-file-name": [
"ActsAceClickEffectTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
},
{
"type": "ShellKit",
"run-command": [
"power-shell wakeup",
"power-shell setmode 602"
]
}
]
}
\ No newline at end of file
/*
* 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
/*
* 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%')
}
}
/*
* 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<void> {
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');
}
}
/*
* 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
/*
* 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)
});
})
}
{
"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"
]
}
]
}
]
}
}
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}
\ No newline at end of file
{
"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
......@@ -4,7 +4,7 @@
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.example.slidertest",
"module-name": "phone",
"module-name": "entry_test",
"shell-timeout": "600000",
"testcase-timeout": 240000
},
......
/*
* 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 { Hypium } from '@ohos/hypium';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import testsuite from '../../test/List.test';
import events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct Index {
onPageShow(){
let valueChangeEvent={
eventId:10,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(valueChangeEvent,this.valueChangeCallBack)
console.info("key==>pages 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
......@@ -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
{
"module": {
"name": "phone",
"name": "entry_test",
"type": "feature",
"description": "$string:module_test_desc",
"mainElement": "TestAbility",
......
......@@ -35,6 +35,10 @@
{
"name":"block_size_height_test",
"value":"50vp"
},
{
"name": "sliderTest",
"value": "ResourceTest"
}
]
}
\ No newline at end of file
{
"src": [
"TestAbility/pages/Index"
"TestAbility/pages/Index",
"TestAbility/pages/SliderTestSec"
]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册