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

!4093 插值曲线XTS测试用例

Merge pull request !4093 from lanyi/locallanyi
...@@ -19,6 +19,7 @@ group("arkui") { ...@@ -19,6 +19,7 @@ group("arkui") {
"ace_ets_component_four:AceEtsComponentFourTest", "ace_ets_component_four:AceEtsComponentFourTest",
"ace_ets_component_three:AceEtsComponentThreeTest", "ace_ets_component_three:AceEtsComponentThreeTest",
"ace_ets_component_two:AceEtsComponentTwoTest", "ace_ets_component_two:AceEtsComponentTwoTest",
"ace_ets_dev:ActsAceDevTest",
"ace_ets_standard:ActsAceEtsStTest", "ace_ets_standard:ActsAceEtsStTest",
"ace_ets_test:ActsAceEtsTest", "ace_ets_test:ActsAceEtsTest",
"ace_ets_third_test:ActsAceEtsThirdTest", "ace_ets_third_test:ActsAceEtsThirdTest",
......
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAceDevTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":ace_ets_dev_assets",
":ace_ets_dev_resources",
":ace_ets_dev_test_assets",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAceDevTest"
}
ohos_js_assets("ace_ets_dev_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("ace_ets_dev_test_assets") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("ace_ets_dev_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for dev Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "600000",
"bundle-name": "com.open.harmony.acedevtest",
"package-name": "com.open.harmony.acedevtest",
"shell-timeout": "600000"
},
"kits": [
{
"test-file-name": [
"ActsAceDevTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.open.harmony.acedevtest",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"package": "com.open.harmony.acedevtest",
"name": ".MyApplication",
"mainAbility": "com.open.harmony.acedevtest.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
},
{
"orientation": "unspecified",
"visible": true,
"srcPath": "TestAbility",
"name": ".TestAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"formsEnabled": false,
"label": "$string:TestAbility_label",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/curve"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import Curves from '@ohos.curves'
@Entry
@Component
struct CurveExample {
@State widthSize: number = 100
@State heightSize: number = 100
@State widthSize1: number = 100
@State heightSize1: number = 100
@State widthSize2: number = 100
@State heightSize2: number = 100
@State widthSize3: number = 100
@State heightSize3: number = 100
onPageShow() {
console.info("curve start page run !!!!")
}
build() {
Column() {
Text()
.key('curve')
.margin({ top: 100 })
.width(this.widthSize)
.height(this.heightSize)
.backgroundColor(Color.Red)
.onClick(() => {
let curve = Curves.stepsCurve(9, true);
this.widthSize = curve.interpolate(0.5) * this.widthSize;
globalThis.widthSize = this.widthSize;
this.heightSize = curve.interpolate(0.5) * this.heightSize;
globalThis.heightSize = this.heightSize;
console.info("Curves heightSize" + this.heightSize);
console.info("Curves widthSize" + this.widthSize);
})
.animation({
duration: 2000,
curve: Curve.EaseIn,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Text()
.key('curve1')
.margin({ top: 100 })
.width(this.widthSize1)
.height(this.heightSize1)
.backgroundColor(Color.Red)
.onClick(() => {
let curve = Curves.springCurve(10, 1, 28, 3);
this.widthSize1 = curve.interpolate(0.5) * this.widthSize1;
globalThis.widthSize1 = this.widthSize1;
this.heightSize1 = curve.interpolate(0.5) * this.heightSize1;
globalThis.heightSize1 = this.heightSize1;
console.info("Curves heightSize1" + this.heightSize1);
console.info("Curves widthSize1" + this.widthSize1);
})
.animation({
duration: 2000,
curve: Curve.EaseIn,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Text()
.key('curve2')
.margin({ top: 100 })
.width(this.widthSize2)
.height(this.heightSize2)
.backgroundColor(Color.Red)
.onClick(() => {
let curve = Curves.initCurve();
this.widthSize2 = curve.interpolate(0.5) * this.widthSize2;
globalThis.widthSize2 = this.widthSize2;
this.heightSize2 = curve.interpolate(0.5) * this.heightSize2;
globalThis.heightSize2 = this.heightSize2;
console.info("Curves heightSize2" + this.heightSize2);
console.info("Curves widthSize2" + this.widthSize2);
})
.animation({
duration: 2000,
curve: Curve.EaseIn,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
Text()
.key('curve3')
.margin({ top: 100 })
.width(this.widthSize3)
.height(this.heightSize3)
.backgroundColor(Color.Red)
.onClick(() => {
let curve = Curves.cubicBezierCurve(0.1, 1, 0.1, 1);
this.widthSize3 = curve.interpolate(0.5) * this.widthSize3;
globalThis.widthSize3 = this.widthSize3;
this.heightSize3 = curve.interpolate(0.5) * this.heightSize3;
globalThis.heightSize3 = this.heightSize3;
console.info("Curves heightSize3" + this.heightSize3);
console.info("Curves widthSize23" + this.widthSize3);
})
.animation({
duration: 2000,
curve: Curve.EaseIn,
delay: 500,
iterations: 1,
playMode: PlayMode.Normal
})
}.width("100%").height("100%")
}
}
// @ts-nocheck
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct MyComponent {
aboutToAppear() {
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ACE CURVES ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('Application onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('TestAbility index aboutToAppear')
}
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button() {
Text('next page')
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
.onClick(()=>{
})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 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 itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log('onAbilityCreateCallback');
}
async function addAbilityMonitorCallback(err: any) {
console.info('addAbilityMonitorCallback : ' + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
}
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext')
var context = abilityDelegator.getAppContext()
console.info('getAppContext : ' + JSON.stringify(context))
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import Utils from './Utils.ets'
export default function CurveJsunit() {
describe('CurveTest', function () {
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'pages/curve',
}
try {
router.clear();
let pages = router.getState();
console.info("get curve state success " + JSON.stringify(pages));
if (!("curve" == pages.name)) {
console.info("get curve state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push curve page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push curve page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("curve after each called");
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0010
* @tc.name testCurve001
* @tc.desic aceCurveEtsTest
*/
it('testCurve001', 0, async function (done) {
console.info('curve testCurve001 START');
var result_height;
var result_width;
var control;
control = JSON.stringify(sendEventByKey('curve', 10, ""));
console.info("curve sendEventByKey result is: " + control);
setTimeout(() => {
if (control) {
result_height = globalThis.widthSize;
console.info('curve ***** globalThis widthSize is ' + globalThis.widthSize);
result_width = globalThis.heightSize;
console.info('curve ***** globalThis heightSize is ' + globalThis.heightSize);
} else {
console.error('control failed');
}
console.info('curve ***** result_height is ' + result_height);
console.info('curve ***** result_width is ' + result_width);
var finalRes;
if ((Math.round(result_height) == 44) && (Math.round(result_width) == 44)) {
finalRes = true;
console.info('curve SurfaceChangedTest success');
} else {
finalRes = false;
console.error('curve SurfaceChangedTest fail');
}
expect(finalRes).assertEqual(true);
done();
}, 3000)
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0020
* @tc.name testCurve002
* @tc.desic aceCurveEtsTest
*/
it('testCurve002', 0, async function (done) {
console.info('curve testCurve02 START');
var result_height;
var result_width;
var control;
control = JSON.stringify(sendEventByKey('curve1', 10, ""));
console.info("curve1 sendEventByKey result is: " + control);
setTimeout(() => {
if (control) {
result_height = globalThis.widthSize1;
console.info('curve1 ***** globalThis widthSize1 is ' + globalThis.widthSize1);
result_width = globalThis.heightSize1;
console.info('curve1 ***** globalThis heightSize1 is ' + globalThis.heightSize1);
} else {
console.error('control failed');
}
console.info('curve1 ***** result_height1 is ' + result_height);
console.info('curve1 ***** result_width1 is ' + result_width);
var finalRes;
if ((Math.round(result_height) == 78) && (Math.round(result_width) == 78)) {
finalRes = true;
console.info('curve1 SurfaceChangedTest success');
} else {
finalRes = false;
console.error('curve1 SurfaceChangedTest fail');
}
expect(finalRes).assertEqual(true);
done();
}, 3000)
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0030
* @tc.name testCurve003
* @tc.desic aceCurveEtsTest
*/
it('testCurve003', 0, async function (done) {
console.info('curve testCurve003 START');
var result_height;
var result_width;
var control;
control = JSON.stringify(sendEventByKey('curve2', 10, ""));
console.info("curve2 sendEventByKey result is: " + control);
setTimeout(() => {
if (control) {
result_height = globalThis.widthSize2;
console.info('curve2 ***** globalThis widthSize2 is ' + globalThis.widthSize2);
result_width = globalThis.heightSize2;
console.info('curve2 ***** globalThis heightSize2 is ' + globalThis.heightSize2);
} else {
console.error('control failed');
}
console.info('curve2 ***** result_height2 is ' + result_height);
console.info('curve2 ***** result_width2 is ' + result_width);
var finalRes;
if ((Math.round(result_height) == 50) && (Math.round(result_width) == 50)) {
finalRes = true;
console.info('curve2 SurfaceChangedTest success');
} else {
finalRes = false;
console.error('curve2 SurfaceChangedTest fail');
}
expect(finalRes).assertEqual(true);
done();
}, 3000)
});
/*
* @tc.number SUB_ACE_BASIC_ETS_API_0040
* @tc.name testCurve004
* @tc.desic aceCurveEtsTest
*/
it('testCurve004', 0, async function (done) {
console.info('curve testCurve004 START');
var result_height;
var result_width;
var control;
control = JSON.stringify(sendEventByKey('curve3', 10, ""));
console.info("curve3 sendEventByKey result is: " + control);
setTimeout(() => {
if (control) {
result_height = globalThis.widthSize3;
console.info('curve3 ***** globalThis widthSize3 is ' + globalThis.widthSize3);
result_width = globalThis.heightSize3;
console.info('curve3 ***** globalThis heightSize3 is ' + globalThis.heightSize3);
} else {
console.error('control failed');
}
console.info('curve3 ***** result_height3 is ' + result_height);
console.info('curve3 ***** result_width3 is ' + result_width);
var finalRes;
if ((Math.round(result_height) == 99) && (Math.round(result_width) == 99)) {
finalRes = true;
console.info('curve3 SurfaceChangedTest success');
} else {
finalRes = false;
console.error('curve3 SurfaceChangedTest fail');
}
expect(finalRes).assertEqual(true);
done();
}, 3000)
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import CurveTest from './CurveJsunit.test';
export default function testsuite() {
CurveTest()
}
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
static getComponentRect(key) {
let strJson = getInspectorByKey(key);
let obj = JSON.parse(strJson);
console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
let rectInfo = JSON.parse('[' + obj.$rect + ']')
console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
return this.rect_value = {
"left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
}
}
static async swipe(downX, downY, upX, upY, steps) {
console.info('start to swipe')
this.drags(downX, downY, upX, upY, steps, false)
}
static async drag(downX, downY, upX, upY, steps) {
console.info('start to drag')
this.drags(downX, downY, upX, upY, steps, true)
}
static async drags(downX, downY, upX, upY, steps, drag) {
var xStep;
var yStep;
var swipeSteps;
var ret;
xStep = 0;
yStep = 0;
ret = false;
swipeSteps = steps;
if (swipeSteps == 0) {
swipeSteps = 1;
}
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
var downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
type: TouchType.Down,
}
console.info('down touch started: ' + JSON.stringify(downPonit))
sendTouchEvent(downPonit);
console.info('start to move')
if (drag) {
await this.sleep(500)
}
for (var i = 1;i <= swipeSteps; i++) {
var movePoint: TouchObject = {
id: 1,
x: downX + (xStep * i),
y: downY + (yStep * i),
type: TouchType.Move
}
console.info('move touch started: ' + JSON.stringify(movePoint))
ret = sendTouchEvent(movePoint)
if (ret == false) {
break;
}
await this.sleep(5)
}
console.info('start to up')
if (drag) {
await this.sleep(100)
}
var upPoint: TouchObject = {
id: 1,
x: upX,
y: upY,
type: TouchType.Up,
}
console.info('up touch started: ' + JSON.stringify(upPoint))
sendTouchEvent(upPoint)
await this.sleep(500)
}
}
{
"color": [
{
"name": "color_hello",
"value": "#ffff0000"
},
{
"name": "color_world",
"value": "#ff0000ff"
}
]
}
\ No newline at end of file
{
"float":[
{
"name":"font_hello",
"value":"28.0fp"
},
{
"name":"font_world",
"value":"20.0fp"
}
]
}
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
},
{
"name":"string_hello",
"value":"Hello"
},
{
"name":"string_world",
"value":"World"
},
{
"name":"message_arrive",
"value":"We will arrive at %s."
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册