Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
bdd5ff9b
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
bdd5ff9b
编写于
2月 26, 2022
作者:
O
openharmony_ci
提交者:
Gitee
2月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2053 add ace component
Merge pull request !2053 from tomatoDevboy/master
上级
ce459836
ee562c51
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
3312 addition
and
92 deletion
+3312
-92
ace/ace_ets_component/entry/src/main/config.json
ace/ace_ets_component/entry/src/main/config.json
+17
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/QrCode.ets
...component/entry/src/main/ets/MainAbility/pages/QrCode.ets
+100
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/animate.ets
...omponent/entry/src/main/ets/MainAbility/pages/animate.ets
+183
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/badge.ets
..._component/entry/src/main/ets/MainAbility/pages/badge.ets
+58
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/button.ets
...component/entry/src/main/ets/MainAbility/pages/button.ets
+61
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets
...component/entry/src/main/ets/MainAbility/pages/canvas.ets
+345
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/PanGesture.ets
...n/ets/MainAbility/pages/general-properties/PanGesture.ets
+101
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/ResponseRegion.ets
...s/MainAbility/pages/general-properties/ResponseRegion.ets
+39
-24
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/textStyle.ets
...in/ets/MainAbility/pages/general-properties/textStyle.ets
+0
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/index.ets
..._component/entry/src/main/ets/MainAbility/pages/index.ets
+64
-64
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/longPressGesture.ets
...entry/src/main/ets/MainAbility/pages/longPressGesture.ets
+78
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/progress.ets
...mponent/entry/src/main/ets/MainAbility/pages/progress.ets
+97
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/tabs.ets
...s_component/entry/src/main/ets/MainAbility/pages/tabs.ets
+122
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/tapGesture.ets
...onent/entry/src/main/ets/MainAbility/pages/tapGesture.ets
+53
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets
...s_component/entry/src/main/ets/MainAbility/pages/text.ets
+50
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets
...ntry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets
+339
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets
.../entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets
+172
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets
...entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets
+213
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets
...entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets
+61
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets
...mponent/entry/src/main/ets/MainAbility/test/List.test.ets
+25
-2
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets
...y/src/main/ets/MainAbility/test/LongPressGesture.test.ets
+95
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets
...try/src/main/ets/MainAbility/test/ProgressJsunit.test.ets
+260
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets
...entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets
+112
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets
...t/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets
+265
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TapGesture.test.ets
...t/entry/src/main/ets/MainAbility/test/TapGesture.test.ets
+81
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets
...t/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets
+87
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets
...Ability/test/general-properties/PanGestureJsunit.test.ets
+117
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets
...ity/test/general-properties/ResponseRegionJsunit.test.ets
+117
-0
未找到文件。
ace/ace_ets_component/entry/src/main/config.json
浏览文件 @
bdd5ff9b
...
@@ -94,7 +94,23 @@
...
@@ -94,7 +94,23 @@
"pages/general-properties/flex"
,
"pages/general-properties/flex"
,
"pages/swiper"
,
"pages/swiper"
,
"pages/gridPage"
,
"pages/gridPage"
,
"pages/general-properties/rotationGesture"
"pages/text"
,
"pages/badge"
,
"pages/canvas"
,
"pages/longPressGesture"
,
"pages/badge"
,
"pages/button"
,
"pages/gridPage"
,
"pages/general-properties/touchAble"
,
"pages/swiper"
,
"pages/general-properties/visibility"
,
"pages/general-properties/ResponseRegion"
,
"pages/general-properties/PanGesture"
,
"pages/QrCode"
,
"pages/tabs"
,
"pages/tapGesture"
,
"pages/progress"
,
"pages/animate"
],
],
"name"
:
".MainAbility"
,
"name"
:
".MainAbility"
,
"window"
:
{
"window"
:
{
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/QrCode.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 events_emitter from '@ohos.emitter';
@Entry
@Component
struct QrCode {
@State qrCodeBackgroundColor: Color = "#FF008000";
@State qrCodeColor: Color = "#FF0000FF";
@State qrCodeValue: string = 'qrCodeValue';
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("qrCode page state change called:" + JSON.stringify(eventData));
var colorValue = eventData.data.color;
if (colorValue != null && colorValue.length != 0) {
this.qrCodeColor = colorValue;
console.info("qrCodeColor:" + qrCodeColor);
}else{
console.info("qrCodeColor is null or empty " + qrCodeColor);
}
} else {
console.info("qrCode page color not change called:" + JSON.stringify(eventData));
}
}
private stateChangCallBackTwo = (eventData) => {
if (eventData != null) {
console.info("qrCode page state change called:" + JSON.stringify(eventData));
var backgroundColorValue = eventData.data.backgroundColor;
if (backgroundColorValue != null && backgroundColorValue.length != 0) {
this.qrCodeBackgroundColor = backgroundColorValue;
console.info("qrCodeBackgroundColor:" + qrCodeBackgroundColor);
}else{
console.info("backgroundColorValue is null or empty " + qrCodeColor);
}
} else {
console.info("qrCode page backgroundColorValue not change called:" + JSON.stringify(eventData));
}
}
onPageShow() {
console.info('qrCode page show called');
var stateChangeEvent = {
eventId: 90,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
var stateChangeEvent = {
eventId: 80,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBackTwo);
}
build() {
Column({ space: 5 }) {
Text('QRCodeColor')
.fontSize(40)
.fontWeight(FontWeight.Bold)
.width('90%')
.fontColor(0xCCCCCC)
QRCode(`${this.qrCodeValue}`)
.backgroundColor(`${this.qrCodeBackgroundColor}`)
.color(`${this.qrCodeColor}`)
.width(198)
.height(198)
.key("QrCodeColor")
Text('QRCodeBackgroundColor')
.fontSize(40)
.fontWeight(FontWeight.Bold)
.width('90%')
.fontColor(0xCCCCCC)
QRCode(`${this.qrCodeValue}`)
.backgroundColor(`${this.qrCodeBackgroundColor}`)
.color(`${this.qrCodeColor}`)
.width(197)
.height(197)
.key("QrCodeBackgroundColor")
}
.width('100%')
.height('100%')
.margin({ top: 5 })
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/animate.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 events_emitter from '@ohos.emitter'
@Entry
@Component
struct AnimationExample {
@State btn1: boolean = false
@State duration:number = 100
@State curve:string = 'Ease'
@State iteration:number = 1
@State tempo:number= 1000
@State playmode:PlayMode = PlayMode.Normal
onPageShow(){
console.info('animate page show called');
var stateChangeEvent = {
eventId: 65,
priority:events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("animate page state change called:" + JSON.stringify(eventData));
if (eventData.data.duration != null) {
this.duration = parseInt(eventData.data.duration);
}
if (eventData.data.curve != null) {
this.curve = eventData.data.curve;
}
if (eventData.data.tempo != null) {
this.tempo = parseInt(eventData.data.tempo);
}
if (eventData.data.iteration != null) {
this.iteration = parseInt(eventData.data.iteration);
}
if (eventData.data.playmode != null) {
this.playmode = eventData.data.playmode;
}
}
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,}) {
Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:20})
.key('button1')
.onClick(() => {
try {
var backData = {
data: {
"duration": this.duration,
}
}
var backEvent = {
eventId: 60,
priority: events_emitter.EventPriority.LOW
}
console.info("button1 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("button1 emit action state err: " + JSON.stringify(err.message))
}
console.info("button1 animateTo START")
console.info("button1 duration value is : " + this.duration)
animateTo({duration:this.duration}, () => {
console.info("button1 duration test animateTo START")
})
})
Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:20})
.key('button2')
.onClick(() => {
try {
var backDataOne = {
data: {
"curve": this.curve,
}
}
var backEventOne = {
eventId: 61,
priority: events_emitter.EventPriority.LOW
}
console.info("button2 start to emit action state")
events_emitter.emit(backEventOne, backDataOne)
} catch (err) {
console.info("button2 emit action state err: " + JSON.stringify(err.message))
}
console.info("button2 animateTo START")
console.info("button2 curve value is : " + this.curve)
animateTo({ curve:this.curve }, () => {
console.info("button2 curve test animateTo START")
})
})
Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:20})
.key('button3')
.onClick(() => {
try {
var backDataTwo = {
data: {
"iterations": this.iteration,
}
}
var backEventTwo = {
eventId: 62,
priority: events_emitter.EventPriority.LOW
}
console.info("button3 start to emit action state")
events_emitter.emit(backEventTwo, backDataTwo)
} catch (err) {
console.info("button3 emit action state err: " + JSON.stringify(err.message))
}
console.info("button3 animateTo START")
console.info("button3 iteration value is : " + this.iteration)
animateTo({ iterations:this.iteration }, () => {
console.info("button3 iterations test animateTo START")
})
})
Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:20})
.key('button4')
.onClick(() => {
try {
var backDataThree = {
data: {
"tempo": this.tempo
}
}
var backEventThree = {
eventId: 63,
priority: events_emitter.EventPriority.LOW
}
console.info("button4 start to emit action state")
events_emitter.emit(backEventThree, backDataThree)
} catch (err) {
console.info("button4 emit action state err: " + JSON.stringify(err.message))
}
console.info("button4 animateTo START")
console.info("button4 tempo value is : " + this.duration)
animateTo({ tempo:this.tempo }, () => {
console.info("button4 tempo test animateTo START")
})
})
Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:20})
.key('button5')
.onClick(() => {
try {
var backDataFour = {
data: {
"playmode": this.playmode,
}
}
var backEventFour = {
eventId: 64,
priority: events_emitter.EventPriority.LOW
}
console.info("button5 start to emit action state")
events_emitter.emit(backEventFour, backDataFour)
} catch (err) {
console.info("button5 emit action state err: " + JSON.stringify(err.message))
}
console.info("button5 animateTo START")
console.info("button5 playmode value is : " + this.playmode)
animateTo({ PlayMode:this.playmode }, () => {
console.info("button5 playMode test animateTo START")
})
})
}.height(400).width("100%").padding({top:100})
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/badge.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 events_emitter from '@ohos.emitter';
@Entry
@Component
struct BadgeExample {
@State counts: number = 1
@State message: string = 'new'
@State fontSizeValue: number = 20;
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("Badge page state change called:" + JSON.stringify(eventData));
if(eventData.data.fontSizeValue != null) {
this.fontSizeValue = eventData.data.fontSizeValue;
}
}
}
onPageShow() {
console.info('Badge page show called');
var stateChangeEvent = {
eventId: 70,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Badge({
count: this.counts,
maxCount: 99,
style: { color: 0xFFFFFF, fontSize: this.fontSizeValue, badgeSize: 50, badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
this.counts++
})
.width(200).height(100).backgroundColor(0x317aff).fontSize(20)
}.width(100).height(50).key('badge')
}.width('100%').margin({ top: 5 })
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/button.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 events_emitter from '@ohos.emitter';
@Entry
@Component
struct ButtonExample {
@State buttonTypeValue: ButtonType = ButtonType.Normal;
@State fontSizeValue: number = 20;
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("Button page state change called:" + JSON.stringify(eventData));
if (eventData.data.fontSizeValue != null) {
this.fontSizeValue = eventData.data.fontSizeValue;
}
if (eventData.data.buttonTypeValue != null) {
this.buttonTypeValue = eventData.data.buttonTypeValue;
}
}
}
onPageShow() {
console.info('Button page show called');
var stateChangeEvent = {
eventId: 80,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
var stateChangeEvent = {
eventId: 81,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Button('Ok', { type: this.buttonTypeValue, stateEffect: true })
.borderRadius(8).backgroundColor(0x317aff).width(90).key('button')
Button('ok').type(`${this.buttonTypeValue}`).key('button1')
.backgroundColor(0x317aff).width(90)
Button('ok').type(this.buttonTypeValue).key('button2').fontSize(this.fontSizeValue)
.backgroundColor(0x317aff).width(90)
}.height(400).padding({ left: 35, right: 35, top: 35 })
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets
0 → 100755
浏览文件 @
bdd5ff9b
/**
* 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 events_emitter from '@ohos.emitter'
@Entry
@Component
struct CanvasExample {
private scroller: Scroller = new Scroller();
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
build() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) {
Scroll(this.scroller) {
Column() {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() => {
this.fillStyle();
this.lineWidth();
this.strokeStyle();
this.lineCap();
this.lineJoin();
this.miterLimit();
this.font();
this.textAlign();
this.textBaseline();
this.globalAlpha();
this.lineDashOffset();
this.globalCompositeOperation();
this.shadowBlur();
this.shadowColor();
this.shadowOffsetX();
this.shadowOffsetY();
this.imageSmoothingEnabled();
this.fillRect();
this.strokeRect();
this.clearRect();
this.fillText();
this.strokeText();
this.measureText();
this.beginPath();
this.closePath();
this.createPattern();
this.bezierCurveTo();
this.quadraticCurveTo();
this.arcTo();
this.rect();
this.transform();
this.setTransform();
this.translate();
this.drawImage();
this.createImageData();
this.createImageDataByImageData();
this.getImageData();
})
.key('canvas1')
}.width('100%').height('400%')
}.scrollable(ScrollDirection.Vertical).scrollBar(BarState.On)
.scrollBarColor(Color.Gray).scrollBarWidth(10)
}
.width('100%')
.height('100%')
}
onPageShow() {
}
fillStyle() {
this.context.fillStyle = '#0000ff';
this.context.fillRect(20, 120, 75, 55);
}
lineWidth() {
this.context.lineWidth = 5;
this.context.strokeRect(25, 25, 55, 75);
}
strokeStyle() {
this.context.lineWidth = 10;
this.context.strokeStyle = '#0000ff';
this.context.strokeRect(115, 25, 75, 55);
}
lineCap() {
this.context.lineWidth = 8;
this.context.beginPath();
this.context.lineCap = 'round';
this.context.moveTo(220, 50);
this.context.lineTo(320, 50);
this.context.stroke();
}
lineJoin() {
this.context.beginPath();
this.context.lineWidth = 8;
this.context.lineJoin = 'miter';
this.context.moveTo(370, 25);
this.context.lineTo(430, 50);
this.context.lineTo(370, 75);
this.context.stroke();
}
miterLimit() {
this.context.lineWidth = 8;
this.context.lineJoin = 'miter';
this.context.miterLimit = 3;
this.context.moveTo(130, 155);
this.context.lineTo(190, 160);
this.context.lineTo(130, 162);
this.context.stroke();
}
font() {
this.context.font = '20px sans-serif';
this.context.fillText("Hello World", 250, 170);
}
textAlign() {
let height = 230;
this.context.strokeStyle = '#0000ff';
this.context.moveTo(220, 10 + height);
this.context.lineTo(220, 210 + height);
this.context.stroke();
this.context.font = '20px sans-serif';
this.context.textAlign = 'start';
this.context.fillText('textAlign=start', 240, 50 + height);
this.context.textAlign = 'end';
this.context.fillText('textAlign=end', 210, 80 + height);
this.context.textAlign = 'left';
this.context.fillText('textAlign=left', 240, 110 + height);
this.context.textAlign = 'center';
this.context.fillText('textAlign=center', 230, 150 + height);
this.context.textAlign = 'right';
this.context.fillText('textAlign=right', 210, 200 + height);
}
textBaseline() {
let height = 550;
this.context.strokeStyle = '#0000ff';
this.context.moveTo(50, height);
this.context.lineTo(450, height);
this.context.stroke();
this.context.font = '20px sans-serif';
this.context.textBaseline = 'top';
this.context.fillText('Top', 60, height + 10);
this.context.textBaseline = 'bottom';
this.context.fillText('Bottom', 150, height - 10);
this.context.textBaseline = 'middle';
this.context.fillText('Middle', 225, height);
this.context.textBaseline = 'alphabetic';
this.context.fillText('Alphabetic', 345, height - 10);
this.context.textBaseline = 'hanging';
this.context.fillText('Hanging', 450, height + 10);
}
globalAlpha() {
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(0, 620, 50, 50);
this.context.globalAlpha = 0.4;
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(50, 670, 50, 50);
}
lineDashOffset() {
this.context.globalAlpha = 1;
this.context.beginPath();
this.context.arc(180, 650, 50, 0, 6.28);
this.context.setLineDash([10,20]);
this.context.stroke();
this.context.setLineDash([0, 0]);
}
globalCompositeOperation() {
let height = 600;
let width = 260;
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(20 + width, 20 + height, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(50 + width, 50 + height, 50, 50);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(120 + width, 20 + height, 50, 50);
this.context.globalCompositeOperation = 'destination-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(150 + width, 50 + height, 50, 50);
this.context.globalCompositeOperation = 'source-over';
}
shadowBlur() {
this.context.shadowBlur = 30;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(10, 800, 100, 80);
}
shadowColor() {
this.context.shadowBlur = 30;
this.context.shadowColor = 'rgb(0,0,255)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 800, 80, 100);
}
shadowOffsetX() {
this.context.shadowBlur = 10;
this.context.shadowOffsetX = 20;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(250, 800, 80, 80);
this.resetShadow(true);
}
shadowOffsetY() {
this.context.shadowBlur = 10;
this.context.shadowOffsetY = 20;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(360, 800, 80, 80);
this.resetShadow(false);
}
resetShadow(isX) {
this.context.shadowBlur = 0;
if (isX) {
this.context.shadowOffsetX = 0;
} else {
this.context.shadowOffsetY = 0;
}
}
imageSmoothingEnabled() {
let img = new ImageBitmap('/images/img.jpeg');
this.context.imageSmoothingEnabled = false;
this.context.drawImage( img, 30, 950, 160, 100);
}
fillRect() {
this.context.fillRect(10, 1080, 80, 80);
}
strokeRect() {
this.context.strokeRect(110, 1080, 100, 60);
}
clearRect() {
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(240, 950, 200, 200);
this.context.clearRect(260, 970, 100, 60);
}
fillText() {
this.context.font = '20px sans-serif';
this.context.fillText("Hello World!", 120, 1200);
}
strokeText() {
this.context.font = '20px sans-serif'
this.context.strokeText("Hello World!", 260, 1195);
}
measureText() {
this.context.font = '20px sans-serif';
this.context.fillText("Hello World!", 120, 1250);
this.context.fillText("width:" + this.context.measureText("Hello World!").width, 310, 1250);
}
beginPath() {
this.context.beginPath();
this.context.lineWidth = 6;
this.context.strokeStyle = '#0000ff';
this.context.moveTo(310, 1200);
this.context.lineTo(450, 1260);
this.context.stroke();
}
closePath() {
this.context.beginPath();
this.context.moveTo(30, 1300);
this.context.lineTo(110, 1300);
this.context.lineTo(70, 1360);
this.context.closePath();
this.context.stroke();
}
createPattern() {
let img = new ImageBitmap('/images/ic_health_heart.png');
let pattern = this.context.createPattern(img, 'repeat');
this.context.fillStyle = pattern;
this.context.fillRect(140, 1300, 250, 100);
}
bezierCurveTo() {
let height = 1400;
this.context.beginPath();
this.context.moveTo(10, 10 + height);
this.context.bezierCurveTo(20, 100 + height, 200, 100 + height, 200, 20 + height);
this.context.stroke();
}
quadraticCurveTo() {
let height = 1400;
let width = 210;
this.context.beginPath();
this.context.moveTo(20 + width, 20 + height);
this.context.quadraticCurveTo(100 + width, 100 + height, 200 + width, 20 + height);
this.context.stroke();
}
arcTo() {
this.context.moveTo(30, 20 + 1500);
this.context.arcTo(80, 20 + 1500, 80, 70 + 1500, 50);
this.context.stroke();
}
rect() {
this.context.rect(130, 20 + 1500, 80, 80);
this.context.stroke();
}
rotate() {
this.context.rotate(45 * Math.PI / 180);
this.context.fillRect(70, 20, 50, 50);
}
transform() {
this.context.fillStyle = 'rgb(0,0,0)';
this.context.fillRect(250, 1500, 100, 100);
this.context.transform(1, 0.1, 0.01, 1, 10, 10);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(250, 1500, 100, 100);
this.context.transform(1, 0.1, 0.01, 1, 10, 10);
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(250, 1500, 100, 100);
}
setTransform() {
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(0, 1650, 100, 100);
this.context.setTransform(1, 0.1, 0.01, 1, 10, 10);
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(0, 1650, 100, 100);
this.context.setTransform(1, 0, 0, 1, 0, 0);
}
translate() {
this.context.fillRect(180, 1650, 50, 50);
this.context.translate(50, 50);
this.context.fillRect(180, 1650, 50, 50);
}
drawImage() {
let img = new ImageBitmap('/images/img.jpeg');
this.context.drawImage(img, 0, 0, 500, 500, 0, 1780, 300, 150);
}
createImageData() {
let imageData = this.context.createImageData(100, 100);
console.info("[canvas] create image data-----" + JSON.stringify(imageData));
}
createImageDataByImageData() {
let imageData = this.context.createImageData(50, 50);
let imgData = this.context.createImageData(imageData);
console.info("[canvas] create image data by image data----" + JSON.stringify(imgData));
}
getImageData() {
let imageData = this.context.getImageData(10, 10, 80, 80);
console.info("[canvas] get image data-----" + JSON.stringify(imageData));
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/PanGesture.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 events_emitter from '@ohos.emitter';
@Entry
@Component
struct PanGestureExample {
@State offsetX: number = 0
@State offsetY: number = 0
@State touchable: boolean = false;
@State isTouched: boolean = false;
onPageShow() {
let ChangeEvent = {
eventId: 140,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(ChangeEvent, this.ChangCallBack)
}
private ChangCallBack = (eventData) => {
console.info("[PanGesture] ChangCallBack stateChangCallBack");
if (eventData != null) {
console.info("[PanGesture] ChangCallBack state change called:" + JSON.stringify(eventData));
if (eventData.data.touchable != null) {
this.touchable = eventData.data.touchable;
}
}
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('PanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY)
}
.height(300)
.width(300)
.padding(20)
.border({ width: 1 })
.margin(80)
.key('PanGesture')
.translate({ x: this.offsetX, y: this.offsetY, z: 5 })
.touchable(this.touchable)
.onTouch((event: TouchEvent) => {
console.log('[PanGesture] TouchType start');
this.isTouched = true
if (event.type === TouchType.Down) {
this.eventType = 'Down'
}
if (event.type === TouchType.Up) {
this.eventType = 'Up'
}
if (event.type === TouchType.Move) {
this.eventType = 'Move'
}
console.info('[PanGesture] TouchType:' + this.eventType)
try {
var backData = {
data: {
"ACTION": this.isTouched,
"EVENT_TYPE": this.eventType
}
}
var backEvent = {
eventId: 85,
priority: events_emitter.EventPriority.LOW
}
console.info("[PanGesture] start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("[PanGesture] emit action state err: " + JSON.stringify(err.message))
}
})
.gesture(
PanGesture({})
.onActionStart((event: PanGestureEvent) => {
console.info('Pan start')
})
.onActionUpdate((event: PanGestureEvent) => {
this.offsetX = event.offsetX
this.offsetY = event.offsetY
})
.onActionEnd(() => {
console.info('Pan end')
})
)
}
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/
rotationGesture
.ets
→
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/
ResponseRegion
.ets
浏览文件 @
bdd5ff9b
...
@@ -17,18 +17,44 @@ import events_emitter from '@ohos.emitter';
...
@@ -17,18 +17,44 @@ import events_emitter from '@ohos.emitter';
@Entry
@Entry
@Component
@Component
struct RotationGestureExample {
struct ResponseRegionExample {
@State angle: number = 0
@State touchable: boolean = false;
@State eventType: string = ''
@State isTouched: boolean = false;
@State isTouched: boolean = false;
@State eventType: string = ''
onPageShow() {
let ChangeEvent = {
eventId: 120,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(ChangeEvent, this.ChangCallBack)
}
private ChangCallBack = (eventData) => {
console.info("[ResponseRegion] ChangCallBack stateChangCallBack");
if (eventData != null) {
console.info("[ResponseRegion] ChangCallBack state change called:" + JSON.stringify(eventData));
if (eventData.data.touchable != null) {
this.touchable = eventData.data.touchable;
}
}
}
build() {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column() {
Text('RotationGesture angle:' + this.angle)
Toggle({ type: ToggleType.Checkbox, isOn: true })
.selectedColor(0x39a2db)
.backgroundColor(0xAFEEEE)
.responseRegion({ x: 1.0, y: 1.0, width: 400, height: 400 })
.onChange((isOn: boolean) => {
console.info('[ResponseRegion] Component status:' + isOn)
})
}
}
.height(300).width(300).padding(20).border({ width:1 })
.width('100%')
.margin(80).rotate({ x:1, y:2, z:3, angle: this.angle })
.height('100%')
.key('gesture')
.margin({ top: 5 })
.key('region')
.touchable(this.touchable)
.onTouch((event: TouchEvent) => {
.onTouch((event: TouchEvent) => {
this.isTouched = true
this.isTouched = true
if (event.type === TouchType.Down) {
if (event.type === TouchType.Down) {
...
@@ -40,7 +66,7 @@ struct RotationGestureExample {
...
@@ -40,7 +66,7 @@ struct RotationGestureExample {
if (event.type === TouchType.Move) {
if (event.type === TouchType.Move) {
this.eventType = 'Move'
this.eventType = 'Move'
}
}
console.info('
RotationGesture
TouchType:' + this.eventType)
console.info('
[ResponseRegion]
TouchType:' + this.eventType)
try {
try {
var backData = {
var backData = {
data: {
data: {
...
@@ -49,26 +75,15 @@ struct RotationGestureExample {
...
@@ -49,26 +75,15 @@ struct RotationGestureExample {
}
}
}
}
var backEvent = {
var backEvent = {
eventId:
56
,
eventId:
121
,
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
}
}
console.info("
RotationGesture
start to emit action state")
console.info("
[ResponseRegion]
start to emit action state")
events_emitter.emit(backEvent, backData)
events_emitter.emit(backEvent, backData)
} catch (err) {
} catch (err) {
console.info("
RotationGesture
emit action state err: " + JSON.stringify(err.message))
console.info("
[ResponseRegion]
emit action state err: " + JSON.stringify(err.message))
}
}
})
})
.gesture(
RotationGesture()
.onActionStart((event: RotationGestureEvent) => {
console.log('Rotation start')
})
.onActionUpdate((event: RotationGestureEvent) => {
this.angle = event.angle
})
.onActionEnd(() => {
console.log('Rotation end')
})
)
}
}
}
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/textStyle.ets
浏览文件 @
bdd5ff9b
...
@@ -104,7 +104,6 @@ struct TextStyle {
...
@@ -104,7 +104,6 @@ struct TextStyle {
} else if (eventData.data.fontSize) {
} else if (eventData.data.fontSize) {
this.fontSize = eventData.data.fontSize;
this.fontSize = eventData.data.fontSize;
} else if (eventData.data.fontWeight) {
} else if (eventData.data.fontWeight) {
console.log("gao---------" + eventData.data.fontWeight)
this.fontWeight = eventData.data.fontWeight;
this.fontWeight = eventData.data.fontWeight;
} else if (eventData.data.fontFamily) {
} else if (eventData.data.fontFamily) {
this.fontFamily = eventData.data.fontFamily;
this.fontFamily = eventData.data.fontFamily;
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/index.ets
浏览文件 @
bdd5ff9b
// @ts-nocheck
// @ts-nocheck
/**
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import file from '@system.file';
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
import testsuite from "../test/List.test.ets";
import featureAbility from "@ohos.ability.featureAbility";
import featureAbility from "@ohos.ability.featureAbility";
@Entry
@Entry
@Component
@Component
struct MyComponent {
struct MyComponent {
aboutToAppear() {
aboutToAppear() {
console.info("start run testcase!!!!")
console.info("start run testcase!!!!")
featureAbility.getWant()
featureAbility.getWant()
.then((Want) => {
.then((Want) => {
const core = Core.getInstance();
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
const expectExtend = new ExpectExtend({
'id': 'extend'
'id': 'extend'
});
});
core.addService('expect', expectExtend);
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.addService('report', reportExtend);
core.init();
core.init();
core.subscribeEvent('task', reportExtend);
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
const configService = core.getDefaultService('config');
console.info('parameters---->' + JSON.stringify(Want.parameters));
console.info('parameters---->' + JSON.stringify(Want.parameters));
configService.setConfig(Want.parameters);
configService.setConfig(Want.parameters);
testsuite();
testsuite();
core.execute();
core.execute();
console.info('Operation successful. Data: ' + JSON.stringify(Want));
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
})
.catch((error) => {
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
})
}
}
build() {
build() {
Flex({
Flex({
direction: FlexDirection.Column,
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
justifyContent: FlexAlign.Center
}) {
}) {
Text('ACE ETS TEST')
Text('ACE ETS TEST')
.fontSize(50)
.fontSize(50)
.fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Bold)
}
}
.width('100%')
.width('100%')
.height('100%')
.height('100%')
}
}
}
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/longPressGesture.ets
0 → 100755
浏览文件 @
bdd5ff9b
/**
* 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 events_emitter from '@ohos.emitter'
@Entry
@Component
struct LongPressGestureExample {
@State eventString: string = 'normal';
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('LongPress onAction:' + this.eventString).fontSize(20)
}
.key('flex')
.height(200).width(300).padding(60).border({ width:1 }).margin(30)
.gesture(
LongPressGesture({ repeat: true })
.onAction(() => {
console.info("longPressGesture current action onAction")
this.eventString = 'onAction';
console.info('onAction current action state is: ' + this.eventString);
try {
let backData = {
data: {
"ACTION": this.eventString,
}
}
let backEvent = {
eventId: 38,
priority: events_emitter.EventPriority.LOW
}
console.info("start to emit action state");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("emit action state err: " + JSON.stringify(err.message));
}
})
.onActionEnd(() => {
console.info("longPressGesture current action end")
this.eventString = 'onActionEnd';
console.info('onActionEnd current action state is: ' + this.eventString);
try {
let backData = {
data: {
"ACTION": this.eventString,
}
}
let backEvent = {
eventId: 39,
priority: events_emitter.EventPriority.LOW
}
console.info("start to emit action state");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("emit action state err: " + JSON.stringify(err.message));
}
})
.onActionCancel(() => {
console.info("longPressGesture current action cancel");
})
)
}
onPageShow() {
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/progress.ets
0 → 100755
浏览文件 @
bdd5ff9b
/**
* 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 events_emitter from '@ohos.emitter'
@Entry
@Component
struct ProgressExample {
@State value: number = 20
@State total: number = 100
@State style: ProgressStyle = ProgressStyle.Linear
private stateChangCallBack = (eventData) => {
console.info("progress page stateChangCallBack");
if (eventData != null) {
console.info("progress page state change called:" + JSON.stringify(eventData));
if(eventData.data.value != null) {
this.value = eventData.data.value;
}
if(eventData.data.total != null) {
this.total = eventData.data.total;
}
}
}
onPageShow() {
console.info('progress page show called');
var stateChangeEvent = {
eventId: 55,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
var stateChangeEventTwo = {
eventId: 44,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventTwo, this.stateChangCallBack)
var stateChangeEventThree = {
eventId: 43,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventThree, this.stateChangCallBack)
var stateChangeEventFour = {
eventId: 42,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventFour, this.stateChangCallBack)
var stateChangeEventFive = {
eventId: 41,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventFive, this.stateChangCallBack)
var stateChangeEventSix = {
eventId: 40,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventSix, this.stateChangCallBack)
}
build() {
Column({ space: 15 }) {
Text('Linear Progress').fontSize(9).fontColor(0xCCCCCC).width('90%')
Progress({ value: 20, style: ProgressStyle.Linear }).width(200).value(this.value).key('LPValue')
Progress({ value: 20, total: 150, style: ProgressStyle.Linear }).color(Color.Red).width(200)
Text('Eclipse Progress').fontSize(40).fontColor(0x0F0F0F).width('90%')
Row({ space: 40 }) {
Progress({ value: 25, style: ProgressStyle.Eclipse }).width(100).value(this.value).key('EPValue')
Progress({ value: 20, total: 150, style: ProgressStyle.Eclipse }).color(Color.Grey).width(110)
}
Text('Capsule Progress').fontSize(19).fontColor(0xEE2C2C).width('90%')
Row({ space: 40 }) {
Progress({ value: 27, style: ProgressStyle.Capsule }).width(100).value(this.value).key('CPValue')
Progress({ value: 20, total: 150, style: ProgressStyle.Capsule }).color(Color.Grey).value(50).width(120)
}
}.width('100%').margin({ top: 30 })
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/tabs.ets
0 → 100755
浏览文件 @
bdd5ff9b
/**
* 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 events_emitter from '@ohos.emitter'
@Entry
@Component
struct TabsExample {
@State barPosition: BarPosition = BarPosition.Start
@State index: number = 0
@State vertical: boolean = true
@State scrollable: boolean = true
@State barMode: BarMode = BarMode.Fixed
@State barWidth: number = 70
@State barHeight: number = 150
@State animationDuration: number = 400
@State onActionCalled: boolean = false
private controller: TabsController = new TabsController()
build() {
Column() {
Tabs({ barPosition: this.barPosition, controller: this.controller,index: this.index }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Pink)
}.tabBar('pink').key('tabContent1')
.onClick(() => {
this.onActionCalled = true;
console.info('tabContent1 current action state is: ' + this.onActionCalled);
try {
var backData = {
data: {
"ACTION": this.onActionCalled,
}
}
var backEvent = {
eventId: 88,
priority: events_emitter.EventPriority.LOW
}
console.info("tabContent1 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("tabContent1 emit action state err: " + JSON.stringify(err.message))
}
})
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Yellow)
}.tabBar('yellow')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Blue)
}.tabBar('blue')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Green)
}.tabBar('green')
}
.vertical(this.vertical)
.scrollable(this.scrollable)
.barMode(this.barMode)
.barWidth(70)
.barHeight(150)
.animationDuration(400)
.key('tabs')
.onChange((index: number) => {
console.info(index.toString())
})
.width('90%')
.backgroundColor(0xF5F5F5)
}
.width('100%')
.height(150)
.margin({ top: 5 })
}
onPageShow() {
console.info('tabs page show called');
var stateChangeEvent = {
eventId: 87,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("tabs page state change called:" + JSON.stringify(eventData));
if (eventData.data.index != null) {
this.index = parseInt(eventData.data.index);
}
if (eventData.data.barPosition != null) {
this.barPosition = eventData.data.barPosition;
}
if (eventData.data.vertical != null) {
this.vertical = eventData.data.vertical;
}
if (eventData.data.scrollable != null) {
this.scrollable = eventData.data.scrollable;
}
if (eventData.data.barMode != null) {
this.barMode = eventData.data.barMode;
}
if (eventData.data.barWidth != null) {
this.barWidth = parseInt(eventData.data.barWidth);
}
if (eventData.data.barHeight != null) {
this.barHeight = parseInt(eventData.data.barHeight);
}
if (eventData.data.animationDuration != null) {
this.animationDuration = parseInt(eventData.data.animationDuration);
}
}
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/tapGesture.ets
0 → 100755
浏览文件 @
bdd5ff9b
/**
* 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 events_emitter from '@ohos.emitter'
@Entry
@Component
struct TapGestureExample {
@State value: string = ''
@State onClickValue: boolean = false;
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('Click twice')
Text(this.value)
}
.height(200).width(300).padding(60).border({ width: 1 }).margin(30)
.gesture(
TapGesture({ count: 2 })
.onAction(() => {
this.value = 'TapGesture onAction'
this.onClickValue = true;
try {
var backData = {
data: {
"ACTION": this.onClickValue
}
}
var backEvent = {
eventId: 82,
priority: events_emitter.EventPriority.LOW
}
console.info("click to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("click action state err: " + JSON.stringify(err.message))
}
})
).key('tapGesture')
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets
0 → 100755
浏览文件 @
bdd5ff9b
/**
* 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 events_emitter from '@ohos.emitter'
@Entry
@Component
struct TextExample {
@State fontSize: number = 9
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Text('lineHeight')
.fontSize(this.fontSize)
.fontColor(0xCCCCCC)
.key('text')
}
.height(600)
.width(350)
.padding({ left: 35, right: 35, top: 35 })
}
onPageShow() {
console.info('text page show called');
var stateChangeEvent = {
eventId: 60,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("text page state change called:" + JSON.stringify(eventData));
if (eventData.data.fontSize != null) {
this.fontSize = parseInt(eventData.data.fontSize);
}
}
}
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'
import Utils from './Utils';
export default function animateJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info("animate beforeEach start");
let options = {
uri: 'pages/animate',
}
try {
router.clear();
let pages = router.getState();
console.info("get animate state pages:" + JSON.stringify(pages));
if (!("animate" == pages.name)) {
console.info("get animate state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push animate page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push animate page error:" + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("animate after each called");
});
// it('animateTest_0100', 0, async function (done) {
// console.info('animateTest_0100 START');
// await Utils.sleep(1500);
// let indexEvent = {
// eventId: 60,
// priority: events_emitter.EventPriority.LOW
// }
// let callback= (indexEvent) => {
// console.info("animateTest_0100 get state result is: " + JSON.stringify(indexEvent))
// except(indexEvent.data.duration).assertEqual('100')
// }
// try {
// events_emitter.on(indexEvent, callback);
// } catch (err) {
// console.info("animateTest_0100 on events_emitter err : " + JSON.stringify(err));
// }
// console.info("animateTest_0100 click result is: " + JSON.stringify(sendEventByKey('button1',10,"")));
// await Utils.sleep(2000);
// console.info('animateTest_0100 END');
// done();
// });
//
// it('animateTest_0200', 0, async function (done) {
// console.info('animateTest_0200 START');
// await Utils.sleep(1500);
// let indexEvent = {
// eventId: 61,
// priority: events_emitter.EventPriority.LOW
// }
// let callback= (indexEvent) => {
// console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
// except(indexEvent.data.curve).assertEqual('Ease')
// }
// try {
// events_emitter.on(indexEvent, callback);
// } catch (err) {
// console.info("animateTest_0200 on events_emitter err : " + JSON.stringify(err));
// }
// console.info("animateTest_0200 click result is: " + JSON.stringify(sendEventByKey('button2',10,"")));
// await Utils.sleep(2000);
// console.info('animateTest_0200 END');
// done();
// });
//
// it('animateTest_0300', 0, async function (done) {
// console.info('animateTest_0300 START');
// await Utils.sleep(1500);
// let indexEvent = {
// eventId: 62,
// priority: events_emitter.EventPriority.LOW
// }
// let callback= (indexEvent) => {
// console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
// except(indexEvent.data.iteration).assertEqual('1')
// }
// try {
// events_emitter.on(indexEvent, callback);
// } catch (err) {
// console.info("animateTest_0300 on events_emitter err : " + JSON.stringify(err));
// }
// console.info("animateTest_0300 click result is: " + JSON.stringify(sendEventByKey('button3',10,"")));
// await Utils.sleep(2000);
// console.info('animateTest_0300 END');
// done();
// });
//
// it('animateTest_0400', 0, async function (done) {
// console.info('animateTest_0400 START');
// await Utils.sleep(1500);
// let indexEvent = {
// eventId: 63,
// priority: events_emitter.EventPriority.LOW
// }
// let callback= (indexEvent) => {
// console.info("animateTest_0400 get state result is: " + JSON.stringify(indexEvent))
// except(indexEvent.data.tempo).assertEqual(1000)
// }
// try {
// events_emitter.on(indexEvent, callback);
// } catch (err) {
// console.info("animateTest_0400 on events_emitter err : " + JSON.stringify(err));
// }
// console.info("animateTest_0400 click result is: " + JSON.stringify(sendEventByKey('button4',10,"")));
// await Utils.sleep(2000);
// console.info('animateTest_0400 END');
// done();
// });
//
// it('animateTest_0500', 0, async function (done) {
// console.info('animateTest_0500 START');
// await Utils.sleep(1500);
// let indexEvent = {
// eventId: 64,
// priority: events_emitter.EventPriority.LOW
// }
// let callback= (indexEvent) => {
// console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
// except(indexEvent.data.playmode).assertEqual('normal')
// }
// try {
// events_emitter.on(indexEvent, callback);
// } catch (err) {
// console.info("animateTest_0500 on events_emitter err : " + JSON.stringify(err));
// }
// console.info("animateTest_0500 click result is: " + JSON.stringify(sendEventByKey('button5',10,"")));
// await Utils.sleep(2000);
// console.info('animateTest_0500 END');
// done();
// });
//
// it('animateTest_0600', 0, async function (done) {
// console.info('animateTest_0500 START');
// try {
// let eventData = {
// data: {
// "duration":'2000'
// }
// }
// let indexEventOne = {
// eventId: 65,
// priority: events_emitter.EventPriority.LOW
// }
// console.info("animateTest_0600 start to publish emit");
// events_emitter.emit(indexEventOne, eventData);
// } catch (err) {
// console.log("animateTest_0600 change component data error: " + err.message);
// }
// let indexEvent = {
// eventId: 60,
// priority: events_emitter.EventPriority.LOW
// }
// let callback= (indexEvent) => {
// console.info("animateTest_0600 get state result is: " + JSON.stringify(indexEvent))
// except(indexEvent.data.duration).assertEqual('2000')
// }
// try {
// events_emitter.on(indexEvent, callback);
// } catch (err) {
// console.info("animateTest_0600 on events_emitter err : " + JSON.stringify(err));
// }
// console.info("animateTest_0600 click result is: " + JSON.stringify(sendEventByKey('button1',10 ,"")));
// await Utils.sleep(2000);
// console.info('animateTest_0600 END');
// done();
// });
it('animateTest_0700', 0, async function (done) {
console.info('animateTest_0700 START');
try {
let eventData = {
data: {
"curve": "Linear"
}
}
let indexEventOne = {
eventId: 65,
priority: events_emitter.EventPriority.LOW
}
console.info("animateTest_0700 start to publish emit");
events_emitter.emit(indexEventOne, eventData);
} catch (err) {
console.log("animateTest_0700 change component data error: " + err.message);
}
let indexEvent = {
eventId: 61,
priority: events_emitter.EventPriority.LOW
}
let callback= (indexEvent) => {
console.info("animateTest_0700 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.curve).assertEqual('Linear')
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("animateTest_0700 on events_emitter err : " + JSON.stringify(err));
}
console.info("animateTest_0700 click result is: " + JSON.stringify(sendEventByKey('button2',10 ,"")));
await Utils.sleep(2000);
console.info('animateTest_0700 END');
done();
});
it('animateTest_0800', 0, async function (done) {
console.info('animateTest_0800 START');
try {
let eventData = {
data: {
"iteration":"2"
}
}
let indexEventOne = {
eventId: 65,
priority: events_emitter.EventPriority.LOW
}
console.info("animateTest_0800 start to publish emit");
events_emitter.emit(indexEventOne, eventData);
} catch (err) {
console.log("animateTest_0800 change component data error: " + err.message);
}
let indexEvent = {
eventId: 62,
priority: events_emitter.EventPriority.LOW
}
let callback= (indexEvent) => {
console.info("animateTest_0800 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.iteration).assertEqual('2')
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("animateTest_0800 on events_emitter err : " + JSON.stringify(err));
}
console.info("animateTest_0800 click result is: " + JSON.stringify(sendEventByKey('button3',10 ,"")));
await Utils.sleep(2000);
console.info('animateTest_0800 END');
done();
});
it('animateTest_0900', 0, async function (done) {
console.info('animateTest_0900 START');
try {
let eventData = {
data: {
"tempo": "20000"
}
}
let indexEventOne = {
eventId: 65,
priority: events_emitter.EventPriority.LOW
}
console.info("animateTest_0900 start to publish emit");
events_emitter.emit(indexEventOne, eventData);
} catch (err) {
console.log("animateTest_0900 change component data error: " + err.message);
}
let indexEvent = {
eventId: 63,
priority: events_emitter.EventPriority.LOW
}
let callback= (indexEvent) => {
console.info("animateTest_0900 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.tempo).assertEqual('20000')
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("animateTest_0900 on events_emitter err : " + JSON.stringify(err));
}
console.info("animateTest_0900 click result is: " + JSON.stringify(sendEventByKey('button4',10 ,"")));
await Utils.sleep(2000);
console.info('animateTest_0900 END');
done();
});
it('animateTest_1000', 0, async function (done) {
console.info('animateTest_1000 START');
try {
let eventData = {
data: {
"playmode":"PlayMode.Alternate"
}
}
let indexEventOne = {
eventId: 65,
priority: events_emitter.EventPriority.LOW
}
console.info("animateTest_1000 start to publish emit");
events_emitter.emit(indexEventOne, eventData);
} catch (err) {
console.log("animateTest_1000 change component data error: " + err.message);
}
let indexEvent = {
eventId: 64,
priority: events_emitter.EventPriority.LOW
}
let callback= (indexEvent) => {
console.info("animateTest_1000 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.playmode).assertEqual('alternate')
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("animateTest_1000 on events_emitter err : " + JSON.stringify(err));
}
console.info("animateTest_1000 click result is: " + JSON.stringify(sendEventByKey('button5',10 ,"")));
await Utils.sleep(2000);
console.info('animateTest_1000 END');
done();
});
})
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'
import Utils from './Utils';
export default function badgeJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info("badge beforeEach start");
let options = {
uri: 'pages/badge',
}
let result;
try {
router.clear();
let pages = router.getState();
console.info("get badge state pages: " + JSON.stringify(pages));
if (!("appear" == pages.name)) {
console.info("get badge state pages.name: " + JSON.stringify(pages.name));
result = await router.push(options);
await Utils.sleep(2000);
console.info("push badge page result: " + JSON.stringify(result));
}
} catch (err) {
console.error("push badge page error: " + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("badge after each called");
})
it('testBadge01', 0, async function (done) {
console.info('[testBadge01] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('badge');
let obj = JSON.parse(strJson);
console.info("[testBadge01] component obj is: " + JSON.stringify(obj));
let style = JSON.parse(obj.$attrs.style);
expect(obj.$type).assertEqual('Badge');
expect(style.fontSize).assertEqual('20.000000fp');
done();
});
it('testBadge02', 0, async function (done) {
console.info('[testBadge02] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"fontSizeValue": "30",
}
}
var innerEvent = {
eventId: 70,
priority: events_emitter.EventPriority.LOW
}
console.info("[testBadge02] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testBadge02] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('badge');
let objNew = JSON.parse(strJsonNew);
console.info("[testBadge02] component objNew is: " + JSON.stringify(objNew));
let style = JSON.parse(objNew.$attrs.style);
expect(style.fontSize).assertEqual('30.000000fp');
done();
});
it('testBadge03', 0, async function (done) {
console.info('[testBadge03] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"fontSizeValue": "-1",
}
}
var innerEvent = {
eventId: 70,
priority: events_emitter.EventPriority.LOW
}
console.info("[testBadge03] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testBadge03] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('badge');
let objNew = JSON.parse(strJsonNew);
console.info("[testBadge03] component objNew is: " + JSON.stringify(objNew));
let style = JSON.parse(objNew.$attrs.style);
expect(style.fontSize).assertEqual('-1.000000fp');
done();
});
it('testBadge04', 0, async function (done) {
console.info('[testBadge04] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"fontSizeValue": "121212121",
}
}
var innerEvent = {
eventId: 70,
priority: events_emitter.EventPriority.LOW
}
console.info("[testBadge04] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testBadge04] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('badge');
let objNew = JSON.parse(strJsonNew);
console.info("[testBadge04] component objNew is: " + JSON.stringify(objNew));
let style = JSON.parse(objNew.$attrs.style);
expect(style.fontSize).assertEqual('121212121.000000fp');
done();
});
it('testBadge05', 0, async function (done) {
console.info('[testBadge05] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"fontSizeValue": "121212121vaas",
}
}
var innerEvent = {
eventId: 70,
priority: events_emitter.EventPriority.LOW
}
console.info("[testBadge05] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testBadge05] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('badge');
let objNew = JSON.parse(strJsonNew);
console.info("[testBadge05] component objNew is: " + JSON.stringify(objNew));
let style = JSON.parse(objNew.$attrs.style);
console.info("[testBadge05] component style is: " + JSON.stringify(style));
expect(style.fontSize).assertEqual('121212121.000000fp');
done();
});
})
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 router from '@system.router';
import events_emitter from '@ohos.events.emitter'
import Utils from './Utils';
export default function buttonJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info("button beforeEach start");
let options = {
uri: 'pages/button',
}
let result;
try {
router.clear();
let pages = router.getState();
console.info("get button state pages: " + JSON.stringify(pages));
if (!("appear" == pages.name)) {
console.info("get button state pages.name: " + JSON.stringify(pages.name));
result = await router.push(options);
await Utils.sleep(2000);
console.info("push button page result: " + JSON.stringify(result));
}
} catch (err) {
console.error("push button page error: " + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("button after each called");
})
it('testButton01', 0, async function (done) {
console.info('[testButton01] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('button');
let obj = JSON.parse(strJson);
console.info("[testButton01] component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Button');
expect(obj.$attrs.type).assertEqual('ButtonType.Normal');
done();
});
it('testButton02', 0, async function (done) {
console.info('[testButton02] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('button1');
let obj = JSON.parse(strJson);
console.info("[testButton02] component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Button');
expect(obj.$attrs.type).assertEqual('ButtonType.Normal');
done();
});
it('testButton03', 0, async function (done) {
console.info('[testButton03] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('button2');
let obj = JSON.parse(strJson);
console.info("[testButton03] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.fontSize).assertEqual('20');
done();
});
it('testButton04', 0, async function (done) {
console.info('[testButton04] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"buttonTypeValue": "ButtonType.Capsule",
}
}
var innerEvent = {
eventId: 80,
priority: events_emitter.EventPriority.LOW
}
console.info("[testButton04] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testButton04] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('button');
let objNew = JSON.parse(strJsonNew);
console.info("[testButton04] component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.type).assertEqual('ButtonType.Capsule');
done();
});
it('testButton05', 0, async function (done) {
console.info('[testButton05] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"fontSizeValue": "30",
}
}
var innerEvent = {
eventId: 81,
priority: events_emitter.EventPriority.LOW
}
console.info("[testButton05] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testButton05] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('button2');
let objNew = JSON.parse(strJsonNew);
console.info("[testButton05] component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.fontSize).assertEqual('30');
done();
});
it('testButton06', 0, async function (done) {
console.info('[testButton06] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"fontSizeValue": "-1",
}
}
var innerEvent = {
eventId: 81,
priority: events_emitter.EventPriority.LOW
}
console.info("[testButton06] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testButton06] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('button2');
let objNew = JSON.parse(strJsonNew);
console.info("[testButton06] component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.fontSize).assertEqual('0');
done();
});
it('testButton07', 0, async function (done) {
console.info('[testButton07] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"fontSizeValue": "121212121",
}
}
var innerEvent = {
eventId: 81,
priority: events_emitter.EventPriority.LOW
}
console.info("[testButton07] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testButton07] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('button2');
let objNew = JSON.parse(strJsonNew);
console.info("[testButton07] component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.fontSize).assertEqual('121212121');
done();
});
it('testButton08', 0, async function (done) {
console.info('[testButton08] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"fontSizeValue": "121212121vaas",
}
}
var innerEvent = {
eventId: 81,
priority: events_emitter.EventPriority.LOW
}
console.info("[testButton08] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testButton08] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('button2');
let objNew = JSON.parse(strJsonNew);
console.info("[testButton08] component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.fontSize).assertEqual('121212121');
done();
});
})
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 router from '@system.router';
import events_emitter from '@ohos.emitter';
import Utils from './Utils';
export default function canvasJsunit() {
describe('canvasTest', function () {
beforeEach(async function (done) {
console.info("canvas beforeEach start");
let options = {
uri: 'pages/canvas',
}
try {
router.clear();
let pages = router.getState();
console.info("get canvas state pages:" + JSON.stringify(pages));
if (!("canvas" == pages.name)) {
console.info("get canvas state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push canvas page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push canvas page error:" + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("canvas after each called");
});
it('testCanvas01', 0, async function (done) {
console.info('[testCanvas01] START');
await Utils.sleep(1000);
console.info('[testCanvas01]----------- START');
let strJson = getInspectorByKey('canvas1');
let obj = JSON.parse(strJson);
console.info("[testCanvas01] obj is: " + JSON.stringify(obj));
console.info('testCanvas01 END');
done();
});
});
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets
浏览文件 @
bdd5ff9b
// @ts-nocheck
/**
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
...
@@ -43,7 +44,18 @@ import backgroundJsunit from './general-properties/BackgroundJsunit.test.ets';
...
@@ -43,7 +44,18 @@ import backgroundJsunit from './general-properties/BackgroundJsunit.test.ets';
import borderJsunit from './general-properties/BorderJsunit.test.ets';
import borderJsunit from './general-properties/BorderJsunit.test.ets';
import flexJsunit from './general-properties/FlexJsunit.test.ets';
import flexJsunit from './general-properties/FlexJsunit.test.ets';
import gridJsunit from './GridJsunit.test.ets';
import gridJsunit from './GridJsunit.test.ets';
import rotationGestureJsUnit from './general-properties/RotationGestureJsunit.test.ets';
import canvasJsunit from './CanvasJsunit.test.ets';
import textJsunit from './TextJsunit.test.ets';
import badgeJsunit from './BadgeJsunit.test.ets';
import longPressGestureJsUnit from './LongPressGesture.test.ets';
import buttonJsunit from './ButtonJsunit.test.ets';
import responseRegionJsunit from './general-properties/ResponseRegionJsunit.test.ets';
import panGestureJsunit from './general-properties/PanGestureJsunit.test.ets';
import tabsJsunit from './TabsJsunit.test.ets';
import qrCodeJsunit from './QrCodeJsunit.test.ets';
import tapGesture from './TapGesture.test.ets';
import progressJsunit from './ProgressJsunit.test.ets';
import animateJsunit from './AnimateJsunit.test.ets';
export default function testsuite() {
export default function testsuite() {
gaugeJsunit();
gaugeJsunit();
...
@@ -77,5 +89,16 @@ export default function testsuite() {
...
@@ -77,5 +89,16 @@ export default function testsuite() {
borderJsunit();
borderJsunit();
flexJsunit();
flexJsunit();
gridJsunit();
gridJsunit();
rotationGestureJsUnit();
textJsunit();
badgeJsunit();
canvasJsunit();
longPressGestureJsUnit();
buttonJsunit();
responseRegionJsunit();
tabsJsunit();
panGestureJsunit();
qrCodeJsunit();
tapGesture();
progressJsunit();
animateJsunit();
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 router from '@system.router';
import events_emitter from '@ohos.events.emitter';
import Utils from './Utils';
export default function longPressGestureJsunit() {
describe('longPressGestureTest', function () {
beforeEach(async function (done) {
console.info("longPressGesture beforeEach start");
let options = {
uri: 'pages/longPressGesture',
}
try {
router.clear();
let pages = router.getState();
console.info("get longPressGesture state pages:" + JSON.stringify(pages));
if (!("longPressGesture" == pages.name)) {
console.info("get longPressGesture state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push longPressGesture page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push longPressGesture page error:" + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("longPressGesture after each called");
});
it('testLongPressGesture01', 0, async function (done) {
console.info('[testLongPressGesture01] START');
await Utils.sleep(1000);
let callback = (eventData) => {
console.info("testLongPressGesture01 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual('onAction')
}
let innerEvent = {
eventId: 38,
priority: events_emitter.EventPriority.LOW
}
try {
console.info("testLongPressGesture01 on events_emitter on");
events_emitter.on(innerEvent, callback)
} catch (err) {
console.info("testLongPressGesture01 on events_emitter err : " + JSON.stringify(err));
}
console.info("testLongPressGesture01 sendEventByKey result: " + JSON.stringify(sendEventByKey('flex', 11, "")));
await Utils.sleep(1000);
console.info('testLongPressGesture01 END');
done();
});
it('testLongPressGesture02', 0, async function (done) {
console.info('[testLongPressGesture02] START');
await Utils.sleep(1000);
let callback = (eventData) => {
console.info("testLongPressGesture02 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual('onActionEnd')
}
let innerEvent = {
eventId: 39,
priority: events_emitter.EventPriority.LOW
}
try {
console.info("testLongPressGesture02 on events_emitter on");
events_emitter.on(innerEvent, callback)
} catch (err) {
console.info("testLongPressGesture02 on events_emitter err : " + JSON.stringify(err));
}
console.info("testLongPressGesture02 sendEventByKey result: " + JSON.stringify(sendEventByKey('flex', 11, "")));
await Utils.sleep(1000);
console.info('testLongPressGesture02 END');
done();
});
})
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
/**
* 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 router from '@system.router';
import Utils from './Utils';
import events_emitter from '@ohos.events.emitter';
export default function progressJsunit() {
describe('progressTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/progress',
}
try {
router.clear();
let pages = router.getState();
console.info("get progress state success " + JSON.stringify(pages));
if (!("progress" == pages.name)) {
console.info("get progress state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(4000);
console.info("push progress page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push progress page error " + JSON.stringify(err));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("progress after each called");
});
it('testProgress_100', 0, async function (done) {
console.info('testProgress_100 START');
let strJson1 = getInspectorByKey('LPValue');
let objLP = JSON.parse(strJson1);
console.info("testProgress_100 component objLP is: " + objLP.$attrs.value);
await Utils.sleep(1000);
try {
let eventData = {
data: {
"value": 100
}
}
var innerEvent = {
eventId: 55,
priority: events_emitter.EventPriority.LOW
}
console.info("testProgress_100 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testProgress_100 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('LPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_100 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("100.000000");
console.info('testProgress_100 END');
done();
});
it('testProgress_200', 0, async function (done) {
console.info('[testProgress_200] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('LPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_200 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.width).assertEqual("200.000000vp");
console.info('testProgress_200 END');
done();
});
it('testProgress_300', 0, async function (done) {
console.info('testProgress_300 START');
let strJson1 = getInspectorByKey('EPValue');
let objEP = JSON.parse(strJson1);
console.info("testProgress_300 component objEP is: " + objEP.$attrs.value);
await Utils.sleep(1000);
try {
let eventData = {
data: {
"value": 100
}
}
var innerEvent = {
eventId: 44,
priority: events_emitter.EventPriority.LOW
}
console.info("testProgress_300 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testProgress_300 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('EPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_300 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("100.000000");
console.info('testProgress_300 END');
done();
});
it('testProgress_400', 0, async function (done) {
console.info('[testProgress_400] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('LPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_400 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.width).assertEqual("200.000000vp");
console.info('testProgress_400 END');
done();
});
it('testProgress_500', 0, async function (done) {
console.info('testProgress_500 START');
let strJson1 = getInspectorByKey('CPValue');
let objCP = JSON.parse(strJson1);
console.info("testProgress_500 component objCP is: " + objCP.$attrs.value);
await Utils.sleep(1000);
try {
let eventData = {
data: {
"value": 100
}
}
var innerEvent = {
eventId: 43,
priority: events_emitter.EventPriority.LOW
}
console.info("testProgress_500 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testProgress_500 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('EPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_500 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("100.000000");
console.info('testProgress_500 END');
done();
});
it('testProgress_600', 0, async function (done) {
console.info('[testProgress_600] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('CPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_600 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.width).assertEqual("100.000000vp");
console.info('testProgress_600 END');
done();
});
it('testProgress_700', 0, async function (done) {
console.info('testProgress_700 START');
let strJson1 = getInspectorByKey('LPValue');
let objLP = JSON.parse(strJson1);
console.info("testProgress_700 component objLP is: " + objLP.$attrs.value);
await Utils.sleep(1000);
try {
let eventData = {
data: {
"value": 0
}
}
var innerEvent = {
eventId: 42,
priority: events_emitter.EventPriority.LOW
}
console.info("testProgress_700 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testProgress_700 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('LPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_700 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("0.000000");
console.info('testProgress_700 END');
done();
});
it('testProgress_800', 0, async function (done) {
console.info('testProgress_800 START');
let strJson1 = getInspectorByKey('EPValue');
let objEP = JSON.parse(strJson1);
console.info("testProgress_800 component objEP is: " + objEP.$attrs.value);
await Utils.sleep(1000);
try {
let eventData = {
data: {
"value": 0
}
}
var innerEvent = {
eventId: 41,
priority: events_emitter.EventPriority.LOW
}
console.info("testProgress_800 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testProgress_800 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('EPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_800 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("0.000000");
console.info('testProgress_800 END');
done();
});
it('testProgress_900', 0, async function (done) {
console.info('testProgress_900 START');
let strJson1 = getInspectorByKey('CPValue');
let objCP = JSON.parse(strJson1);
console.info("testProgress_900 component objCP is: " + objCP.$attrs.value);
await Utils.sleep(1000);
try {
let eventData = {
data: {
"value": 0
}
}
var innerEvent = {
eventId: 40,
priority: events_emitter.EventPriority.LOW
}
console.info("testProgress_900 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testProgress_900 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('EPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_900 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("0.000000");
console.info('testProgress_900 END');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 router from '@system.router';
import events_emitter from '@ohos.events.emitter';
import Utils from './Utils';
export default function qrCodeJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/QrCode',
}
try {
router.clear();
let pages = router.getState();
console.info("get QrCode state success " + JSON.stringify(pages));
if (!("QrCode" == pages.name)) {
console.info("get QrCode pages success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push QrCode page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push QrCode page error " + JSON.stringify(err));
}
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info("QrCode after each called");
});
it('test_qrCode_001', 0, async function (done) {
console.info('[test_qrCode_001] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('QrCodeColor');
let obj = JSON.parse(strJson);
console.info("[test_qrCode_001] component obj is: " + JSON.stringify(obj));
await Utils.sleep(1000);
expect(obj.$attrs.backgroundColor).assertEqual('#FF008000');
expect(obj.$attrs.color).assertEqual('#FF0000FF');
done();
});
it('test_qrCode_002', 0, async function (done) {
console.info('[test_qrCode_002] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"color": "#FFB6C1"
}
}
var innerEvent = {
eventId: 90,
priority: events_emitter.EventPriority.LOW
}
console.info("[test_qrCode_002] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[test_qrCode_002] change component color error: " + err.message);
}
await Utils.sleep(2000);
var strJson = getInspectorByKey('QrCodeColor');
var obj = JSON.parse(strJson);
console.info("[test_qrCode_002] component obj is: " + JSON.stringify(obj.$attrs.color));
expect(obj.$attrs.color).assertEqual('#FFFFB6C1');
done();
});
it('test_qrCode_003', 0, async function (done) {
console.info('[test_qrCode_003] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"backgroundColor": "#FFB6C1"
}
}
var innerEvent = {
eventId: 80,
priority: events_emitter.EventPriority.LOW
}
console.info("[test_qrCode_003] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[test_qrCode_003] change component color error: " + err.message);
}
await Utils.sleep(2000);
var strJson = getInspectorByKey('QrCodeBackgroundColor');
var obj = JSON.parse(strJson);
console.info("[test_qrCode_003] component obj is: " + JSON.stringify(obj.$attrs.backgroundColor));
expect(obj.$attrs.backgroundColor).assertEqual('#FFFFB6C1');
done();
});
})
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
/**
* 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.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
import Utils from './Utils';
import events_emitter from '@ohos.events.emitter';
export default function tabsJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info("tabs beforeEach start");
let options = {
uri: 'pages/tabs',
}
try {
router.clear();
let pages = router.getState();
console.info("get tabs state pages:" + JSON.stringify(pages));
if (!("tabs" == pages.name)) {
console.info("get tabs state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push tabs page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push tabs page error:" + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("tabs after each called");
});
it('testTabs_0100', 0, async function (done) {
console.info('testTabs_0100 START');
let strJson = getInspectorByKey('tabs');
console.info("testTabs_0100 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("testTabs_0100 component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Tabs');
expect(obj.$attrs.barPosition).assertEqual('BarPosition.Start');
console.info('testTabs_0100 END');
done();
});
it('testTabs_0200', 0, async function (done) {
console.info('testTabs_0200 START');
let strJson = getInspectorByKey('tabs');
console.info("testTabs_0200 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("testTabs_0200 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.index).assertEqual('0');
console.info('testTabs_0200 END');
done();
});
it('testTabs_0300', 0, async function (done) {
console.info('testTabs_0300 START');
let strJson = getInspectorByKey('tabs');
console.info("testTabs_0300 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("testTabs_0300 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.vertical).assertEqual('true');
console.info('testTabs_0300 END');
done();
});
it('testTabs_0400', 0, async function (done) {
console.info('testTabs_0400 START');
let strJson = getInspectorByKey('tabs');
console.info("testTabs_0400 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("testTabs_0400 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.scrollable).assertEqual(true);
console.info('testTabs_0400 END');
done();
});
it('testTabs_0500', 0, async function (done) {
console.info('testTabs_0500 START');
let strJson = getInspectorByKey('tabs');
console.info("testTabs_0500 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("testTabs_0500 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.barMode).assertEqual('BarMode.Fixed');
console.info('testTabs_0500 END');
done();
});
it('testTabs_0600', 0, async function (done) {
console.info('testTabs_0600 START');
let strJson = getInspectorByKey('tabs');
console.info("testTabs_0600 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("testTabs_0600 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.barWidth).assertEqual('70.000000');
console.info('testTabs_0600 END');
done();
});
it('testTabs_0700', 0, async function (done) {
console.info('testTabs_0700 START');
let strJson = getInspectorByKey('tabs');
console.info("testTabs_0700 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("testTabs_0700 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.barHeight).assertEqual('150.000000');
console.info('testTabs_0700 END');
done();
});
it('testTabs_0800', 0, async function (done) {
console.info('testTabs_0800 START');
let strJson = getInspectorByKey('tabContent1');
console.info("testTabs_0800 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("testTabs_0800 component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('TabContent');
expect(obj.$attrs.tabBar).assertEqual('pink');
console.info('testTabs_0800 END');
done();
});
it('testTabs_0900', 0, async function (done) {
console.info('testTabs_0900 START');
try {
let eventData = {
data: {
"vertical": "false",
}
}
let indexEvent = {
eventId: 87,
priority: events_emitter.EventPriority.LOW
}
console.info("testTabs_0900 start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("testTabs_0900 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('tabs');
let objNew = JSON.parse(strJsonNew);
console.info("testTabs_0900 component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.vertical).assertEqual('false');
console.info('testTabs_0900 END');
done();
});
it('testTabs_1000', 0, async function (done) {
console.info('testTabs_1000 START');
try {
let eventData = {
data: {
"scrollable": "false",
}
}
let indexEvent = {
eventId: 87,
priority: events_emitter.EventPriority.LOW
}
console.info("testTabs_1000 start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("testTabs_1000 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('tabs');
let objNew = JSON.parse(strJsonNew);
console.info("testTabs_1000 component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.scrollable).assertEqual(false);
console.info('testTabs_1000 END');
done();
});
it('testTabs_1100', 0, async function (done) {
console.info('testTabs_1100 START');
try {
let eventData = {
data: {
"scrollable": "false53",
}
}
let indexEvent = {
eventId: 87,
priority: events_emitter.EventPriority.LOW
}
console.info("testTabs_1100 start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("testTabs_1100 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('tabs');
let objNew = JSON.parse(strJsonNew);
console.info("testTabs_1100 component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.scrollable).assertEqual(false);
console.info('testTabs_1100 END');
done();
});
it('testTabs_1200', 0, async function (done) {
console.info('testTabs_1200 START');
try {
let eventData = {
data: {
"vertical": "39284",
}
}
let indexEvent = {
eventId: 87,
priority: events_emitter.EventPriority.LOW
}
console.info("testTabs_1200 start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("testTabs_1200 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('tabs');
let objNew = JSON.parse(strJsonNew);
console.info("testTabs_1200 component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.scrollable).assertEqual(false);
console.info('testTabs_1200 END');
done();
});
it('testTabs_1300', 0, async function (done) {
console.info('testTabs_1300 START');
await Utils.sleep(1500);
let callback = (indexEvent) => {
console.info("testTabs_1300 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.ACTION).assertEqual(true);
}
let indexEvent = {
eventId: 88,
priority: events_emitter.EventPriority.LOW
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("testTabs_1300 on events_emitter err : " + JSON.stringify(err));
}
console.info("testTabs_1300 click result is: " + JSON.stringify(sendEventByKey('tabContent1',10,"")));
await Utils.sleep(1000);
console.info('testTabs_1300 END');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/
general-properties/RotationGestureJsunit
.test.ets
→
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/
TapGesture
.test.ets
浏览文件 @
bdd5ff9b
// @ts-nocheck
/**
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
...
@@ -12,85 +13,69 @@
...
@@ -12,85 +13,69 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
import router from '@system.router';
import Utils from '../Utils';
import events_emitter from '@ohos.events.emitter';
import events_emitter from '@ohos.events.emitter';
import Utils from './Utils';
export default function rotationGestureJsUnit() {
export default function longPressGestureJsunit() {
describe('rotationGestureTest', function () {
describe('tapGestureTest', function () {
var x_value;
var y_value;
beforeEach(async function (done) {
beforeEach(async function (done) {
console.info("tapGesture beforeEach start");
let options = {
let options = {
uri: 'pages/
general-properties/rotation
Gesture',
uri: 'pages/
tap
Gesture',
}
}
try {
try {
router.clear();
router.clear();
let pages = router.getState();
let pages = router.getState();
console.info("get
rotationGesture state success
" + JSON.stringify(pages));
console.info("get
tapGesture state pages:
" + JSON.stringify(pages));
if (!("
rotation
Gesture" == pages.name)) {
if (!("
longPress
Gesture" == pages.name)) {
console.info("get
rotationGesture state name
" + JSON.stringify(pages.name));
console.info("get
tapGesture state pages.name:
" + JSON.stringify(pages.name));
let result = await router.push(options);
let result = await router.push(options);
await Utils.sleep(
1
000);
await Utils.sleep(
2
000);
console.info("push
rotationGesture page result
" + JSON.stringify(result));
console.info("push
tapGesture page result:
" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push
rotationGesture page error
" + JSON.stringify(result));
console.error("push
tapGesture page error:
" + JSON.stringify(result));
}
}
done()
done()
});
});
afterEach(async function () {
afterEach(async function () {
await Utils.sleep(1000);
await Utils.sleep(1000);
console.info("rotationGesture after each called");
console.info("tapGesture after each called");
});
it('rotationGestureTest_0100', 0, async function (done) {
console.info('rotationGestureTest_0100 START');
let strJson = getInspectorByKey('gesture');
console.info("rotationGestureTest_0100 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("rotationGestureTest_0100 component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Flex');
console.info('rotationGestureTest_0100 END');
done();
});
});
it('rotationGestureTest_0200', 0, async function (done) {
it('testTapGesture01', 0, async function (done) {
console.info('rotationGestureTest_0200 START');
let rect = await Utils.getComponentRect('gesture')
console.info("rotationGestureTest_0200 rectInfo is " + JSON.stringify(rect));
x_value = rect.left + (rect.right - rect.left) / 20
y_value = rect.top + (rect.bottom - rect.top) / 20
console.info("rotationGestureTest_0200 onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value);
let point: TouchObject = {
id: 2,
x: x_value,
y: y_value,
type: TouchType.Down,
}
await Utils.sleep(1000)
await Utils.sleep(1000)
let rect = await Utils.getComponentRect('tapGesture')
console.info("[testTapGesture01] rectInfo is " + JSON.stringify(rect));
let x_value = rect.left + (rect.right - rect.left) / 2;
let y_value = rect.top + (rect.bottom - rect.top) / 2;
let x_value_two = rect.left + (rect.right - rect.left) / 20;
let y_value_two = rect.top + (rect.bottom - rect.top) / 20;
console.info("[testTapGesture01] onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value);
let point: TouchObject = { id: 1, x: x_value, y: y_value, type: TouchType.Move}
let point2: TouchObject = { id: 2, x: x_value_two, y: y_value_two, type: TouchType.Move}
var callback = (eventData) => {
var callback = (eventData) => {
console.info("
rotationGestureTest_0200
get event state result is: " + JSON.stringify(eventData));
console.info("
[testTapGesture01]
get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual(true)
expect(eventData.data.ACTION).assertEqual(true)
expect(eventData.data.EVENT_TYPE).assertEqual('Down')
}
}
var innerEvent = {
var innerEvent = {
eventId:
56
,
eventId:
82
,
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
}
}
try {
try {
events_emitter.on(innerEvent, callback)
events_emitter.on(innerEvent, callback)
} catch (err) {
} catch (err) {
console.info("
rotationGestureTest_0200
on events_emitter err : " + JSON.stringify(err));
console.info("
[testTapGesture01]
on events_emitter err : " + JSON.stringify(err));
}
}
console.info('rotationGestureTest_0200 testSendTouchEvent ' + sendTouchEvent(point));
console.info('testTapGesture01 sendTouchEvent one:' + sendTouchEvent(point));
console.info('testTapGesture01 sendTouchEvent two:' + sendTouchEvent(point2));
await Utils.sleep(1000)
await Utils.sleep(1000)
console.info('
rotationGestureTest_0200
END');
console.info('
[testClickEvent001] testSendTouchEvent
END');
done();
done();
});
});
})
})
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 router from '@system.router';
import events_emitter from '@ohos.events.emitter';
import Utils from './Utils';
export default function textJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info("text beforeEach start");
let options = {
uri: 'pages/text',
}
try {
router.clear();
let pages = router.getState();
console.info("get text state pages:" + JSON.stringify(pages));
if (!("text" == pages.name)) {
console.info("get text state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push text page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push text page error:" + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("text after each called");
});
it('testText_0100', 0, async function (done) {
console.info('testText_0100 START');
let strJson = getInspectorByKey('text');
console.info("testText_0100 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("testText_0100 component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontSize).assertEqual('9.000000fp');
console.info('testText_0100 END');
done();
});
it('testText_0200', 0, async function (done) {
console.info('testText_0200 START');
try {
let eventData = {
data: {
"fontSize": "10",
}
}
let indexEvent = {
eventId: 60,
priority: events_emitter.EventPriority.LOW
}
console.info("testText_0200 start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("testText_0200 change component data error: " + err.message);
}
await Utils.sleep(4000);
let strJsonNew = getInspectorByKey('text');
let objNew = JSON.parse(strJsonNew);
console.info("testText_0200 component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.fontSize).assertEqual('10.000000fp');
console.info('testText_0200 END');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 router from '@system.router';
import events_emitter from '@ohos.events.emitter';
import Utils from '../Utils';
export default function PanGestureJsunit() {
describe('appInfoTest', function () {
var x_value;
var y_value;
beforeEach(async function (done) {
console.info("PanGesture beforeEach start");
let options = {
uri: 'pages/general-properties/PanGesture',
}
try {
router.clear();
let pages = router.getState();
console.info("get PanGesture state pages:" + JSON.stringify(pages));
if (!("PanGesture" == pages.name)) {
console.info("get PanGesture state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push PanGesture page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push PanGesture page error:" + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("PanGesture after each called");
});
it('testPanGesture01', 0, async function (done) {
console.info('[testPanGesture01] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('PanGesture');
let obj = JSON.parse(strJson);
console.info("[testPanGesture01] obj is: " + JSON.stringify(obj));
console.info('[testPanGesture01] END');
done();
});
it('testPanGesture02', 0, async function (done) {
console.info('[testPanGesture02] START');
try {
var eventData = {
data: {
"touchable": true,
}
}
var innerEvent = {
eventId: 140,
priority: events_emitter.EventPriority.LOW
}
console.info("[testPanGesture02] start to publish emit:" + JSON.stringify(eventData.data));
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testPanGesture02] change component data error: " + err.message);
}
await Utils.sleep(1000);
console.info('[testPanGesture02] END');
done();
});
it('testPanGesture03', 0, async function (done) {
let rect = await Utils.getComponentRect('PanGesture')
console.info("[testPanGesture03] rectInfo is " + JSON.stringify(rect));
x_value = rect.left + (rect.right - rect.left) / 10
y_value = rect.top + (rect.bottom - rect.top) / 10
console.info("[testPanGesture03] onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value);
let point: TouchObject = {
id: 1,
x: x_value,
y: y_value,
type: TouchType.Move,
}
var callbackTwo = (eventData) => {
console.info("[testPanGesture03] get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual(true)
expect(eventData.data.EVENT_TYPE).assertEqual('Move')
}
var innerEventTwo = {
eventId: 85,
priority: events_emitter.EventPriority.LOW
}
try {
events_emitter.on(innerEventTwo, callbackTwo)
} catch (err) {
console.info("[testPanGesture03] on events_emitter err : " + JSON.stringify(err));
}
console.info('[testPanGesture03] testSendTouchEvent ' + sendTouchEvent(point));
await Utils.sleep(1000)
console.info('[testPanGesture03] END');
done();
});
})
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets
0 → 100755
浏览文件 @
bdd5ff9b
// @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 router from '@system.router';
import events_emitter from '@ohos.events.emitter';
import Utils from '../Utils';
export default function ResponseRegionJsunit() {
describe('appInfoTest', function () {
var x_value;
var y_value;
beforeEach(async function (done) {
console.info("ResponseRegion beforeEach start");
let options = {
uri: 'pages/general-properties/ResponseRegion',
}
try {
router.clear();
let pages = router.getState();
console.info("get ResponseRegion state pages:" + JSON.stringify(pages));
if (!("ResponseRegion" == pages.name)) {
console.info("get ResponseRegion state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push ResponseRegion page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push ResponseRegion page error:" + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("ResponseRegion after each called");
});
it('testResponseRegion01', 0, async function (done) {
console.info('[testResponseRegion01] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('region');
let obj = JSON.parse(strJson);
console.info("[testResponseRegion01] obj is: " + JSON.stringify(obj));
console.info('[testResponseRegion01] END');
done();
});
it('testResponseRegion02', 0, async function (done) {
console.info('[testResponseRegion02] START');
try {
var eventData = {
data: {
"touchable": true,
}
}
var innerEvent = {
eventId: 120,
priority: events_emitter.EventPriority.LOW
}
console.info("[testResponseRegion02] start to publish emit:" + JSON.stringify(eventData.data));
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testResponseRegion02] change component data error: " + err.message);
}
await Utils.sleep(1000);
console.info('[testResponseRegion02] END');
done();
});
it('testResponseRegion03', 0, async function (done) {
let rect = await Utils.getComponentRect('region')
console.info("[testResponseRegion03] rectInfo is " + JSON.stringify(rect));
x_value = rect.left + (rect.right - rect.left) / 10
y_value = rect.top + (rect.bottom - rect.top) / 10
console.info("[testResponseRegion03] onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value);
let point: TouchObject = {
id: 1,
x: x_value,
y: y_value,
type: TouchType.Down,
}
var callbackTwo = (eventData) => {
console.info("[testResponseRegion03] get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual(true)
expect(eventData.data.EVENT_TYPE).assertEqual('Down')
}
var innerEventTwo = {
eventId: 121,
priority: events_emitter.EventPriority.LOW
}
try {
events_emitter.on(innerEventTwo, callbackTwo)
} catch (err) {
console.info("[testResponseRegion03] on events_emitter err : " + JSON.stringify(err));
}
console.info('[testResponseRegion03] testSendTouchEvent ' + sendTouchEvent(point));
await Utils.sleep(1000)
console.info('[testResponseRegion03] END');
done();
});
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录