提交 18aa39b8 编写于 作者: L lanyill

差值曲线XTS用例

Signed-off-by: Nlanyill <lanyi3@huawei.com>
Change-Id: Id5a3694a74bb1c14c80cc636f8973b6dfb57fe7d
上级 203f0dd9
......@@ -25,5 +25,6 @@ group("arkui") {
"ace_napi_test:ActsAceNapiEtsTest",
"ace_standard:ace_standard_test",
"ace_standard_video:ace_standard_video_test",
"ace_ets_curves:AceEtsCurveTest",
]
}
# 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("AceEtsCurveTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":ace_ets_component_assets",
":ace_ets_component_resources",
":ace_ets_component_test_assets",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "AceEtsCurveTest"
}
ohos_js_assets("ace_ets_component_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_js_assets("ace_ets_component_test_assets") {
source_dir = "./entry/src/main/ets/TestAbility"
}
ohos_resources("ace_ets_component_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for curve Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "1200000",
"bundle-name": "com.open.harmony.acetestcurve",
"package-name": "com.open.harmony.acetestcurve",
"shell-timeout": "1200000"
},
"kits": [
{
"test-file-name": [
"AceEtsCurveTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.open.harmony.acetestcurve",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 8
}
},
"deviceConfig": {},
"module": {
"package": "com.open.harmony.acetestcurve",
"name": ".MyApplication",
"mainAbility": "com.open.harmony.acetestcurve.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 file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../../test/List.test"
import Curves from '@ohos.curves'
import featureAbility from "@ohos.ability.featureAbility"
@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("LANYI curve start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
const reportExtend = new ReportExtend(file)
core.addService('report', reportExtend)
core.init()
core.subscribeEvent('task', reportExtend)
const configService = core.getDefaultService('config')
const timeout = 10000
configService.setConfig(timeout)
console.info('LANYI parameters---->' + JSON.stringify(Want.parameters))
configService.setConfig(Want.parameters)
testsuite()
core.execute()
console.info('Operation successful. Data: ' + JSON.stringify(Want));
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
var stateChangeEvent = {
eventId: 8,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
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("LANYI"+this.heightSize);
console.info("LANYI"+globalThis.heightSize);
}).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("LANYI"+this.heightSize1);
console.info("LANYI"+globalThis.heightSize1);
}).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("LANYI"+this.heightSize2);
console.info("LANYI"+globalThis.heightSize2);
}).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("LANYI"+this.heightSize3);
console.info("LANYI"+globalThis.heightSize3);
}).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.
*/
import router from '@ohos.router';
globalThis.flag =true
@Entry
@Component
struct Index {
onPageShow() {
let options = {
url: 'pages/curve',
}
try {
console.info("lanyi Index flag: " + globalThis.flag);
if(globalThis.flag) {
router.push(options)
}
} catch (err) {
}
}
build() {
Row() {
Column() {
Text("Curve test index")
.fontSize(30)
.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.
*/
const TYPE = '$type'
const ID = '$ID'
const Z_INDEX = '$z-index'
const RECT = '$rect'
const DEBUGLINE = '$debugLine'
const ATTRS = '$attrs'
const ATTRS_SEPIA = 'sepia'
const ATTRS_ASPECTRATIO = 'aspectRatio'
const ATTRS_CONTRAST = 'contrast'
const ATTRS_SATURATE = 'saturate'
const ATTRS_HUEROTATE = 'hueRotate'
const ATTRS_INVERT = 'invert'
const ATTRS_BRIGHTNESS = 'brightness'
const ATTRS_BACKDROPBLUR = 'backdropBlur'
const ATTRS_GRAYSCALE = 'grayscale'
const ATTRS_BLUR = 'blur'
const ATTRS_GRIDOFFSET = 'gridOffset'
const ATTRS_FLEXSHRINK = 'flexShrink'
const ATTRS_FLEXGROW = 'flexGrow'
const ATTRS_OPACITY = 'opacity'
const ATTRS_DIRECTION = 'direction'
const ATTRS_ALIGN = 'align'
const ATTRS_HEIGHT = 'height'
const ATTRS_BACKGROUNDCOLOR = 'backgroundColor'
const ATTRS_ALIGNSELF = 'alignSelf'
const ATTRS_BORDERWIDTH = 'borderWidth'
const ATTRS_WIDTH = 'width'
const ATTRS_BORDERCOLOR = 'borderColor'
const ATTRS_MARGIN_BOTTOM = 'margin-bottom'
const ATTRS_BORDERSTYLE = 'borderStyle'
const ATTRS_MARGIN_RIGHT = 'margin-right'
const ATTRS_CONSTRAINTSIZE = 'constraintSize'
const ATTRS_NARGIN_LEFT = 'margin-left'
const ATTRS_BACKGROUNDIMAGE = 'backgroundImage'
const ATTRS_MARGIN_TOP = 'margin-top'
const ATTRS_BORDERRADIUS = 'borderRadius'
const ATTRS_FLEXBASIC = 'flexBasis'
const ATTRS_VISIBILITY = 'visibility'
const ATTRS_PASSWORD = 'password'
const ATTRS_CHECKED = 'checked'
const ATTRS_SELECTED = 'selected'
const ATTRS_LONG_CLICKABLE = 'long-clickable'
const ATTRS_FOCUSED = 'focused'
const ATTRS_SCROLLABLE = 'scrollable'
const ATTRS_CLICKABLE = 'clickable'
const ATTRS_FOCUSABLE = 'focusable'
const ATTRS_CHECKABLE = 'checkable'
const ATTRS_CLIP = 'clip'
const ATTRS_ENABLE = 'enabled'
const ATTRS_DISPLAYPRIORITY = 'displayPriority'
const ATTRS_LAYOUTWEIGHT = 'layoutWeight'
const ATTRS_LAYOUTPRIORITY = 'layoutPriority'
const ATTRS_GRIDSPAN = 'gridSpan'
const ATTRS_ZINDEX = 'zIndex'
const ATTRS_USEALIGN = 'useAlign'
const ATTRS_USEALIGN_EDGE = 'edge'
const ATTRS_USEALIGN_OFFSET = 'offset'
const ATTRS_MASK = 'mask'
const ATTRS_MARKANCHOR = 'markAnchor'
const ATTRS_MARKANCHOR_X = 'x'
const ATTRS_MARKANCHOR_Y = 'y'
const ATTRS_PADDING = 'padding'
const ATTRS_POSITION = 'position'
const ATTRS_POSITION_X = 'x'
const ATTRS_POSITION_Y = 'y'
const ATTRS_BACKGROUNDIMAGEPOSITION = 'backgroundImagePosition'
const ATTRS_BACKGROUNDIMAGEPOSITION_X = 'x'
const ATTRS_BACKGROUNDIMAGEPOSITION_Y = 'y'
const ATTRS_BACKGROUNDIMAGESIZE = 'backgroundImageSize'
const ATTRS_OFFSET = 'offset'
const ATTRS_OFFSET_X = 'x'
const ATTRS_OFFSET_Y = 'y'
const ATTRS_SHADOW = 'shadow'
const ATTRS_SHADOW_RADIUS = 'radius'
const ATTRS_SHADOW_COLOR = 'color'
const ATTRS_SHADOW_OFFSETX = 'offsetX'
const ATTRS_SHADOW_OFFSETY = 'offsetY'
const ATTRS_WINDOWBLUR = 'windowBlur'
const ATTRS_WINDOWBLUR_PERCENT = 'percent'
const ATTRS_WINDOWBLUR_STYLE = 'style'
const ATTRS_FONTFAMILY = 'fontFamily'
const ATTRS_FONTWEIGHT = 'fontWeight'
const ATTRS_FONTSTYLE = 'fontStyle'
const ATTRS_FONTSIZE = 'fontSize'
const ATTRS_TEXTCASE = 'textCase'
const ATTRS_MAXLINES = 'maxLines'
const ATTRS_DECORATION = 'decoration'
const ATTRS_BASELINEOFFSET = 'baselineOffset'
const ATTRS_TEXTOVERFLOW = 'textOverflow'
const ATTRS_LINEHEIGHT = 'lineHeight'
const ATTRS_FONTCOLOR = 'fontColor'
const ATTRS_TEXTALIGN = 'textAlign'
const ATTRS_CONTENT = 'content'
// @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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
////import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index";
//import events_emitter from '@ohos.events.emitter';
//
//
//export default function CurveJsunit() {
// describe('CurveTest', function () {
//// beforeEach(async function (done) {
//// console.info("curve beforeEach start");
//// let options = {
//// uri: 'pages/curve',
//// }
//// try {
//// router.clear();
//// let pages = router.getState();
//// console.info("get curve state pages:" + JSON.stringify(pages));
//// if (!("curve" == pages.name)) {
//// console.info("get curve state pages.name:" + JSON.stringify(pages.name));
//// let result = await router.push(options);
//// await Utils.sleep(2000);
//// console.info("push curve page result:" + 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");
//// });
//
// it('testcurve01', 0, async function (done) {
// console.info('LANYI [testcurve01] START');
// try {
// var eventData = {
// data: {
// heightSize:88.88888955116272,
// widthSize: 88.88888955116272,
// }
// }
// var innerEvent = {
// eventId: 8,
// priority: events_emitter.EventPriority.LOW
// }
// console.info("LANYI [testcurve01] start to publish emit");
// events_emitter.emit(innerEvent, eventData);
// } catch (err) {
// console.log("LANYI [testcurve01] change component data error: " + err.message);
// }
// await Utils.sleep(1000);
//// // let strJson = getInspectorByKey('curve');
//// let obj = JSON.parse(strJson);
// console.info("LANYI [testcurve01] sendEventByKey result is: " + JSON.stringify(sendEventByKey('curve', 10, "")));
// expect(globalThis.widthSize).assertEqual(88.88888955116272);
// expect(globalThis.heightSize).assertEqual(88.88888955116272);
// console.info('LANYI testcurve01 END');
// done();
// });
//
// })
//}
import router from '@ohos.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
//export default function CurveJsunit() {
// describe('CurveTest', function () {
// async function sleep(time) {
// return new Promise((resolve, reject) => {
// setTimeout(() => {
// resolve()
// console.info('curve ***** setTime ');
//
// }, time)
// }).then(() => {
// console.info( `sleep ${time} over...`)
// console.info('curve ***** then ');
// })
// }
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");
});
it('testcurve01', 0, async function (done) {
console.info('curve testcurve01 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 ((result_height == 44.44444477558136) && (result_width == 44.44444477558136)){
finalRes = true;
console.info('curve SurfaceChangedTest success');
} else {
finalRes = false;
console.error('curve SurfaceChangedTest fail');
}
expect(finalRes).assertEqual(true);
done();
}, 3000)
});
it('testcurve02', 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 ((result_height == 78.03846001625061) && (result_width == 78.03846001625061)){
finalRes = true;
console.info('curve1 SurfaceChangedTest success');
} else {
finalRes = false;
console.error('curve1 SurfaceChangedTest fail');
}
expect(finalRes).assertEqual(true);
done();
}, 3000)
});
it('testcurve03', 0, async function (done) {
console.info('curve testcurve03 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 ((result_height == 50) && (result_width == 50)){
finalRes = true;
console.info('curve2 SurfaceChangedTest success');
} else {
finalRes = false;
console.error('curve2 SurfaceChangedTest fail');
}
expect(finalRes).assertEqual(true);
done();
}, 3000)
});
it('testcurve04', 0, async function (done) {
console.info('curve testcurve04 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 ((result_height == 98.68008494377136) && (result_width == 98.68008494377136)){
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
{
"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.
先完成此消息的编辑!
想要评论请 注册