Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
9d65c217
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看板
未验证
提交
9d65c217
编写于
3月 01, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 01, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2114 add ace component
Merge pull request !2114 from tomatoDevboy/master
上级
00f6882e
89d49bcb
变更
70
展开全部
隐藏空白更改
内联
并排
Showing
70 changed file
with
3440 addition
and
227 deletion
+3440
-227
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets
...component/entry/src/main/ets/MainAbility/pages/canvas.ets
+105
-3
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas2.ets
...omponent/entry/src/main/ets/MainAbility/pages/canvas2.ets
+58
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas3.ets
...omponent/entry/src/main/ets/MainAbility/pages/canvas3.ets
+46
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/column.ets
...component/entry/src/main/ets/MainAbility/pages/column.ets
+41
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/motionPath.ets
...onent/entry/src/main/ets/MainAbility/pages/motionPath.ets
+102
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/parallelGesture.ets
.../entry/src/main/ets/MainAbility/pages/parallelGesture.ets
+55
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/priorityGesture.ets
.../entry/src/main/ets/MainAbility/pages/priorityGesture.ets
+54
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rating.ets
...component/entry/src/main/ets/MainAbility/pages/rating.ets
+91
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets
...onent/entry/src/main/ets/MainAbility/pages/scrollCode.ets
+141
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/shape.ets
..._component/entry/src/main/ets/MainAbility/pages/shape.ets
+99
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets
...s_component/entry/src/main/ets/MainAbility/pages/span.ets
+61
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets
...s_component/entry/src/main/ets/MainAbility/pages/text.ets
+3
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets
...component/entry/src/main/ets/MainAbility/pages/toggle.ets
+73
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets
...onent/entry/src/main/ets/MainAbility/pages/transition.ets
+63
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets
...ntry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets
+146
-146
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AppearJsunit.test.ets
...entry/src/main/ets/MainAbility/test/AppearJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AreaChangeJsunit.test.ets
...y/src/main/ets/MainAbility/test/AreaChangeJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets
.../entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets
...entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas2Jsunit.test.ets
...ntry/src/main/ets/MainAbility/test/Canvas2Jsunit.test.ets
+56
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas3Jsunit.test.ets
...ntry/src/main/ets/MainAbility/test/Canvas3Jsunit.test.ets
+56
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets
...entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets
+1
-6
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ColumnJsunit.test.ets
...entry/src/main/ets/MainAbility/test/ColumnJsunit.test.ets
+58
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets
...entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets
+200
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets
...ntry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnableJsunit.test.ets
...entry/src/main/ets/MainAbility/test/EnableJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GaugeJsunit.test.ets
.../entry/src/main/ets/MainAbility/test/GaugeJsunit.test.ets
+83
-9
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridContainerJsunit.test.ets
...rc/main/ets/MainAbility/test/GridContainerJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets
...t/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets
...mponent/entry/src/main/ets/MainAbility/test/List.test.ets
+27
-2
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListJsunit.test.ets
...t/entry/src/main/ets/MainAbility/test/ListJsunit.test.ets
+159
-15
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets
...y/src/main/ets/MainAbility/test/LongPressGesture.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets
...y/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets
+103
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OverlayJsunit.test.ets
...ntry/src/main/ets/MainAbility/test/OverlayJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets
.../main/ets/MainAbility/test/ParallelGestureJsunit.test.ets
+76
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets
.../main/ets/MainAbility/test/PriorityGestureJsunit.test.ets
+75
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets
...try/src/main/ets/MainAbility/test/ProgressJsunit.test.ets
+2
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets
...entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets
...entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets
+221
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets
...y/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets
+167
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets
.../entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets
+670
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets
...t/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets
+97
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/StepperJsunit.test.ets
...ntry/src/main/ets/MainAbility/test/StepperJsunit.test.ets
+2
-2
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SwiperJsunit.test.ets
...entry/src/main/ets/MainAbility/test/SwiperJsunit.test.ets
+2
-2
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets
...src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets
...t/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets
+2
-2
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TapGesture.test.ets
...t/entry/src/main/ets/MainAbility/test/TapGesture.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets
...t/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets
+21
-5
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets
...entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets
+108
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets
...y/src/main/ets/MainAbility/test/TransitionJsunit.test.ets
+83
-0
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets
...entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BackgroundJsunit.test.ets
...Ability/test/general-properties/BackgroundJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BorderJsunit.test.ets
...MainAbility/test/general-properties/BorderJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ClickEventJsunit.test.ets
...Ability/test/general-properties/ClickEventJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ColorGradientJsunit.test.ets
...lity/test/general-properties/ColorGradientJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/FlexJsunit.test.ets
...s/MainAbility/test/general-properties/FlexJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/GridSettingsJsunit.test.ets
...ility/test/general-properties/GridSettingsJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ImageEffectsJsunit.test.ets
...ility/test/general-properties/ImageEffectsJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/LayoutConstraintsJsunit.test.ets
.../test/general-properties/LayoutConstraintsJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/OpacitySettingJsunit.test.ets
...ity/test/general-properties/OpacitySettingJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets
...Ability/test/general-properties/PanGestureJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PositionSettingJsunit.test.ets
...ty/test/general-properties/PositionSettingJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets
...ity/test/general-properties/ResponseRegionJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ShapeClippingJsunit.test.ets
...lity/test/general-properties/ShapeClippingJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/SizeSettingJsunit.test.ets
...bility/test/general-properties/SizeSettingJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TextStyleJsunit.test.ets
...nAbility/test/general-properties/TextStyleJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TouchAbleJsunit.test.ets
...nAbility/test/general-properties/TouchAbleJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TouchJsunit.test.ets
.../MainAbility/test/general-properties/TouchJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TransFormJsunit.test.ets
...nAbility/test/general-properties/TransFormJsunit.test.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/VisibilityJsunit.test.ets
...Ability/test/general-properties/VisibilityJsunit.test.ets
+1
-1
未找到文件。
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas.ets
浏览文件 @
9d65c217
...
@@ -21,6 +21,7 @@ struct CanvasExample {
...
@@ -21,6 +21,7 @@ struct CanvasExample {
private scroller: Scroller = new Scroller();
private scroller: Scroller = new Scroller();
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
build() {
build() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) {
Scroll(this.scroller) {
Scroll(this.scroller) {
...
@@ -67,9 +68,22 @@ struct CanvasExample {
...
@@ -67,9 +68,22 @@ struct CanvasExample {
this.createImageData();
this.createImageData();
this.createImageDataByImageData();
this.createImageDataByImageData();
this.getImageData();
this.getImageData();
this.putImageData();
this.createLinearGradient();
this.createRadialGradient();
this.restore();
this.save();
this.addPath();
this.lineDash();
this.toDataURL();
this.getWidth();
this.getHeight();
this.fill();
this.textMetrics();
this.getBitImageSize();
})
})
.key('canvas1')
.key('canvas1')
}.width('100%').height('
40
0%')
}.width('100%').height('
35
0%')
}.scrollable(ScrollDirection.Vertical).scrollBar(BarState.On)
}.scrollable(ScrollDirection.Vertical).scrollBar(BarState.On)
.scrollBarColor(Color.Gray).scrollBarWidth(10)
.scrollBarColor(Color.Gray).scrollBarWidth(10)
}
}
...
@@ -228,6 +242,11 @@ struct CanvasExample {
...
@@ -228,6 +242,11 @@ struct CanvasExample {
this.context.imageSmoothingEnabled = false;
this.context.imageSmoothingEnabled = false;
this.context.drawImage( img, 30, 950, 160, 100);
this.context.drawImage( img, 30, 950, 160, 100);
}
}
imageSmoothingQuality() {
let img = new ImageBitmap('/images/img.jpeg');
this.context.imageSmoothingQuality('high');
this.context.drawImage( img, 30, 950, 160, 100);
}
fillRect() {
fillRect() {
this.context.fillRect(10, 1080, 80, 80);
this.context.fillRect(10, 1080, 80, 80);
}
}
...
@@ -244,7 +263,7 @@ struct CanvasExample {
...
@@ -244,7 +263,7 @@ struct CanvasExample {
this.context.fillText("Hello World!", 120, 1200);
this.context.fillText("Hello World!", 120, 1200);
}
}
strokeText() {
strokeText() {
this.context.font = '20px sans-serif'
this.context.font = '20px sans-serif'
;
this.context.strokeText("Hello World!", 260, 1195);
this.context.strokeText("Hello World!", 260, 1195);
}
}
measureText() {
measureText() {
...
@@ -320,6 +339,13 @@ struct CanvasExample {
...
@@ -320,6 +339,13 @@ struct CanvasExample {
this.context.fillRect(0, 1650, 100, 100);
this.context.fillRect(0, 1650, 100, 100);
this.context.setTransform(1, 0, 0, 1, 0, 0);
this.context.setTransform(1, 0, 0, 1, 0, 0);
}
}
getTransform() {
let data = this.context.getTransform();
console.info("[canvas] get transform----" + data);
}
resetTransform() {
this.context.resetTransform();
}
translate() {
translate() {
this.context.fillRect(180, 1650, 50, 50);
this.context.fillRect(180, 1650, 50, 50);
this.context.translate(50, 50);
this.context.translate(50, 50);
...
@@ -327,7 +353,7 @@ struct CanvasExample {
...
@@ -327,7 +353,7 @@ struct CanvasExample {
}
}
drawImage() {
drawImage() {
let img = new ImageBitmap('/images/img.jpeg');
let img = new ImageBitmap('/images/img.jpeg');
this.context.drawImage(img, 0, 0, 500, 500, 0, 1780,
300, 15
0);
this.context.drawImage(img, 0, 0, 500, 500, 0, 1780,
200, 10
0);
}
}
createImageData() {
createImageData() {
let imageData = this.context.createImageData(100, 100);
let imageData = this.context.createImageData(100, 100);
...
@@ -342,4 +368,80 @@ struct CanvasExample {
...
@@ -342,4 +368,80 @@ struct CanvasExample {
let imageData = this.context.getImageData(10, 10, 80, 80);
let imageData = this.context.getImageData(10, 10, 80, 80);
console.info("[canvas] get image data-----" + JSON.stringify(imageData));
console.info("[canvas] get image data-----" + JSON.stringify(imageData));
}
}
putImageData() {
let imageData = this.context.createImageData(80, 80);
for (var i = 0; i < imageData.data.length; i += 4) {
imageData.data[i + 0] = 255;
imageData.data[i + 1] = 0;
imageData.data[i + 2] = 255;
imageData.data[i + 3] = 255;
}
this.context.putImageData(imageData, 250, 1660);
}
createLinearGradient() {
let grad = this.context.createLinearGradient(50, 1900, 150, 2000);
grad.addColorStop(0.0, 'red');
grad.addColorStop(0.5, 'white');
grad.addColorStop(1.0, 'green');
this.context.fillStyle = grad;
this.context.fillRect(10, 1900, 150, 150);
}
createRadialGradient() {
let grad = this.context.createRadialGradient(280, 1970, 40, 280, 1970, 80);
grad.addColorStop(0.0, 'red');
grad.addColorStop(0.5, 'white');
grad.addColorStop(1.0, 'green');
this.context.fillStyle = grad;
this.context.fillRect(200, 1900, 150, 150);
this.context.closePath();
}
restore() {
this.context.restore();
}
save() {
this.context.save();
}
addPath() {
let path2Da = new Path2D("M250 150 L150 350 L350 350 Z");
let path2Db = new Path2D();
path2Db.addPath(path2Da);
this.context.stroke(path2Db);
}
lineDash() {
this.context.beginPath();
this.context.arc(20, 2130, 50, 0, 6.28);
this.context.setLineDash([10, 20]);
this.context.stroke();
}
toDataURL() {
let dataUrl = this.context.toDataURL();
console.info("[canvas] canvas rendering context2D toDataURL-----" + JSON.stringify(dataUrl));
}
getWidth() {
let width = this.context.width;
console.info("[canvas] canvas width---" + width);
}
getHeight() {
let height = this.context.height;
console.info("[canvas] canvas height---" + height);
}
fill() {
this.context.beginPath();
this.context.rect(130, 2080, 100, 100);
this.context.fill('nonzero');
}
direction() {
this.context.direction('inherit');
}
textMetrics() {
this.context.font = '20px sans-serif';
this.context.fillText("Hello World!", 120, 2150);
let obj = this.context.measureText("Hello World!");
console.info("[canvas] textMetrics info---" + JSON.stringify(obj));
}
getBitImageSize() {
let img = new ImageBitmap('/images/img.jpeg');
let width = img.width;
let height = img.height;
}
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas2.ets
0 → 100755
浏览文件 @
9d65c217
/**
* 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 Canvas2Example {
private scroller: Scroller = new Scroller();
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, 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.transferFromImageBitmap();
this.offScreenToDataURL();
})
.key('canvas2')
}.width('100%').height('100%')
}.scrollable(ScrollDirection.Vertical).scrollBar(BarState.On)
.scrollBarColor(Color.Gray).scrollBarWidth(10)
}
.width('100%')
.height('100%')
}
onPageShow() {
}
transferFromImageBitmap() {
this.offContext.fillStyle = '#0000ff';
this.offContext.fillRect(20, 160, 150, 100);
let image = this.offContext.transferToImageBitmap();
this.context.transferFromImageBitmap(image);
}
offScreenToDataURL() {
let dataUrl = this.offContext.toDataURL();
console.info("[canvas] offContext canvas rendering context2D toDataURL-----" + JSON.stringify(dataUrl));
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/canvas3.ets
0 → 100755
浏览文件 @
9d65c217
/**
* 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 Canvas3Example {
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
build() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Start }) {
Column() {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffff00')
.onReady(() => {
this.rotate();
})
.key('canvas3')
}.width('100%').height('100%')
}
.width('100%')
.height('100%')
}
onPageShow() {
}
rotate() {
this.context.rotate(45 * Math.PI / 180);
this.context.fillRect(200, 20, 100, 100);
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/column.ets
0 → 100755
浏览文件 @
9d65c217
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct ColumnExample {
build() {
Column({ space: 5 }) {
Text('space').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column({ space: 5 }) {
Column().width('100%').height(50).backgroundColor(0xAFEEEE)
Column().width('100%').height(50).backgroundColor(0x00FFFF).key('column')
}.width('90%').height(107).border({ width: 1 })
Text('alignItems(Start)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.Start).width('90%').border({ width: 1 })
Text('alignItems(End)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.End).width('90%').border({ width: 1 })
}.width('100%').padding({ top: 5 })
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/motionPath.ets
0 → 100755
浏览文件 @
9d65c217
/**
* 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 MotionPathExample {
@State offsetX: number = 0
@State offsetY: number = 0
@State toggle: boolean = true
@State rotatable: boolean = false
@State path:string='Mstart.x start.y L300 200 L300 500 Lend.x end.y'
@State fromX:number = 0
@State toY:number = 1
build() {
Column() {
Button('click me')
.key('button')
.motionPath({ path: this.path, from: this.fromX, to: this.toY, rotatable:this.rotatable })
.onClick(() => {
this.rotatable = true;
console.info('button rotate current action state is:' + this.rotatable);
try {
var backData = {
data: {
"ACTION": this.rotatable,
}
}
var backEvent = {
eventId: 2,
priority: events_emitter.EventPriority.LOW
}
console.info("button start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("button emit action state err: " + JSON.stringify(err.message))
}
animateTo({ duration: 4000, curve: Curve.Linear }, () => {
this.toggle = !this.toggle;
})
})
.backgroundColor(0x317aff)
Button('next')
.key('button1')
.onClick(() => {
try {
var backData = {
data: {
"fromX": this.fromX,
"toY": this.toY
}
}
var backEvent = {
eventId: 3,
priority: events_emitter.EventPriority.LOW
}
console.info("button1 position start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("button1 position emit action state err: " + JSON.stringify(err.message))
}
})
}
.key('motionPath')
.width('100%').height('100%').alignItems(this.toggle ? HorizontalAlign.Start : HorizontalAlign.Center)
}
onPageShow(){
console.info('motionPath page show called');
var stateChangeEvent = {
eventId:1,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent,this.stateChangeCallBack)
}
private stateChangeCallBack = (eventData) =>{
if(eventData != null){
console.info('motionPath page state change called:' + JSON.stringify(eventData));
if(eventData.data.fromX != null){
this.fromX == parseInt(eventData.data.fromX);
}
if(eventData.data.toY != null){
this.toY == parseInt(eventData.data.toY);
}
}
}
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/parallelGesture.ets
0 → 100755
浏览文件 @
9d65c217
// @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 GestureSettingsExample {
@State value: string = ''
build() {
Column() {
Text('Click\n' + this.value).gesture(TapGesture()
.onAction(() => {
this.value = 'gesture onAction'
try {
var backData = {
data: {
"value": this.value
}
}
var backEvent = {
eventId: 199,
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')
}
.key('parallelGesture')
.height(200).width(300).padding(60).border({ width: 1 }).margin(30)
.priorityGesture(
TapGesture()
.onAction(() => {
this.value = 'parallelGesture onAction'
}), GestureMask.IgnoreInternal
)
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/priorityGesture.ets
0 → 100755
浏览文件 @
9d65c217
// @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 GestureSettingsExample {
@State value: string = ''
build() {
Column() {
Text('Click\n' + this.value).gesture(TapGesture()
.onAction(() => {
this.value = 'gesture onAction'
try {
var backData = {
data: {
"value": this.value
}
}
var backEvent = {
eventId: 111,
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')
}
.height(200).width(300).padding(60).border({ width: 1 }).margin(30)
.priorityGesture(
TapGesture()
.onAction(() => {
this.value = 'priorityGesture onAction'
}), GestureMask.IgnoreInternal
)
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/rating.ets
0 → 100755
浏览文件 @
9d65c217
/**
* 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 RatingExample {
@State rating: number = 1
@State indicator: boolean = false
private stateChangCallBack = (eventData) => {
console.info("rating page stateChangCallBack");
if (eventData != null) {
console.info("rating page state change called:" + JSON.stringify(eventData.data.rating));
if(eventData.data.rating != null) {
this.rating = eventData.data.rating;
}
}
}
onPageShow() {
console.info('rating page show called');
var stateChangeEvent = {
eventId: 440,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack)
var stateChangeEventTwo = {
eventId: 441,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventTwo, this.stateChangCallBack)
var stateChangeEventThree = {
eventId: 442,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventThree, this.stateChangCallBack)
var stateChangeEventFour = {
eventId: 443,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventFour, this.stateChangCallBack)
var stateChangeEventFive = {
eventId: 444,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventFive, this.stateChangCallBack)
var stateChangeEventSix = {
eventId: 444,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventSix , this.stateChangCallBack)
var stateChangeEventSeven = {
eventId: 445,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventSeven , this.stateChangCallBack)
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('current score is ' + this.rating).fontSize(20)
Rating({ rating: this.rating, indicator: this.indicator })
.stars(5).key('Rating')
.stepSize(0.5)
.onChange((value: number) => {
this.rating = value
})
}.width(350).height(200).padding(35)
}
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/scrollCode.ets
0 → 100755
浏览文件 @
9d65c217
// @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 scrollCode {
@State scrollable: ScrollDirection = ScrollDirection.Vertical;
@State scrollBar: BarState = BarState.On;
@State scrollBarColor: Color = "#FF0000FF";
@State scrollBarWidth: number = 30;
scroller: Scroller = new Scroller()
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("scrollCode page state change called:" + JSON.stringify(eventData));
var scrollableValue = eventData.data.scrollable;
console.info("scrollableValue:" + scrollableValue);
if (scrollableValue!= null && scrollableValue.length != 0) {
this.scrollable = scrollableValue;
console.info("this.scrollable:" + this.scrollable);
}else{
console.info("scrollableValue is null or empty " + scrollableValue);
}
var scrollBarValue = eventData.data.scrollBar;
console.info("scrollBarValue:" + scrollBarValue);
if (scrollBarValue!= null && scrollBarValue.length != 0) {
this.scrollBar = scrollBarValue;
console.info("this.scrollBar:" + this.scrollBar);
}else{
console.info("scrollBarValue is null or empty " + scrollBarValue);
}
var scrollBarColorValue = eventData.data.scrollBarColor;
console.info("scrollBarColorValue:" + scrollBarColorValue);
if (scrollBarColorValue!= null && scrollBarColorValue.length != 0) {
this.scrollBarColor = scrollBarColorValue;
console.info("this.scrollBarColor:" + this.scrollBarColor);
}else{
console.info("scrollBarColorValue is null or empty " + scrollBarColorValue);
}
var scrollBarWidthValue = eventData.data.scrollBarWidth;
console.info("scrollBarWidthValue:" + scrollBarWidthValue);
if (scrollBarWidthValue!= null && scrollBarWidthValue.length != 0) {
this.scrollBarWidth = scrollBarWidthValue;
console.info("this.scrollBarWidth:" + this.scrollBarWidth);
}else{
console.info("scrollBarWidthValue is null or empty " + scrollBarWidthValue);
}
} else {
console.info("scrollCode page color not change called:" + JSON.stringify(eventData));
}
}
onPageShow() {
console.info('scrollCode 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.stateChangCallBack);
var stateChangeEvent = {
eventId: 85,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
var stateChangeEvent = {
eventId: 95,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Stack({ alignContent: Alignment.TopStart }) {
Scroll(this.scroller) {
Column() {
ForEach(this.arr, (item) => {
Text(item.toString())
.width('90%').height(150).backgroundColor(0xFFFFFF)
.borderRadius(15).fontSize(16).textAlign(TextAlign.Center)
.margin({ top: 10 })
}, item => item)
}.width('100%')
}
.key("ScrollCode")
.scrollable(this.scrollable)
.scrollBar(this.scrollBar)
.scrollBarColor(this.scrollBarColor)
.scrollBarWidth(this.scrollBarWidth)
.onScroll((xOffset: number, yOffset: number) => {
console.info(xOffset + ' ' + yOffset)
})
.onScrollEdge((side: Edge) => {
console.info('To the edge')
})
.onScrollEnd(() => {
console.info('Scroll Stop')
})
Button('scroll 100')
.onClick(() => {
this.scroller.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset + 100 })
})
.margin({ top: 10, left: 20 })
Button('back top')
.onClick(() => {
this.scroller.scrollEdge(Edge.Top)
})
.margin({ top: 60, left: 20 })
Button('next page')
.onClick(() => {
this.scroller.scrollPage({ next: true })
})
.margin({ top: 110, left: 20 })
}.width('100%').height('100%').backgroundColor(0xDCDCDC)
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/shape.ets
0 → 100755
浏览文件 @
9d65c217
// @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 ShapeExample {
@State strokeDashOffset: numbert = 0;
@State strokeLineCap: LineCapStyle = LineCapStyle.Butt;
@State strokeLineJoin: LineJoinStyle = LineJoinStyle.Miter;
@State strokeMiterLimit: number = 4;
@State strokeOpacity: number = 1;
@State strokeWidth: number = 1;
@State antiAlias: boolean = true;
@State strokeDashArray: Array<Length> = [20];
@State fillOpacity: number = 0;
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("text page state change called:" + JSON.stringify(eventData));
if (eventData.data.strokeDashOffset != null) {
this.strokeDashOffset = parseInt(eventData.data.strokeDashOffset);
}
if (eventData.data.strokeLineCap != null) {
this.strokeLineCap = eventData.data.strokeLineCap;
}
if (eventData.data.strokeLineJoin != null) {
this.strokeLineJoin = eventData.data.strokeLineJoin;
}
if (eventData.data.strokeMiterLimit != null) {
this.strokeMiterLimit = parseInt(eventData.data.strokeMiterLimit);
}
if (eventData.data.strokeOpacity != null) {
this.strokeOpacity = parseInt(eventData.data.strokeOpacity);
}
if (eventData.data.fillOpacity != null) {
this.fillOpacity = parseInt(eventData.data.fillOpacity);
}
if (eventData.data.antiAlias != null) {
this.antiAlias = eventData.data.antiAlias;
}
if (eventData.data.strokeDashArrayOne != null) {
this.strokeDashArray[0] = parseInt(eventData.data.strokeDashArrayOne);
}
if (eventData.data.strokeDashArrayTwo != null) {
this.strokeDashArray[1] = parseInt(eventData.data.strokeDashArrayTwo);
}
if (eventData.data.strokeDashArrayThree != null) {
this.strokeDashArray[2] = parseInt(eventData.data.strokeDashArrayThree);
}
}
}
onPageShow() {
console.info('qrCode page show called');
var stateChangeEvent = {
eventId: 901,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Column({ space: 2 }) {
Text('basic').fontSize(30).fontColor(0xCCCCCC).width(320)
Shape() {
Rect().width(300).height(50)
Ellipse().width(300).height(50).offset({ x: 0, y: 60 })
Path().width(300).height(10).commands('M0 0 L900 0').offset({ x: 0, y: 120 })
}
.key('shape')
.viewPort({ x: -2, y: -2, width: 304, height: 130 })
.fill(0x317Af7)
.stroke(Color.Black)
.strokeDashArray(this.strokeDashArray)
.strokeDashOffset(this.strokeDashOffset)
.strokeLineCap(this.strokeLineCap)
.strokeLineJoin(this.strokeLineJoin)
.strokeMiterLimit(this.strokeMiterLimit)
.strokeOpacity(this.strokeOpacity)
.strokeWidth(this.strokeWidth)
.antiAlias(this.antiAlias)
.fillOpacity(this.fillOpacity)
}.width('100%').margin({ top: 15 })
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/span.ets
0 → 100755
浏览文件 @
9d65c217
// @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 SpanExample {
@State decorationValue:object={ type: TextDecorationType.None, color: Color.Red }
@State textCaseValue:TextCase=TextCase.Normal
@State fontSizeValue:number=40
private stateChangCallBack = (eventData) => {
console.info("span page state change called:" + JSON.stringify(eventData));
if (eventData != null) {
if (eventData.data.decorationValue != null) {
this.decorationValue = JSON.parse(eventData.data.decorationValue);
}
if (eventData.data.textCaseValue != null) {
this.textCaseValue = eventData.data.textCaseValue;
}
}
}
onPageShow() {
console.info('span page show called');
var stateChangeEvent = {
eventId: 40,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
var stateChangeEvent2 = {
eventId: 41,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent2, this.stateChangCallBack);
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Text('Basic Usage').fontSize(9).fontColor(0xCCCCCC)
Text() {
Span('This is the Span component').fontSize(this.fontSizeValue).textCase(this.textCaseValue)
.decoration(this.decorationValue).key('decoration')
}
}.width('100%').height(250).padding({ left: 35, right: 35, top: 35 })
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/text.ets
浏览文件 @
9d65c217
...
@@ -17,13 +17,15 @@ import events_emitter from '@ohos.emitter'
...
@@ -17,13 +17,15 @@ import events_emitter from '@ohos.emitter'
@Entry
@Entry
@Component
@Component
struct TextExample {
struct TextExample {
@State fontSize: number = 9
@State fontSize: number = 9
build() {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Text('lineHeight')
Text('lineHeight')
.fontSize(this.fontSize)
.fontSize(this.fontSize)
.fontColor(0xCCCCCC)
.fontColor(0xCCCCCC)
.key('text')
.key('text')
Image($rawfile('test.png'))
.key('image')
}
}
.height(600)
.height(600)
.width(350)
.width(350)
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/toggle.ets
0 → 100755
浏览文件 @
9d65c217
// @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 ToggleExample {
@State selectedColor : color = '#330A59F7';
@State toggleType : ToggleType = ToggleType.Button;
@State isOn : boolean = false;
onPageShow() {
console.info('[toggle] page show called');
var stateChangeEvent = {
eventId: 1011,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
private stateChangCallBack = (eventData) => {
console.info("[toggle] page stateChangCallBack");
if (eventData != null) {
console.info("[toggle] page state change called:" + JSON.stringify(eventData));
if(eventData.data.selectedColor != null) {
this.selectedColor = eventData.data.selectedColor;
}
if(eventData.data.toggleType != null) {
this.toggleType = eventData.data.toggleType;
}
if(eventData.data.isOn != null) {
this.isOn = eventData.data.isOn;
}
}
}
build() {
Column({ space: 10 }) {
Text('type: Button').fontSize(12).fontColor(0xcccccc).width('90%').key('button')
Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
Toggle({ type: this.toggleType, isOn: this.isOn }) {
Text('status button').padding({ left: 12, right: 12 })
}
.key('toggle')
.selectedColor(this.selectedColor)
.onChange((isOn: boolean) => {
console.info('Component status:' + isOn)
})
Toggle({ type: ToggleType.Button, isOn: true }) {
Text('status button').padding({ left: 12, right: 12 })
}
.selectedColor(0x39a2db)
.onChange((isOn: boolean) => {
console.info('Component status:' + isOn)
})
}
}.width('100%').padding(24)
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/transition.ets
0 → 100755
浏览文件 @
9d65c217
/**
* 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 TransitionExample {
@State btn1: boolean = false
@State show: string = "show"
@State onActionCalled: boolean = false
@State transitionTypeOne: TransitionType = TransitionType.Insert
@State transitionTypeTwo: TransitionType = TransitionType.Delete
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,}) {
Button(this.show).width(80).height(30).backgroundColor(0x317aff).margin({bottom:50}).key('button')
.onClick(() => {
this.onActionCalled = true;
try {
var backData = {
data: {
"btn1": this.btn1,
}
}
var backEvent = {
eventId: 333,
priority: events_emitter.EventPriority.LOW
}
console.info("transitionTest_0200 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("transitionTest_0200 emit action state err: " + JSON.stringify(err.message))
}
animateTo({ duration: 3000 }, () => {
this.btn1 = !this.btn1
if(this.btn1){
this.show = "hide"
}else{
this.show = "show"
}
})
})
if (this.btn1) {
Button() {
Image($r('app.media.bg')).width("80%").height(300).key('image')
}.transition({ type: this.transitionTypeOne, scale: {x:0,y:1.0} }).key('button1')
.transition({ type: this.transitionTypeTwo, scale: { x: 1.0, y: 0.0 } })
}
}.height(400).width("100%").padding({top:100})
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AnimateJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function animateJsunit() {
...
@@ -36,7 +36,7 @@ export default function animateJsunit() {
console.info("push animate page result:" + JSON.stringify(result));
console.info("push animate page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push animate page error:" +
JSON.stringify(result)
);
console.error("push animate page error:" +
err
);
}
}
done()
done()
});
});
...
@@ -46,151 +46,151 @@ export default function animateJsunit() {
...
@@ -46,151 +46,151 @@ export default function animateJsunit() {
console.info("animate after each called");
console.info("animate after each called");
});
});
//
it('animateTest_0100', 0, async function (done) {
it('animateTest_0100', 0, async function (done) {
//
console.info('animateTest_0100 START');
console.info('animateTest_0100 START');
//
await Utils.sleep(1500);
await Utils.sleep(1500);
//
let indexEvent = {
let indexEvent = {
//
eventId: 60,
eventId: 60,
//
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
//
}
}
//
let callback= (indexEvent) => {
let callback= (indexEvent) => {
//
console.info("animateTest_0100 get state result is: " + JSON.stringify(indexEvent))
console.info("animateTest_0100 get state result is: " + JSON.stringify(indexEvent))
//
except(indexEvent.data.duration).assertEqual('100')
except(indexEvent.data.duration).assertEqual('100')
//
}
}
//
try {
try {
//
events_emitter.on(indexEvent, callback);
events_emitter.on(indexEvent, callback);
//
} catch (err) {
} catch (err) {
//
console.info("animateTest_0100 on events_emitter err : " + JSON.stringify(err));
console.info("animateTest_0100 on events_emitter err : " + JSON.stringify(err));
//
}
}
//
console.info("animateTest_0100 click result is: " + JSON.stringify(sendEventByKey('button1',10,"")));
console.info("animateTest_0100 click result is: " + JSON.stringify(sendEventByKey('button1',10,"")));
//
await Utils.sleep(2000);
await Utils.sleep(2000);
//
console.info('animateTest_0100 END');
console.info('animateTest_0100 END');
//
done();
done();
//
});
});
//
//
it('animateTest_0200', 0, async function (done) {
it('animateTest_0200', 0, async function (done) {
//
console.info('animateTest_0200 START');
console.info('animateTest_0200 START');
//
await Utils.sleep(1500);
await Utils.sleep(1500);
//
let indexEvent = {
let indexEvent = {
//
eventId: 61,
eventId: 61,
//
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
//
}
}
//
let callback= (indexEvent) => {
let callback= (indexEvent) => {
//
console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
//
except(indexEvent.data.curve).assertEqual('Ease')
except(indexEvent.data.curve).assertEqual('Ease')
//
}
}
//
try {
try {
//
events_emitter.on(indexEvent, callback);
events_emitter.on(indexEvent, callback);
//
} catch (err) {
} catch (err) {
//
console.info("animateTest_0200 on events_emitter err : " + JSON.stringify(err));
console.info("animateTest_0200 on events_emitter err : " + JSON.stringify(err));
//
}
}
//
console.info("animateTest_0200 click result is: " + JSON.stringify(sendEventByKey('button2',10,"")));
console.info("animateTest_0200 click result is: " + JSON.stringify(sendEventByKey('button2',10,"")));
//
await Utils.sleep(2000);
await Utils.sleep(2000);
//
console.info('animateTest_0200 END');
console.info('animateTest_0200 END');
//
done();
done();
//
});
});
//
//
it('animateTest_0300', 0, async function (done) {
it('animateTest_0300', 0, async function (done) {
//
console.info('animateTest_0300 START');
console.info('animateTest_0300 START');
//
await Utils.sleep(1500);
await Utils.sleep(1500);
//
let indexEvent = {
let indexEvent = {
//
eventId: 62,
eventId: 62,
//
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
//
}
}
//
let callback= (indexEvent) => {
let callback= (indexEvent) => {
//
console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
//
except(indexEvent.data.iteration).assertEqual('1')
except(indexEvent.data.iteration).assertEqual('1')
//
}
}
//
try {
try {
//
events_emitter.on(indexEvent, callback);
events_emitter.on(indexEvent, callback);
//
} catch (err) {
} catch (err) {
//
console.info("animateTest_0300 on events_emitter err : " + JSON.stringify(err));
console.info("animateTest_0300 on events_emitter err : " + JSON.stringify(err));
//
}
}
//
console.info("animateTest_0300 click result is: " + JSON.stringify(sendEventByKey('button3',10,"")));
console.info("animateTest_0300 click result is: " + JSON.stringify(sendEventByKey('button3',10,"")));
//
await Utils.sleep(2000);
await Utils.sleep(2000);
//
console.info('animateTest_0300 END');
console.info('animateTest_0300 END');
//
done();
done();
//
});
});
//
//
it('animateTest_0400', 0, async function (done) {
it('animateTest_0400', 0, async function (done) {
//
console.info('animateTest_0400 START');
console.info('animateTest_0400 START');
//
await Utils.sleep(1500);
await Utils.sleep(1500);
//
let indexEvent = {
let indexEvent = {
//
eventId: 63,
eventId: 63,
//
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
//
}
}
//
let callback= (indexEvent) => {
let callback= (indexEvent) => {
//
console.info("animateTest_0400 get state result is: " + JSON.stringify(indexEvent))
console.info("animateTest_0400 get state result is: " + JSON.stringify(indexEvent))
//
except(indexEvent.data.tempo).assertEqual(1000)
except(indexEvent.data.tempo).assertEqual(1000)
//
}
}
//
try {
try {
//
events_emitter.on(indexEvent, callback);
events_emitter.on(indexEvent, callback);
//
} catch (err) {
} catch (err) {
//
console.info("animateTest_0400 on events_emitter err : " + JSON.stringify(err));
console.info("animateTest_0400 on events_emitter err : " + JSON.stringify(err));
//
}
}
//
console.info("animateTest_0400 click result is: " + JSON.stringify(sendEventByKey('button4',10,"")));
console.info("animateTest_0400 click result is: " + JSON.stringify(sendEventByKey('button4',10,"")));
//
await Utils.sleep(2000);
await Utils.sleep(2000);
//
console.info('animateTest_0400 END');
console.info('animateTest_0400 END');
//
done();
done();
//
});
});
//
//
it('animateTest_0500', 0, async function (done) {
it('animateTest_0500', 0, async function (done) {
//
console.info('animateTest_0500 START');
console.info('animateTest_0500 START');
//
await Utils.sleep(1500);
await Utils.sleep(1500);
//
let indexEvent = {
let indexEvent = {
//
eventId: 64,
eventId: 64,
//
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
//
}
}
//
let callback= (indexEvent) => {
let callback= (indexEvent) => {
//
console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
//
except(indexEvent.data.playmode).assertEqual('normal')
except(indexEvent.data.playmode).assertEqual('normal')
//
}
}
//
try {
try {
//
events_emitter.on(indexEvent, callback);
events_emitter.on(indexEvent, callback);
//
} catch (err) {
} catch (err) {
//
console.info("animateTest_0500 on events_emitter err : " + JSON.stringify(err));
console.info("animateTest_0500 on events_emitter err : " + JSON.stringify(err));
//
}
}
//
console.info("animateTest_0500 click result is: " + JSON.stringify(sendEventByKey('button5',10,"")));
console.info("animateTest_0500 click result is: " + JSON.stringify(sendEventByKey('button5',10,"")));
//
await Utils.sleep(2000);
await Utils.sleep(2000);
//
console.info('animateTest_0500 END');
console.info('animateTest_0500 END');
//
done();
done();
//
});
});
//
//
it('animateTest_0600', 0, async function (done) {
it('animateTest_0600', 0, async function (done) {
//
console.info('animateTest_0500 START');
console.info('animateTest_0500 START');
//
try {
try {
//
let eventData = {
let eventData = {
//
data: {
data: {
//
"duration":'2000'
"duration":'2000'
//
}
}
//
}
}
//
let indexEventOne = {
let indexEventOne = {
//
eventId: 65,
eventId: 65,
//
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
//
}
}
//
console.info("animateTest_0600 start to publish emit");
console.info("animateTest_0600 start to publish emit");
//
events_emitter.emit(indexEventOne, eventData);
events_emitter.emit(indexEventOne, eventData);
//
} catch (err) {
} catch (err) {
//
console.log("animateTest_0600 change component data error: " + err.message);
console.log("animateTest_0600 change component data error: " + err.message);
//
}
}
//
let indexEvent = {
let indexEvent = {
//
eventId: 60,
eventId: 60,
//
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
//
}
}
//
let callback= (indexEvent) => {
let callback= (indexEvent) => {
//
console.info("animateTest_0600 get state result is: " + JSON.stringify(indexEvent))
console.info("animateTest_0600 get state result is: " + JSON.stringify(indexEvent))
//
except(indexEvent.data.duration).assertEqual('2000')
except(indexEvent.data.duration).assertEqual('2000')
//
}
}
//
try {
try {
//
events_emitter.on(indexEvent, callback);
events_emitter.on(indexEvent, callback);
//
} catch (err) {
} catch (err) {
//
console.info("animateTest_0600 on events_emitter err : " + JSON.stringify(err));
console.info("animateTest_0600 on events_emitter err : " + JSON.stringify(err));
//
}
}
//
console.info("animateTest_0600 click result is: " + JSON.stringify(sendEventByKey('button1',10 ,"")));
console.info("animateTest_0600 click result is: " + JSON.stringify(sendEventByKey('button1',10 ,"")));
//
await Utils.sleep(2000);
await Utils.sleep(2000);
//
console.info('animateTest_0600 END');
console.info('animateTest_0600 END');
//
done();
done();
//
});
});
it('animateTest_0700', 0, async function (done) {
it('animateTest_0700', 0, async function (done) {
console.info('animateTest_0700 START');
console.info('animateTest_0700 START');
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AppearJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -37,7 +37,7 @@ export default function appearJsunit() {
...
@@ -37,7 +37,7 @@ export default function appearJsunit() {
console.info("push appear page result: " + JSON.stringify(result));
console.info("push appear page result: " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push appear page error: " +
JSON.stringify(result)
);
console.error("push appear page error: " +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/AreaChangeJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function areaChangeJsunit() {
...
@@ -35,7 +35,7 @@ export default function areaChangeJsunit() {
console.info("push areaChange page success " + JSON.stringify(result));
console.info("push areaChange page success " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push areaChange page error
" + JSON.stringify(result)
);
console.error("push areaChange page error
: " + err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/BadgeJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -37,7 +37,7 @@ export default function badgeJsunit() {
...
@@ -37,7 +37,7 @@ export default function badgeJsunit() {
console.info("push badge page result: " + JSON.stringify(result));
console.info("push badge page result: " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push badge page error: " +
JSON.stringify(result)
);
console.error("push badge page error: " +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ButtonJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -37,7 +37,7 @@ export default function buttonJsunit() {
...
@@ -37,7 +37,7 @@ export default function buttonJsunit() {
console.info("push button page result: " + JSON.stringify(result));
console.info("push button page result: " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push button page error: " +
JSON.stringify(result)
);
console.error("push button page error: " +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas2Jsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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 Utils from './Utils';
export default function canvasJsunit() {
describe('canvasTest', function () {
beforeEach(async function (done) {
console.info("canvas beforeEach start");
let options = {
uri: 'pages/canvas2',
}
try {
router.clear();
let pages = router.getState();
console.info("get canvas2 state pages:" + JSON.stringify(pages));
if (!("canvas2" == pages.name)) {
console.info("get canvas2 state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push canvas2 page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push canvas page error:" + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("canvas2 after each called");
});
it('testCanvas01', 0, async function (done) {
console.info('[testCanvas01] START');
await Utils.sleep(1000);
console.info('[testCanvas01]----------- START');
console.info('testCanvas01 END');
done();
});
});
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/Canvas3Jsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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 Utils from './Utils';
export default function canvasJsunit() {
describe('canvas3Test', function () {
beforeEach(async function (done) {
console.info("canvas3 beforeEach start");
let options = {
uri: 'pages/canvas3',
}
try {
router.clear();
let pages = router.getState();
console.info("get canvas3 state pages:" + JSON.stringify(pages));
if (!("canvas3" == pages.name)) {
console.info("get canvas3 state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push canvas3 page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push canvas3 page error:" + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("canvas3 after each called");
});
it('testCanvas01', 0, async function (done) {
console.info('[testCanvas01] START');
await Utils.sleep(1000);
console.info('[testCanvas01]----------- START');
console.info('testCanvas01 END');
done();
});
});
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CanvasJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
*/
*/
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 events_emitter from '@ohos.emitter';
import Utils from './Utils';
import Utils from './Utils';
export default function canvasJsunit() {
export default function canvasJsunit() {
...
@@ -36,7 +35,7 @@ export default function canvasJsunit() {
...
@@ -36,7 +35,7 @@ export default function canvasJsunit() {
console.info("push canvas page result:" + JSON.stringify(result));
console.info("push canvas page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push canvas page error:" +
JSON.stringify(result)
);
console.error("push canvas page error:" +
err
);
}
}
done()
done()
});
});
...
@@ -50,10 +49,6 @@ export default function canvasJsunit() {
...
@@ -50,10 +49,6 @@ export default function canvasJsunit() {
console.info('[testCanvas01] START');
console.info('[testCanvas01] START');
await Utils.sleep(1000);
await Utils.sleep(1000);
console.info('[testCanvas01]----------- START');
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');
console.info('testCanvas01 END');
done();
done();
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ColumnJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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 Utils from './Utils';
export default function columnJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info("column beforeEach start");
let options = {
uri: 'pages/column',
}
try {
router.clear();
let pages = router.getState();
console.info("get column state pages:" + JSON.stringify(pages));
if (!("column" == pages.name)) {
console.info("get column state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push column page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push column page error:" + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("column after each called");
});
it('testColumn01', 0, async function (done) {
console.info('[testColumn01] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('column');
let obj = JSON.parse(strJson);
console.info("[testColumn01] obj is: " + JSON.stringify(obj));
console.info('[testColumn01] END');
done();
});
})
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/CommonJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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"
export default function commonJsunit() {
describe('commonTest', function () {
it('commonTest_0100', 0, async function (done) {
console.info('commonTest_0100 START');
var a = 90;
var b = vp2px(a);
console.info('commonTest_0100 vp2px result:' + b);
expect(b == 90).assertTrue();
console.info('commonTest_0100 END');
done();
});
it('commonTest_0200', 0, async function (done) {
console.info('commonTest_0200 START');
var a = -90;
var b = vp2px(a);
console.info('commonTest_0200 vp2px result:' + b);
expect(b == -90).assertTrue();
console.info('commonTest_0200 END');
done();
});
it('commonTest_0300', 0, async function (done) {
console.info('commonTest_0300 START');
var a = '30';
var b = vp2px(a);
console.info('commonTest_0300 vp2px result:' + b);
expect(b == undefined).assertTrue();
console.info('commonTest_0300 END');
done();
});
it('commonTest_0400', 0, async function (done) {
console.info('commonTest_0400 START');
var a = 80;
var b = px2vp(a);
console.info('commonTest_0400 px2vp result:' + b);
expect(b == 80).assertTrue();
console.info('commonTest_0400 END');
done();
});
it('commonTest_0500', 0, async function (done) {
console.info('commonTest_0500 START');
var a = -800000000;
var b = px2vp(a);
console.info('commonTest_0500 px2vp result:' + b);
expect(b == -800000000).assertTrue();
console.info('commonTest_0500 END');
done();
});
it('commonTest_0600', 0, async function (done) {
console.info('commonTest_0600 START');
var a = '80';
var b = px2vp(a);
console.info('commonTest_0600 px2vp result:' + b);
expect(b == undefined).assertTrue();
console.info('commonTest_0600 END');
done();
});
it('commonTest_0700', 0, async function (done) {
console.info('commonTest_0700 START');
var a = 70;
var b = fp2px(a);
console.info('commonTest_0700 fp2px result:' + b);
expect(b == 70).assertTrue();
console.info('commonTest_0700 END');
done();
});
it('commonTest_0800', 0, async function (done) {
console.info('commonTest_0800 START');
var a = -7000000000000;
var b = fp2px(a);
console.info('commonTest_0800 fp2px result:' + b);
expect(b == -2147483648).assertTrue();
console.info('commonTest_0800 END');
done();
});
it('commonTest_0900', 0, async function (done) {
console.info('commonTest_0900 START');
var a = '70';
var b = fp2px(a);
console.info('commonTest_0900 fp2px result:' + b);
expect(b == undefined).assertTrue();
console.info('commonTest_0900 END');
done();
});
it('commonTest_1000', 0, async function (done) {
console.info('commonTest_1000 START');
var a = 60;
var b = px2fp(a);
console.info('commonTest_1000 px2fp result:' + b);
expect(b == 60).assertTrue();
console.info('commonTest_1000 END');
done();
});
it('commonTest_1100', 0, async function (done) {
console.info('commonTest_1100 START');
var a = -6000000000;
var b = px2fp(a);
console.info('commonTest_1100 px2fp result:' + b);
expect(b == -6000000000).assertTrue();
console.info('commonTest_1100 END');
done();
});
it('commonTest_1200', 0, async function (done) {
console.info('commonTest_1200 START');
var a = '60';
var b = px2fp(a);
console.info('commonTest_1200 px2fp result:' + b);
expect(b == undefined).assertTrue();
console.info('commonTest_1200 END');
done();
});
it('commonTest_1300', 0, async function (done) {
console.info('commonTest_1300 START');
var a = 50;
var b = lpx2px(a);
console.info('commonTest_1300 lpx2px result:' + b);
expect(b == 33).assertTrue();
console.info('commonTest_1300 END');
done();
});
it('commonTest_1400', 0, async function (done) {
console.info('commonTest_1400 START');
var a = -500000000;
var b = lpx2px(a);
console.info('commonTest_1400 lpx2px result:' + b);
expect(b == -333333343).assertTrue();
console.info('commonTest_1400 END');
done();
});
it('commonTest_1500', 0, async function (done) {
console.info('commonTest_1500 START');
var a = '50';
var b = lpx2px(a);
console.info('commonTest_1500 lpx2px result:' + b);
expect(b == undefined).assertTrue();
console.info('commonTest_1500 END');
done();
});
it('commonTest_1600', 0, async function (done) {
console.info('commonTest_1600 START');
var a = 40;
var b = px2lpx(a);
console.info('commonTest_1600 px2lpx result:' + b);
expect(b == 59.99999821186071).assertTrue();
console.info('commonTest_1600 END');
done();
});
it('commonTest_1700', 0, async function (done) {
console.info('commonTest_1700 START');
var a = -400000;
var b = px2lpx(a);
console.info('commonTest_1700 px2lpx result:' + b);
expect(b == -599999.9821186071).assertTrue();
console.info('commonTest_1700 END');
done();
});
it('commonTest_1800', 0, async function (done) {
console.info('commonTest_1800 START');
var a = '40';
var b = px2lpx(a);
console.info('commonTest_1800 px2lpx result:' + b);
expect(b == undefined).assertTrue();
console.info('commonTest_1800 END');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EllipseJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function ellipseJsunit() {
...
@@ -36,7 +36,7 @@ export default function ellipseJsunit() {
console.info("push ellipse page result:" + JSON.stringify(result));
console.info("push ellipse page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push ellipse page error:" +
JSON.stringify(result)
);
console.error("push ellipse page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/EnableJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function enableJsunit() {
...
@@ -36,7 +36,7 @@ export default function enableJsunit() {
console.info("push enable page result:" + JSON.stringify(result));
console.info("push enable page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push enable page error:" +
JSON.stringify(result)
);
console.error("push enable page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GaugeJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function gaugeJsunit() {
...
@@ -35,7 +35,7 @@ export default function gaugeJsunit() {
console.info("push gauge page success " + JSON.stringify(result));
console.info("push gauge page success " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push gauge page error " +
JSON.stringify(err)
);
console.error("push gauge page error " +
err
);
}
}
done()
done()
});
});
...
@@ -65,10 +65,7 @@ export default function gaugeJsunit() {
...
@@ -65,10 +65,7 @@ export default function gaugeJsunit() {
try {
try {
var eventData = {
var eventData = {
data: {
data: {
"gaugeValue": "10",
"gaugeValue": "10"
"strokeWidthValue": "30",
"startAngleValue": "200",
"endAngleValue": "200"
}
}
}
}
var innerEvent = {
var innerEvent = {
...
@@ -84,8 +81,7 @@ export default function gaugeJsunit() {
...
@@ -84,8 +81,7 @@ export default function gaugeJsunit() {
let strJsonNew = getInspectorByKey('gauge');
let strJsonNew = getInspectorByKey('gauge');
let objNew = JSON.parse(strJsonNew);
let objNew = JSON.parse(strJsonNew);
console.info("[testGauge002] component objNew is: " + JSON.stringify(objNew));
console.info("[testGauge002] component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.strokeWidth).assertEqual('30.000000vp');
expect(objNew.$attrs.gauge).assertEqual('10.00');
expect(objNew.$attrs.value).assertEqual('10.00');
done();
done();
});
});
...
@@ -95,11 +91,11 @@ export default function gaugeJsunit() {
...
@@ -95,11 +91,11 @@ export default function gaugeJsunit() {
try {
try {
var eventData = {
var eventData = {
data: {
data: {
"
colorValues": JSON.stringify([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1]])
"
strokeWidthValue": "30",
}
}
}
}
var innerEvent = {
var innerEvent = {
eventId:
2
,
eventId:
1
,
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
}
}
console.info("[testGauge003] start to publish emit");
console.info("[testGauge003] start to publish emit");
...
@@ -107,6 +103,84 @@ export default function gaugeJsunit() {
...
@@ -107,6 +103,84 @@ export default function gaugeJsunit() {
} catch (err) {
} catch (err) {
console.log("[testGauge003] change component data error: " + err.message);
console.log("[testGauge003] change component data error: " + err.message);
}
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('gauge');
let objNew = JSON.parse(strJsonNew);
console.info("[testGauge003] component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.strokeWidth).assertEqual('30.000000vp');
done();
});
it('testGauge004', 0, async function (done) {
console.info('[testGauge004] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"startAngleValue": "200"
}
}
var innerEvent = {
eventId: 1,
priority: events_emitter.EventPriority.LOW
}
console.info("[testGauge004] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testGauge004] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('gauge');
let objNew = JSON.parse(strJsonNew);
console.info("[testGauge004] component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.startAngle).assertEqual('200.00');
done();
});
it('testGauge005', 0, async function (done) {
console.info('[testGauge005] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"endAngleValue": "200"
}
}
var innerEvent = {
eventId: 1,
priority: events_emitter.EventPriority.LOW
}
console.info("[testGauge005] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testGauge005] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJsonNew = getInspectorByKey('gauge');
let objNew = JSON.parse(strJsonNew);
console.info("[testGauge005] component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.endAngle).assertEqual('200.00');
done();
});
it('testGauge006', 0, async function (done) {
console.info('[testGauge006] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"colorValues": JSON.stringify([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1]])
}
}
var innerEvent = {
eventId: 2,
priority: events_emitter.EventPriority.LOW
}
console.info("[testGauge006] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testGauge006] change component data error: " + err.message);
}
done();
done();
});
});
})
})
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridContainerJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function girdContainerJsunit() {
...
@@ -36,7 +36,7 @@ export default function girdContainerJsunit() {
console.info("push girdContainer page result:" + JSON.stringify(result));
console.info("push girdContainer page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push girdContainer page error:" +
JSON.stringify(result)
);
console.error("push girdContainer page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/GridJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function gridJsunit() {
...
@@ -36,7 +36,7 @@ export default function gridJsunit() {
console.info('beforeEach push prompt page result:' + JSON.stringify(result));
console.info('beforeEach push prompt page result:' + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error('beforeEach push prompt page error:' +
JSON.stringify(result)
);
console.error('beforeEach push prompt page error:' +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets
浏览文件 @
9d65c217
// @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");
...
@@ -39,7 +38,7 @@ import textStyleJsunit from './general-properties/TextStyleJsunit.test.ets';
...
@@ -39,7 +38,7 @@ import textStyleJsunit from './general-properties/TextStyleJsunit.test.ets';
import imageEffectsJsunit from './general-properties/ImageEffectsJsunit.test.ets';
import imageEffectsJsunit from './general-properties/ImageEffectsJsunit.test.ets';
import transformJsunit from './general-properties/TransFormJsunit.test.ets';
import transformJsunit from './general-properties/TransFormJsunit.test.ets';
import gridSettingsJsunit from './general-properties/GridSettingsJsunit.test.ets';
import gridSettingsJsunit from './general-properties/GridSettingsJsunit.test.ets';
import touchJsunit from './general-properties/
t
ouchJsunit.test.ets'
import touchJsunit from './general-properties/
T
ouchJsunit.test.ets'
import backgroundJsunit from './general-properties/BackgroundJsunit.test.ets';
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';
...
@@ -56,6 +55,19 @@ import qrCodeJsunit from './QrCodeJsunit.test.ets';
...
@@ -56,6 +55,19 @@ import qrCodeJsunit from './QrCodeJsunit.test.ets';
import tapGesture from './TapGesture.test.ets';
import tapGesture from './TapGesture.test.ets';
import progressJsunit from './ProgressJsunit.test.ets';
import progressJsunit from './ProgressJsunit.test.ets';
import animateJsunit from './AnimateJsunit.test.ets';
import animateJsunit from './AnimateJsunit.test.ets';
import commonJsunit from './CommonJsunit.test.ets';
import spanJsunit from './SpanJsunit.test.ets';
import columnJsunit from './ColumnJsunit.test.ets';
import ratingJsunit from './RatingJsunit.test.ets';
import canvas2Jsunit from './Canvas2Jsunit.test.ets';
import toggleJsunit from './ToggleJsunit.test.ets';
import shapeJsunit from './ShapeJsunit.test.ets'
import motionPathJsunit from './MotionPathJsunit.test.ets';
import scrollCodeJsunit from './ScrollCodeJsunit.test.ets';
import canvas3Jsunit from './Canvas3Jsunit.test.ets';
import transitionJsunit from './TransitionJsunit.test.ets';
import priorityGestureJsunit from './PriorityGestureJsunit.test.ets';
import parallelGestureJsunit from './ParallelGestureJsunit.test.ets';
export default function testsuite() {
export default function testsuite() {
gaugeJsunit();
gaugeJsunit();
...
@@ -92,6 +104,8 @@ export default function testsuite() {
...
@@ -92,6 +104,8 @@ export default function testsuite() {
textJsunit();
textJsunit();
badgeJsunit();
badgeJsunit();
canvasJsunit();
canvasJsunit();
canvas2Jsunit();
canvas3Jsunit();
longPressGestureJsUnit();
longPressGestureJsUnit();
buttonJsunit();
buttonJsunit();
responseRegionJsunit();
responseRegionJsunit();
...
@@ -101,4 +115,15 @@ export default function testsuite() {
...
@@ -101,4 +115,15 @@ export default function testsuite() {
tapGesture();
tapGesture();
progressJsunit();
progressJsunit();
animateJsunit();
animateJsunit();
commonJsunit();
spanJsunit();
ratingJsunit();
toggleJsunit();
shapeJsunit();
motionPathJsunit();
columnJsunit();
scrollCodeJsunit();
transitionJsunit();
priorityGestureJsunit();
parallelGestureJsunit();
}
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ListJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function listJsunit() {
...
@@ -36,7 +36,7 @@ export default function listJsunit() {
console.info("push list page result:" + JSON.stringify(result));
console.info("push list page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push list page error:" +
JSON.stringify(result)
);
console.error("push list page error:" +
err
);
}
}
done()
done()
});
});
...
@@ -69,10 +69,7 @@ export default function listJsunit() {
...
@@ -69,10 +69,7 @@ export default function listJsunit() {
try {
try {
var eventData = {
var eventData = {
data: {
data: {
"listDirection": Axis.Horizontal,
"listDirection": Axis.Horizontal
"editMode": true,
"edgeEffect": EdgeEffect.Spring,
"chainAnimation": true
}
}
}
}
var innerEvent = {
var innerEvent = {
...
@@ -89,9 +86,6 @@ export default function listJsunit() {
...
@@ -89,9 +86,6 @@ export default function listJsunit() {
let obj = JSON.parse(strJson);
let obj = JSON.parse(strJson);
console.info("[testList02] obj is: " + JSON.stringify(obj));
console.info("[testList02] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.listDirection).assertEqual('Axis.Horizontal');
expect(obj.$attrs.listDirection).assertEqual('Axis.Horizontal');
expect(obj.$attrs.editMode).assertEqual('true');
expect(obj.$attrs.edgeEffect).assertEqual('EdgeEffect.Spring');
expect(obj.$attrs.chainAnimation).assertEqual('true');
console.info('testList02 END');
console.info('testList02 END');
done();
done();
});
});
...
@@ -101,14 +95,11 @@ export default function listJsunit() {
...
@@ -101,14 +95,11 @@ export default function listJsunit() {
try {
try {
var eventData = {
var eventData = {
data: {
data: {
"strokeWidth": "3.000000vp",
"editMode": true
"color": "#FF0000FF",
"startMargin": "30.000000vp",
"endMargin": "30.000000vp"
}
}
}
}
var innerEvent = {
var innerEvent = {
eventId: 8
1
,
eventId: 8
0
,
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
}
}
console.info("[testList03] start to publish emit:" + JSON.stringify(eventData.data));
console.info("[testList03] start to publish emit:" + JSON.stringify(eventData.data));
...
@@ -116,15 +107,168 @@ export default function listJsunit() {
...
@@ -116,15 +107,168 @@ export default function listJsunit() {
} catch (err) {
} catch (err) {
console.log("[testList03] change component data error: " + err.message);
console.log("[testList03] change component data error: " + err.message);
}
}
await Utils.sleep(
1
000);
await Utils.sleep(
4
000);
let strJson = getInspectorByKey('list');
let strJson = getInspectorByKey('list');
let obj = JSON.parse(strJson);
let obj = JSON.parse(strJson);
console.info("[testList03] obj is: " + JSON.stringify(obj));
console.info("[testList03] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.editMode).assertEqual('true');
console.info('testList03 END');
done();
});
it('testList04', 0, async function (done) {
console.info('[testList04] START');
try {
var eventData = {
data: {
"edgeEffect": EdgeEffect.Spring
}
}
var innerEvent = {
eventId: 80,
priority: events_emitter.EventPriority.LOW
}
console.info("[testList04] start to publish emit:" + JSON.stringify(eventData.data));
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testList04] change component data error: " + err.message);
}
await Utils.sleep(4000);
let strJson = getInspectorByKey('list');
let obj = JSON.parse(strJson);
console.info("[testList04] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.edgeEffect).assertEqual('EdgeEffect.Spring');
console.info('testList04 END');
done();
});
it('testList05', 0, async function (done) {
console.info('[testList05] START');
try {
var eventData = {
data: {
"chainAnimation": true
}
}
var innerEvent = {
eventId: 80,
priority: events_emitter.EventPriority.LOW
}
console.info("[testList05] start to publish emit:" + JSON.stringify(eventData.data));
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testList05] change component data error: " + err.message);
}
await Utils.sleep(4000);
let strJson = getInspectorByKey('list');
let obj = JSON.parse(strJson);
console.info("[testList05] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.chainAnimation).assertEqual('true');
console.info('testList05 END');
done();
});
it('testList06', 0, async function (done) {
console.info('[testList06] START');
try {
var eventData = {
data: {
"strokeWidth": "3.000000vp"
}
}
var innerEvent = {
eventId: 81,
priority: events_emitter.EventPriority.LOW
}
console.info("[testList06] start to publish emit:" + JSON.stringify(eventData.data));
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testList06] change component data error: " + err.message);
}
await Utils.sleep(1000);
let strJson = getInspectorByKey('list');
let obj = JSON.parse(strJson);
console.info("[testList06] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.divider.strokeWidth).assertEqual("3.000000vp");
expect(obj.$attrs.divider.strokeWidth).assertEqual("3.000000vp");
console.info('testList06 END');
done();
});
it('testList07', 0, async function (done) {
console.info('[testList07] START');
try {
var eventData = {
data: {
"color": "#FF0000FF"
}
}
var innerEvent = {
eventId: 81,
priority: events_emitter.EventPriority.LOW
}
console.info("[testList07] start to publish emit:" + JSON.stringify(eventData.data));
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testList07] change component data error: " + err.message);
}
await Utils.sleep(1000);
let strJson = getInspectorByKey('list');
let obj = JSON.parse(strJson);
console.info("[testList07] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.divider.color).assertEqual("#FF0000FF");
expect(obj.$attrs.divider.color).assertEqual("#FF0000FF");
console.info('testList07 END');
done();
});
it('testList08', 0, async function (done) {
console.info('[testList08] START');
try {
var eventData = {
data: {
"startMargin": "30.000000vp"
}
}
var innerEvent = {
eventId: 81,
priority: events_emitter.EventPriority.LOW
}
console.info("[testList08] start to publish emit:" + JSON.stringify(eventData.data));
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testList08] change component data error: " + err.message);
}
await Utils.sleep(1000);
let strJson = getInspectorByKey('list');
let obj = JSON.parse(strJson);
console.info("[testList08] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.divider.startMargin).assertEqual("30.000000vp");
expect(obj.$attrs.divider.startMargin).assertEqual("30.000000vp");
console.info('testList08 END');
done();
});
it('testList09', 0, async function (done) {
console.info('[testList09] START');
try {
var eventData = {
data: {
"endMargin": "30.000000vp"
}
}
var innerEvent = {
eventId: 81,
priority: events_emitter.EventPriority.LOW
}
console.info("[testList09] start to publish emit:" + JSON.stringify(eventData.data));
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[testList09] change component data error: " + err.message);
}
await Utils.sleep(1000);
let strJson = getInspectorByKey('list');
let obj = JSON.parse(strJson);
console.info("[testList09] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.divider.endMargin).assertEqual("30.000000vp");
expect(obj.$attrs.divider.endMargin).assertEqual("30.000000vp");
console.info('testList0
3
END');
console.info('testList0
9
END');
done();
done();
});
});
})
})
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/LongPressGesture.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function longPressGestureJsunit() {
...
@@ -36,7 +36,7 @@ export default function longPressGestureJsunit() {
console.info("push longPressGesture page result:" + JSON.stringify(result));
console.info("push longPressGesture page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push longPressGesture page error:" +
JSON.stringify(result)
);
console.error("push longPressGesture page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/MotionPathJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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 Utils from './Utils';
import events_emitter from '@ohos.events.emitter';
export default function motionPathJsunit() {
describe('motionPathTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/motionPath',
}
try {
router.clear();
let pages = router.getState();
console.info("get motionPath state success " + JSON.stringify(pages));
if (!("motionPath" == pages.name)) {
console.info("get motionPath state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(1000);
console.info("push motionPath page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push motionPath page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("motionPath after each called");
});
it('motionPathTest_0100', 0, async function (done) {
console.info('motionPathTest_0100 START');
let strJson = getInspectorByKey('motionPath');
console.info("motionPathTest_0100 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("motionPathTest_0100 component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Column');
done();
});
it('motionPathTest_0200', 0, async function (done) {
console.info('motionPathTest_0200 START');
let callback = (indexEventOne) => {
console.info("motionPathTest_0200 get state result is: " + JSON.stringify(indexEventOne));
expect(indexEventOne.data.fromX).assertEqual(0);
expect(indexEventOne.data.toY).assertEqual(1);
}
let indexEventOne = {
eventId: 3,
priority: events_emitter.EventPriority.LOW
}
try {
events_emitter.on(indexEventOne, callback);
} catch (err) {
console.info("motionPathTest_0200 on events_emitter err : " + JSON.stringify(err));
}
console.info("motionPathTest_0200 click result is: " + JSON.stringify(sendEventByKey('button1',10,"")));
await Utils.sleep(1000);
console.info('motionPathTest_0200 END');
done();
});
it('motionPathTest_0300', 0, async function (done) {
console.info('motionPathTest_0300 START');
await Utils.sleep(1500);
let callback = (indexEvent) => {
console.info("motionPathTest_0300 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.ACTION).assertEqual(true);
}
let indexEvent = {
eventId: 2,
priority: events_emitter.EventPriority.LOW
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("motionPathTest_0300 on events_emitter err : " + JSON.stringify(err));
}
console.info("motionPathTest_0300 click result is: " + JSON.stringify(sendEventByKey('button',10,"")));
await Utils.sleep(1000);
console.info('motionPathTest_0300 END');
done();
});
})
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/OverlayJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function enableJsunit() {
...
@@ -36,7 +36,7 @@ export default function enableJsunit() {
console.info("push overlay page result:" + JSON.stringify(result));
console.info("push overlay page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push overlay page error:" +
JSON.stringify(result)
);
console.error("push overlay page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ParallelGestureJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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 Utils from './Utils';
import events_emitter from '@ohos.events.emitter';
export default function parallelGestureJsunit() {
describe('parallelGestureTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/parallelGesture',
}
try {
router.clear();
let pages = router.getState();
console.info("get parallelGesture state success " + JSON.stringify(pages));
if (!("parallelGesture" == pages.name)) {
console.info("get parallelGesture state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(1000);
console.info("push parallelGesture page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push parallelGesture page error " + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("parallelGesture after each called");
});
it('parallelGestureTest_0100', 0, async function (done) {
await Utils.sleep(1000)
let rect = await Utils.getComponentRect('tapGesture')
console.info("parallelGestureTest_0100 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;
console.info("parallelGestureTest_0100 onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value);
let point: TouchObject = { id: 11, x: x_value, y: y_value, type: TouchType.DOWN}
var callback = (eventData) => {
console.info("parallelGestureTest_0100 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.value).assertEqual('gesture onAction')
}
var innerEvent = {
eventId: 199,
priority: events_emitter.EventPriority.LOW
}
try {
events_emitter.on(innerEvent, callback)
} catch (err) {
console.info("parallelGestureTest_0100 on events_emitter err : " + JSON.stringify(err));
}
console.info('parallelGestureTest_0100 sendTouchEvent result:' + sendTouchEvent(point));
await Utils.sleep(1000)
console.info('parallelGestureTest_0100 testSendTouchEvent END');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/PriorityGestureJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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 Utils from './Utils';
import events_emitter from '@ohos.events.emitter';
export default function priorityGestureJsunit() {
describe('PriorityGestureTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/priorityGesture',
}
try {
router.clear();
let pages = router.getState();
console.info("get priorityGesture state success " + JSON.stringify(pages));
if (!("priorityGesture" == pages.name)) {
console.info("get priorityGesture state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(1000);
console.info("push priorityGesture page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push priorityGesture page error " + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("priorityGesture after each called");
});
it('priorityGestureTest_0100', 0, async function (done) {
await Utils.sleep(1000)
let rect = await Utils.getComponentRect('tapGesture')
console.info("priorityGestureTest_0100 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;
console.info("priorityGestureTest_0100 onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value);
let point: TouchObject = { id: 11, x: x_value, y: y_value, type: TouchType.Move}
var callback = (eventData) => {
console.info("priorityGestureTest_0100 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.value).assertEqual('gesture onAction')
}
var innerEvent = {
eventId: 111,
priority: events_emitter.EventPriority.LOW
}
try {
events_emitter.on(innerEvent, callback)
} catch (err) {
console.info("priorityGestureTest_0100 on events_emitter err : " + JSON.stringify(err));
}
console.info('priorityGestureTest_0100 sendTouchEvent one:' + sendTouchEvent(point));
await Utils.sleep(1000)
console.info('priorityGestureTest_0100 testSendTouchEvent END');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets
浏览文件 @
9d65c217
// @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");
...
@@ -34,7 +35,7 @@ export default function progressJsunit() {
...
@@ -34,7 +35,7 @@ export default function progressJsunit() {
console.info("push progress page success " + JSON.stringify(result));
console.info("push progress page success " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push progress page error " +
JSON.stringify(err)
);
console.error("push progress page error " +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/QrCodeJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function qrCodeJsunit() {
...
@@ -35,7 +35,7 @@ export default function qrCodeJsunit() {
console.info("push QrCode page success " + JSON.stringify(result));
console.info("push QrCode page success " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push QrCode page error
" + JSON.stringify(err)
);
console.error("push QrCode page error
: " + err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/RatingJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
/**
* 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 ratingJsunit() {
describe('ratingTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/rating',
}
try {
router.clear();
let pages = router.getState();
console.info("get rating state success " + JSON.stringify(pages));
if (!("rating" == pages.name)) {
console.info("get rating state success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(4000);
console.info("push rating page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push rating page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("rating after each called");
});
it('testRating_100', 0, async function (done) {
console.info('testRating_100 START');
await Utils.sleep(1000);
try {
let eventData = {
data: {
"rating": 2
}
}
var innerEvent = {
eventId: 440,
priority: events_emitter.EventPriority.LOW
}
console.info("testRating_100 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testRating_100 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('Rating');
let obj = JSON.parse(strJson);
console.info("testRating_100 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.rating).assertEqual("2.000000");
console.info('testRating_100 END');
done();
});
it('testRating_200', 0, async function (done) {
console.info('[testRating_200] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('Rating');
let obj = JSON.parse(strJson);
console.info("testRating_200 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.stepSize).assertEqual("0.500000");
console.info('testRating_200 END');
done();
});
it('testRating_300', 0, async function (done) {
console.info('testRating_300 START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"rating": 3
}
}
var innerEvent = {
eventId: 441,
priority: events_emitter.EventPriority.LOW
}
console.info("testRating_300 start to publish emit");
console.info("eventData.data.rating value" + eventData.data.rating);
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testRating_300 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('Rating');
let obj = JSON.parse(strJson);
console.info("testRating_300 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.rating).assertEqual("3.000000");
console.info('testRating_300 END');
done();
});
it('testRating_400', 0, async function (done) {
console.info('testRating_400 START');
await Utils.sleep(1000);
try {
let eventData = {
data: {
"rating": 4
}
}
var innerEvent = {
eventId: 442,
priority: events_emitter.EventPriority.LOW
}
console.info("testRating_400 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testRating_400 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('Rating');
let obj = JSON.parse(strJson);
console.info("testRating_400 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.rating).assertEqual("4.000000");
console.info('testRating_400 END');
done();
});
it('testRating_500', 0, async function (done) {
console.info('testRating_500 START');
await Utils.sleep(1000);
try {
let eventData = {
data: {
"rating": 5
}
}
var innerEvent = {
eventId: 443,
priority: events_emitter.EventPriority.LOW
}
console.info("testRating_500 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testRating_500 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('Rating');
let obj = JSON.parse(strJson);
console.info("testRating_500 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.rating).assertEqual("5.000000");
console.info('testRating_500 END');
done();
});
it('testRating_600', 0, async function (done) {
console.info('testRating_600 START');
await Utils.sleep(1000);
try {
let eventData = {
data: {
"rating": 0
}
}
var innerEvent = {
eventId: 444,
priority: events_emitter.EventPriority.LOW
}
console.info("testRating_600 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testRating_600 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('Rating');
let obj = JSON.parse(strJson);
console.info("testRating_600 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.rating).assertEqual("0.000000");
console.info('testRating_600 END');
done();
});
it('testRating_700', 0, async function (done) {
console.info('testRating_700 START');
await Utils.sleep(1000);
try {
let eventData = {
data: {
"rating": 1
}
}
var innerEvent = {
eventId: 445,
priority: events_emitter.EventPriority.LOW
}
console.info("testRating_700 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testRating_700 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('Rating');
let obj = JSON.parse(strJson);
console.info("testRating_700 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.rating).assertEqual("1.000000");
console.info('testRating_700 END');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ScrollCodeJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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 scrollCodeJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/scrollCode',
}
try {
router.clear();
let pages = router.getState();
console.info("get ScrollCode state success " + JSON.stringify(pages));
if (!("ScrollCode" == pages.name)) {
console.info("get ScrollCode pages success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push ScrollCode page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push ScrollCode page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info("ScrollCode after each called");
});
it('test_scrollCode_001', 0, async function (done) {
console.info('[test_scrollCode_001] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('ScrollCode');
let obj = JSON.parse(strJson);
console.info("[test_scrollCode_001] component obj is: " + JSON.stringify(obj));
await Utils.sleep(1000);
expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.Vertical');
expect(obj.$attrs.scrollBar).assertEqual('BarState.On');
expect(obj.$attrs.scrollBarColor).assertEqual('#FF0000FF');
expect(obj.$attrs.scrollBarWidth).assertEqual('30.000000px');
done();
});
it('test_scrollCode_002', 0, async function (done) {
console.info('[test_scrollCode_002] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"scrollable": "ScrollDirection.Vertical"
}
}
var innerEvent = {
eventId: 90,
priority: events_emitter.EventPriority.LOW
}
console.info("[test_scrollCode_002] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[test_scrollCode_002] change scrollable error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('ScrollCode');
let obj = JSON.parse(strJson);
console.info("[test_scrollCode_002] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.Vertical');
done();
});
it('test_scrollCode_003', 0, async function (done) {
console.info('[test_scrollCode_003] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"scrollBar": "BarState.Off"
}
}
var innerEvent = {
eventId: 80,
priority: events_emitter.EventPriority.LOW
}
console.info("[test_scrollCode_003] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[test_scrollCode_003] change scrollBar error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('ScrollCode');
let obj = JSON.parse(strJson);
console.info("[test_scrollCode_003] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.scrollBar).assertEqual('BarState.Off');
done();
});
it('test_scrollCode_004', 0, async function (done) {
console.info('[test_scrollCode_004] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"scrollBarColor": "#FFB6C1"
}
}
var innerEvent = {
eventId: 85,
priority: events_emitter.EventPriority.LOW
}
console.info("[test_scrollCode_004] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[test_scrollCode_004] change scrollBar error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('ScrollCode');
let obj = JSON.parse(strJson);
console.info("[test_scrollCode_004] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.scrollBarColor).assertEqual('#FFFFB6C1');
done();
});
it('test_scrollCode_005', 0, async function (done) {
console.info('[test_scrollCode_005] START');
await Utils.sleep(1000);
try {
var eventData = {
data: {
"scrollBarWidth": 40
}
}
var innerEvent = {
eventId: 95,
priority: events_emitter.EventPriority.LOW
}
console.info("[test_scrollCode_005] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[test_scrollCode_005] change scrollBar error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('ScrollCode');
let obj = JSON.parse(strJson);
console.info("[test_scrollCode_005] component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.scrollBarWidth).assertEqual('40.000000px');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ShapeJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
此差异已折叠。
点击以展开。
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SpanJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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 spanJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
let options = {
uri: 'pages/span',
}
try {
router.clear();
let pages = router.getState();
console.info("get span state success " + JSON.stringify(pages));
if (!("span" == pages.name)) {
console.info("get span success " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push span page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push span page error: " + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(2000);
console.info("span after each called");
});
it('testSpan001', 0, async function (done) {
console.info('[testSpan001] START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('decoration');
console.info("[testSpan001] component strJson:" + strJson);
let obj = JSON.parse(strJson);
let decoration = JSON.parse(obj.$attrs.decoration);
expect(decoration.type).assertEqual('TextDecorationType.None');
expect(decoration.color).assertEqual('#FFFF0000');
done();
});
it('testSpan002', 0, async function (done) {
console.info('[testSpan002] START');
await Utils.sleep(2000);
let strJson = getInspectorByKey('decoration');
console.info("[testSpan002] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testSpan002] textCase:" + obj.$attrs.textCase);
expect(obj.$attrs.textCase).assertEqual('TextCase.Normal');
done();
});
it('testSpan003', 0, async function (done) {
console.info('[testSpan003] START');
try {
let eventData = {
data: {
"textCaseValue": TextCase.UpperCase
}
}
let indexEvent = {
eventId: 41,
priority: events_emitter.EventPriority.LOW
}
console.info("[testSpan003] start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("[testSpan003] change component data error: " + err.message);
}
await Utils.sleep(4000);
let strJson = getInspectorByKey('decoration');
console.info("[testSpan003] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testSpan003] textCase:" + obj.$attrs.textCase);
expect(obj.$attrs.textCase).assertEqual('TextCase.UpperCase');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/StepperJsunit.test.ets
浏览文件 @
9d65c217
// @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,7 +13,6 @@
...
@@ -12,7 +13,6 @@
* 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 Utils from './Utils';
...
@@ -35,7 +35,7 @@ export default function stepperJsunit() {
...
@@ -35,7 +35,7 @@ export default function stepperJsunit() {
console.info("push stepper page success " + JSON.stringify(result));
console.info("push stepper page success " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push stepper page error
" + JSON.stringify(result)
);
console.error("push stepper page error
: " + err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SwiperJsunit.test.ets
浏览文件 @
9d65c217
// @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,7 +13,6 @@
...
@@ -12,7 +13,6 @@
* 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 Utils from './Utils';
...
@@ -35,7 +35,7 @@ export default function swiperJsunit() {
...
@@ -35,7 +35,7 @@ export default function swiperJsunit() {
console.info("push swiper page success " + JSON.stringify(result));
console.info("push swiper page success " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push swiper page error
" + JSON.stringify(result)
);
console.error("push swiper page error
: " + err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/SystemRouterJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -34,7 +34,7 @@ export default function systemRouterJsunit() {
...
@@ -34,7 +34,7 @@ export default function systemRouterJsunit() {
expect(pages.name).assertEqual('systemRouterA');
expect(pages.name).assertEqual('systemRouterA');
expect(pages.path).assertEqual('pages/');
expect(pages.path).assertEqual('pages/');
} catch (err) {
} catch (err) {
console.error("[systemRouterTest001] push page error
" + JSON.stringify(result)
);
console.error("[systemRouterTest001] push page error
: " + err
);
}
}
await Utils.sleep(2000);
await Utils.sleep(2000);
done();
done();
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TabsJsunit.test.ets
浏览文件 @
9d65c217
// @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,7 +13,6 @@
...
@@ -12,7 +13,6 @@
* 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 Utils from './Utils';
...
@@ -36,7 +36,7 @@ export default function tabsJsunit() {
...
@@ -36,7 +36,7 @@ export default function tabsJsunit() {
console.info("push tabs page result:" + JSON.stringify(result));
console.info("push tabs page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push tabs page error:" +
JSON.stringify(result)
);
console.error("push tabs page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TapGesture.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function longPressGestureJsunit() {
...
@@ -36,7 +36,7 @@ export default function longPressGestureJsunit() {
console.info("push tapGesture page result:" + JSON.stringify(result));
console.info("push tapGesture page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push tapGesture page error:" +
JSON.stringify(result)
);
console.error("push tapGesture page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TextJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function textJsunit() {
...
@@ -36,7 +36,7 @@ export default function textJsunit() {
console.info("push text page result:" + JSON.stringify(result));
console.info("push text page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push text page error:" +
JSON.stringify(result)
);
console.error("push text page error:" +
err
);
}
}
done()
done()
});
});
...
@@ -60,6 +60,22 @@ export default function textJsunit() {
...
@@ -60,6 +60,22 @@ export default function textJsunit() {
it('testText_0200', 0, async function (done) {
it('testText_0200', 0, async function (done) {
console.info('testText_0200 START');
console.info('testText_0200 START');
let strJson = getInspectorByKey('image');
console.info("testText_0200 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("testText_0200 component obj is: " + JSON.stringify(obj));
var res = obj.$attrs.src.indexOf('rawfile/test.png');
console.info("testText_0200 result is: " + res);
var sres = obj.$attrs.src.slice(res,res + 16);
console.info("testText_0200 slice result is: " + sres);
expect(obj.$type).assertEqual('Image');
expect(obj.$attrs.src.slice(res,res + 16)).assertEqual('rawfile/test.png');
console.info('testText_0200 END');
done();
});
it('testText_0300', 0, async function (done) {
console.info('testText_0300 START');
try {
try {
let eventData = {
let eventData = {
data: {
data: {
...
@@ -70,17 +86,17 @@ export default function textJsunit() {
...
@@ -70,17 +86,17 @@ export default function textJsunit() {
eventId: 60,
eventId: 60,
priority: events_emitter.EventPriority.LOW
priority: events_emitter.EventPriority.LOW
}
}
console.info("testText_0
2
00 start to publish emit");
console.info("testText_0
3
00 start to publish emit");
events_emitter.emit(indexEvent, eventData);
events_emitter.emit(indexEvent, eventData);
} catch (err) {
} catch (err) {
console.log("testText_0
2
00 change component data error: " + err.message);
console.log("testText_0
3
00 change component data error: " + err.message);
}
}
await Utils.sleep(4000);
await Utils.sleep(4000);
let strJsonNew = getInspectorByKey('text');
let strJsonNew = getInspectorByKey('text');
let objNew = JSON.parse(strJsonNew);
let objNew = JSON.parse(strJsonNew);
console.info("testText_0
2
00 component objNew is: " + JSON.stringify(objNew));
console.info("testText_0
3
00 component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.fontSize).assertEqual('10.000000fp');
expect(objNew.$attrs.fontSize).assertEqual('10.000000fp');
console.info('testText_0
2
00 END');
console.info('testText_0
3
00 END');
done();
done();
});
});
})
})
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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 ToggleJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info("toggle beforeEach start");
let options = {
uri: 'pages/toggle',
}
try {
router.clear();
let pages = router.getState();
console.info("get toggle state pages:" + JSON.stringify(pages));
if (!("toggle" == pages.name)) {
console.info("get toggle state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push toggle page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push toggle page error:" + err);
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("toggle after each called");
});
it('testToggle01', 0, async function (done) {
console.info('[testToggle01] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('toggle');
let obj = JSON.parse(strJson);
console.info("[testToggle01] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.selectedColor).assertEqual('#330A59F7');
console.info('[testToggle01] END');
done();
});
it('testToggle02', 0, async function (done) {
console.info('[testToggle02] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('toggle');
let obj = JSON.parse(strJson);
console.info("[testToggle02] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.type).assertEqual('ToggleType.Button');
console.info('[testToggle02] END');
done();
});
it('testToggle03', 0, async function (done) {
console.info('[testToggle03] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('toggle');
let obj = JSON.parse(strJson);
console.info("[testToggle03] obj is: " + JSON.stringify(obj));
expect(obj.$attrs.isOn).assertEqual('false');
console.info('[testToggle03] END');
done();
});
it('testToggle04', 0, async function (done) {
console.info('testToggle04 START');
try {
let eventData = {
data: {
"isOn": true,
}
}
let indexEvent = {
eventId: 1011,
priority: events_emitter.EventPriority.LOW
}
console.info("testToggle04 start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("testToggle04 change component data error: " + err.message);
}
await Utils.sleep(4000);
let strJsonNew = getInspectorByKey('toggle');
let objNew = JSON.parse(strJsonNew);
console.info("testToggle04 component objNew is: " + JSON.stringify(objNew));
expect(objNew.$attrs.isOn).assertEqual('true');
console.info('testToggle04 END');
done();
});
})
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/TransitionJsunit.test.ets
0 → 100755
浏览文件 @
9d65c217
// @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 transitionJsunit() {
describe('appInfoTest', function () {
beforeEach(async function (done) {
console.info("text beforeEach start");
let options = {
uri: 'pages/transition',
}
try {
router.clear();
let pages = router.getState();
console.info("get transition state pages:" + JSON.stringify(pages));
if (!("transition" == pages.name)) {
console.info("get transition state pages.name:" + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(2000);
console.info("push transition page result:" + JSON.stringify(result));
}
} catch (err) {
console.error("push transition page error:" + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("transition after each called");
});
it('transitionTest_0100', 0, async function (done) {
console.info('transitionTest_0100 START');
let strJson = getInspectorByKey('button');
console.info("transitionTest_0100 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("transitionTest_0100 component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Button');
expect(obj.$attrs.opacity).assertEqual(1);
console.info('transitionTest_0100 END');
done();
});
it('transitionTest_0200', 0, async function (done) {
console.info('transitionTest_0200 START');
let indexEvent = {
eventId: 333,
priority: events_emitter.EventPriority.LOW
}
await Utils.sleep(1000);
let callback = (indexEvent) => {
console.info("transitionTest_0200 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.btn1).assertEqual(false);
}
try {
events_emitter.on(indexEvent, callback);
} catch (err) {
console.info("transitionTest_0200 on events_emitter err : " + JSON.stringify(err));
}
console.info("transitionTest_0200 click result is: " + JSON.stringify(sendEventByKey('button',10,"")));
await Utils.sleep(1000);
console.info('transitionTest_0200 END');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ZIndexJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function enableJsunit() {
...
@@ -36,7 +36,7 @@ export default function enableJsunit() {
console.info("push zIndex page result:" + JSON.stringify(result));
console.info("push zIndex page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push zIndex page error:" +
JSON.stringify(result)
);
console.error("push zIndex page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BackgroundJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function backgroundJsunit() {
...
@@ -36,7 +36,7 @@ export default function backgroundJsunit() {
console.info("push background page success " + JSON.stringify(result));
console.info("push background page success " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push background page error
" + JSON.stringify(result)
);
console.error("push background page error
: " + err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/BorderJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function borderJsunit() {
...
@@ -36,7 +36,7 @@ export default function borderJsunit() {
console.info("push border page success " + JSON.stringify(result));
console.info("push border page success " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push border page error
" + JSON.stringify(result)
);
console.error("push border page error
: " + err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ClickEventJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function clickEventJsunit() {
...
@@ -35,7 +35,7 @@ export default function clickEventJsunit() {
console.info("push clickEvent page result:" + JSON.stringify(result));
console.info("push clickEvent page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push clickEvent page error:" +
JSON.stringify(result)
);
console.error("push clickEvent page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ColorGradientJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function colorGradientJsunit() {
...
@@ -35,7 +35,7 @@ export default function colorGradientJsunit() {
console.info("push colorGradient page result:" + JSON.stringify(result));
console.info("push colorGradient page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push colorGradient page error:" +
JSON.stringify(result)
);
console.error("push colorGradient page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/FlexJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function flexJsunit() {
...
@@ -35,7 +35,7 @@ export default function flexJsunit() {
console.info("push flex page success " + JSON.stringify(result));
console.info("push flex page success " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push flex page error
" + JSON.stringify(result)
);
console.error("push flex page error
: " + err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/GridSettingsJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function gridSettingsJsunit() {
...
@@ -35,7 +35,7 @@ export default function gridSettingsJsunit() {
console.info("push gridSettings page result:" + JSON.stringify(result));
console.info("push gridSettings page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push gridSettings page error:" +
JSON.stringify(result)
);
console.error("push gridSettings page error:" +
err
);
}
}
done();
done();
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ImageEffectsJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function imageEffectsJsunit() {
...
@@ -35,7 +35,7 @@ export default function imageEffectsJsunit() {
console.info("push imageEffects page success " + JSON.stringify(result));
console.info("push imageEffects page success " + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push imageEffects page error
" + JSON.stringify(err)
);
console.error("push imageEffects page error
: " + err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/LayoutConstraintsJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function layoutConstraintsJsunit() {
...
@@ -36,7 +36,7 @@ export default function layoutConstraintsJsunit() {
console.info("push layoutConstraints page result:" + JSON.stringify(result));
console.info("push layoutConstraints page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push layoutConstraints page error:" +
JSON.stringify(result)
);
console.error("push layoutConstraints page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/OpacitySettingJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function opacitySettingJsunit() {
...
@@ -35,7 +35,7 @@ export default function opacitySettingJsunit() {
console.info("push opacitySetting page result:" + JSON.stringify(result));
console.info("push opacitySetting page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push opacitySetting page error:" +
JSON.stringify(result)
);
console.error("push opacitySetting page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PanGestureJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -39,7 +39,7 @@ export default function PanGestureJsunit() {
...
@@ -39,7 +39,7 @@ export default function PanGestureJsunit() {
console.info("push PanGesture page result:" + JSON.stringify(result));
console.info("push PanGesture page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push PanGesture page error:" +
JSON.stringify(result)
);
console.error("push PanGesture page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/PositionSettingJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function positionSettingJsunit() {
...
@@ -35,7 +35,7 @@ export default function positionSettingJsunit() {
console.info("push positionSetting page result:" + JSON.stringify(result));
console.info("push positionSetting page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push positionSetting page error:" +
JSON.stringify(result)
);
console.error("push positionSetting page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ResponseRegionJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -39,7 +39,7 @@ export default function ResponseRegionJsunit() {
...
@@ -39,7 +39,7 @@ export default function ResponseRegionJsunit() {
console.info("push ResponseRegion page result:" + JSON.stringify(result));
console.info("push ResponseRegion page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push ResponseRegion page error:" +
JSON.stringify(result)
);
console.error("push ResponseRegion page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/ShapeClippingJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function shapeClippingJsunit() {
...
@@ -35,7 +35,7 @@ export default function shapeClippingJsunit() {
console.info("push shapeClipping page result:" + JSON.stringify(result));
console.info("push shapeClipping page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push shapeClipping page error:" +
JSON.stringify(result)
);
console.error("push shapeClipping page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/SizeSettingJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function sizeSettingJsunit() {
...
@@ -35,7 +35,7 @@ export default function sizeSettingJsunit() {
console.info("push sizeSetting page result:" + JSON.stringify(result));
console.info("push sizeSetting page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push sizeSetting page error:" +
JSON.stringify(result)
);
console.error("push sizeSetting page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TextStyleJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -35,7 +35,7 @@ export default function textStyleJsunit() {
...
@@ -35,7 +35,7 @@ export default function textStyleJsunit() {
console.info("push textStyle page result:" + JSON.stringify(result));
console.info("push textStyle page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push textStyle page error:" +
JSON.stringify(result)
);
console.error("push textStyle page error:" +
err
);
}
}
done();
done();
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TouchAbleJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -34,7 +34,7 @@ export default function touchAbleJsunit() {
...
@@ -34,7 +34,7 @@ export default function touchAbleJsunit() {
console.info("push touchAble page result:" + JSON.stringify(result));
console.info("push touchAble page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push touchAble page error:" +
JSON.stringify(result)
);
console.error("push touchAble page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/
t
ouchJsunit.test.ets
→
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/
T
ouchJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -37,7 +37,7 @@ export default function touchJsunit() {
...
@@ -37,7 +37,7 @@ export default function touchJsunit() {
console.info("push touch page result: " + JSON.stringify(result));
console.info("push touch page result: " + JSON.stringify(result));
}
}
}catch(err){
}catch(err){
console.error("push touch page error: " +
JSON.stringify(result)
);
console.error("push touch page error: " +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/TransFormJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function transFormJsunit() {
...
@@ -36,7 +36,7 @@ export default function transFormJsunit() {
console.info("push transForm page result:" + JSON.stringify(result));
console.info("push transForm page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push transForm page error:" +
JSON.stringify(result)
);
console.error("push transForm page error:" +
err
);
}
}
done()
done()
});
});
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/VisibilityJsunit.test.ets
浏览文件 @
9d65c217
...
@@ -36,7 +36,7 @@ export default function visibilityJsunit() {
...
@@ -36,7 +36,7 @@ export default function visibilityJsunit() {
console.info("push visibility page result:" + JSON.stringify(result));
console.info("push visibility page result:" + JSON.stringify(result));
}
}
} catch (err) {
} catch (err) {
console.error("push visibility page error:" +
JSON.stringify(result)
);
console.error("push visibility page error:" +
err
);
}
}
done()
done()
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录