diff --git a/arkui/BUILD.gn b/arkui/BUILD.gn index de3a4694af2d85d30844164ac8120cee370848bc..27557904c78612021762db71a2925a1fcc46ba25 100644 --- a/arkui/BUILD.gn +++ b/arkui/BUILD.gn @@ -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", + ] } diff --git a/arkui/ace_ets_curves/BUILD.gn b/arkui/ace_ets_curves/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ec0a7c4d3ee487520b17c87ffe209ff2c3083752 --- /dev/null +++ b/arkui/ace_ets_curves/BUILD.gn @@ -0,0 +1,36 @@ +# 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" +} diff --git a/arkui/ace_ets_curves/Test.json b/arkui/ace_ets_curves/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..6b80a9a8476310e4b070d148de3ad5a9785bed18 --- /dev/null +++ b/arkui/ace_ets_curves/Test.json @@ -0,0 +1,19 @@ +{ + "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 + } + ] +} diff --git a/arkui/ace_ets_curves/entry/src/main/config.json b/arkui/ace_ets_curves/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b4a50e69c339f3b4a4ffd4d2d0b3f3f86a85fa5f --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/config.json @@ -0,0 +1,99 @@ +{ + "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 + } + } + ] + } +} diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/app.ets b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..b917b80ff7cabb5078dd7a9d9bf546c510bd86d7 --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,33 @@ +// @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 diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/bg.jpg b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/bg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3feafcf51739b0a00a5a4f392472fc32c3b8e142 Binary files /dev/null and b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/bg.jpg differ diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/clip.png b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/clip.png new file mode 100644 index 0000000000000000000000000000000000000000..78488bb00baa01614c87a503998fa4129ab110ac Binary files /dev/null and b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/clip.png differ diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/dialog.png b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/dialog.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/dialog.png differ diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/download.png b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/download.png new file mode 100644 index 0000000000000000000000000000000000000000..027a626e541e2fb11cf8202a450e147cadfed7b9 Binary files /dev/null and b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/download.png differ diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/ic_health_heart.png b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/ic_health_heart.png new file mode 100644 index 0000000000000000000000000000000000000000..dffc412fb3de5c689e30d085f5f8e5cea60d46e3 Binary files /dev/null and b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/ic_health_heart.png differ diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/img.jpeg b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/img.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..eed67bb7f31a966655d4b14551530518632c9f25 Binary files /dev/null and b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/img.jpeg differ diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/img.png b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/img.png new file mode 100644 index 0000000000000000000000000000000000000000..040c1fcf9dbc3762842e18163347dbc0610331df Binary files /dev/null and b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/images/img.png differ diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/pages/curve.ets b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/pages/curve.ets new file mode 100644 index 0000000000000000000000000000000000000000..f78d77cf90b452f86c0f0f383c31d60b18b9e073 --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/pages/curve.ets @@ -0,0 +1,143 @@ +// @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%") + } +} + diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/pages/index.ets b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed0faa6b46fbf470f1c36de2771c97fd99d264d2 --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,55 @@ +// @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 diff --git a/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/utils/Constants.ets b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/utils/Constants.ets new file mode 100644 index 0000000000000000000000000000000000000000..13a6c0d16e7277756efb5136ce8b02ac6b601d50 --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/ets/MainAbility/utils/Constants.ets @@ -0,0 +1,112 @@ +// @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' + + + + diff --git a/arkui/ace_ets_curves/entry/src/main/ets/TestAbility/app.ets b/arkui/ace_ets_curves/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..b917b80ff7cabb5078dd7a9d9bf546c510bd86d7 --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,33 @@ +// @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 diff --git a/arkui/ace_ets_curves/entry/src/main/ets/TestAbility/pages/index.ets b/arkui/ace_ets_curves/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f87ca6e18f4a4dd9c1804b8edabe664029341e78 --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,50 @@ +// @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 diff --git a/arkui/ace_ets_curves/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_curves/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..dfbf1f268a45e4a2f30b8c836f42d76f3a9f5ad3 --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +// @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 diff --git a/arkui/ace_ets_curves/entry/src/main/ets/test/CurveJsunit.test.ets b/arkui/ace_ets_curves/entry/src/main/ets/test/CurveJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..12b23df084c5bab381b74d304d67f1fae7c6109b --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/ets/test/CurveJsunit.test.ets @@ -0,0 +1,258 @@ +// @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) + }); + }) +} diff --git a/arkui/ace_ets_curves/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_curves/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5ca866c9e2dab8101a70d4d0b272cbff3e54d58d --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 diff --git a/arkui/ace_ets_curves/entry/src/main/resources/base/element/color.json b/arkui/ace_ets_curves/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..07a14d2b8dcf50dae012854d8310c489dfd7391c --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "color_hello", + "value": "#ffff0000" + }, + { + "name": "color_world", + "value": "#ff0000ff" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_curves/entry/src/main/resources/base/element/float.json b/arkui/ace_ets_curves/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..26a0491a2b293d8296d4de4d55c8d682527b6c6b --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float":[ + { + "name":"font_hello", + "value":"28.0fp" + }, + { + "name":"font_world", + "value":"20.0fp" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_curves/entry/src/main/resources/base/element/string.json b/arkui/ace_ets_curves/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f6488bb9ccc6588f4a68440a5a320c1d2d952a99 --- /dev/null +++ b/arkui/ace_ets_curves/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "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 diff --git a/arkui/ace_ets_curves/entry/src/main/resources/base/media/icon.png b/arkui/ace_ets_curves/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_curves/entry/src/main/resources/base/media/icon.png differ diff --git a/arkui/ace_ets_curves/entry/src/main/resources/rawfile/ic_health_heart.png b/arkui/ace_ets_curves/entry/src/main/resources/rawfile/ic_health_heart.png new file mode 100644 index 0000000000000000000000000000000000000000..dffc412fb3de5c689e30d085f5f8e5cea60d46e3 Binary files /dev/null and b/arkui/ace_ets_curves/entry/src/main/resources/rawfile/ic_health_heart.png differ diff --git a/arkui/ace_ets_curves/entry/src/main/resources/rawfile/test.png b/arkui/ace_ets_curves/entry/src/main/resources/rawfile/test.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_curves/entry/src/main/resources/rawfile/test.png differ diff --git a/arkui/ace_ets_curves/signature/openharmony_sx.p7b b/arkui/ace_ets_curves/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/arkui/ace_ets_curves/signature/openharmony_sx.p7b differ