Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ee562c51
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看板
提交
ee562c51
编写于
2月 23, 2022
作者:
Z
zhangrao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add component
Signed-off-by:
N
zhangrao
<
zhangrao@huawei.com
>
上级
1afabe1d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
119 addition
and
185 deletion
+119
-185
ace/ace_ets_component/entry/src/main/config.json
ace/ace_ets_component/entry/src/main/config.json
+0
-4
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/rotationGesture.ets
.../MainAbility/pages/general-properties/rotationGesture.ets
+0
-74
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/longPressGesture.ets
...entry/src/main/ets/MainAbility/pages/longPressGesture.ets
+1
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/progress.ets
...mponent/entry/src/main/ets/MainAbility/pages/progress.ets
+20
-1
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets
...mponent/entry/src/main/ets/MainAbility/test/List.test.ets
+2
-3
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets
...try/src/main/ets/MainAbility/test/ProgressJsunit.test.ets
+96
-6
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/RotationGestureJsunit.test.ets
...ty/test/general-properties/RotationGestureJsunit.test.ets
+0
-96
未找到文件。
ace/ace_ets_component/entry/src/main/config.json
浏览文件 @
ee562c51
...
...
@@ -94,14 +94,12 @@
"pages/general-properties/flex"
,
"pages/swiper"
,
"pages/gridPage"
,
"pages/general-properties/rotationGesture"
,
"pages/text"
,
"pages/badge"
,
"pages/canvas"
,
"pages/longPressGesture"
,
"pages/badge"
,
"pages/button"
,
"pages/general-properties/rotationGesture"
,
"pages/gridPage"
,
"pages/general-properties/touchAble"
,
"pages/swiper"
,
...
...
@@ -109,9 +107,7 @@
"pages/general-properties/ResponseRegion"
,
"pages/general-properties/PanGesture"
,
"pages/QrCode"
,
"pages/general-properties/PanGesture"
,
"pages/tabs"
,
"pages/general-properties/PanGesture"
,
"pages/tapGesture"
,
"pages/progress"
,
"pages/animate"
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/general-properties/rotationGesture.ets
已删除
100755 → 0
浏览文件 @
1afabe1d
// @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 RotationGestureExample {
@State angle: number = 0
@State eventType: string = ''
@State isTouched: boolean = false;
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('RotationGesture angle:' + this.angle)
}
.height(300).width(300).padding(20).border({ width:1 })
.margin(80).rotate({ x:1, y:2, z:3, angle: this.angle })
.key('gesture')
.onTouch((event: TouchEvent) => {
this.isTouched = true
if (event.type === TouchType.Down) {
this.eventType = 'Down'
}
if (event.type === TouchType.Up) {
this.eventType = 'Up'
}
if (event.type === TouchType.Move) {
this.eventType = 'Move'
}
console.info('RotationGesture TouchType:' + this.eventType)
try {
var backData = {
data: {
"ACTION": this.isTouched,
"EVENT_TYPE": this.eventType
}
}
var backEvent = {
eventId: 56,
priority: events_emitter.EventPriority.LOW
}
console.info("RotationGesture start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("RotationGesture emit action state err: " + JSON.stringify(err.message))
}
})
.gesture(
RotationGesture()
.onActionStart((event: RotationGestureEvent) => {
console.log('Rotation start')
})
.onActionUpdate((event: RotationGestureEvent) => {
this.angle = event.angle
})
.onActionEnd(() => {
console.log('Rotation end')
})
)
}
}
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/longPressGesture.ets
浏览文件 @
ee562c51
...
...
@@ -28,7 +28,7 @@ struct LongPressGestureExample {
.height(200).width(300).padding(60).border({ width:1 }).margin(30)
.gesture(
LongPressGesture({ repeat: true })
.onAction((
event: LongPressGestureEvent
) => {
.onAction(() => {
console.info("longPressGesture current action onAction")
this.eventString = 'onAction';
console.info('onAction current action state is: ' + this.eventString);
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/pages/progress.ets
浏览文件 @
ee562c51
...
...
@@ -15,6 +15,7 @@
import events_emitter from '@ohos.emitter'
@Entry
@Component
struct ProgressExample {
...
...
@@ -54,12 +55,30 @@ struct ProgressExample {
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventThree, this.stateChangCallBack)
var stateChangeEventFour = {
eventId: 42,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventFour, this.stateChangCallBack)
var stateChangeEventFive = {
eventId: 41,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventFive, this.stateChangCallBack)
var stateChangeEventSix = {
eventId: 40,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEventSix, this.stateChangCallBack)
}
build() {
Column({ space: 15 }) {
Text('Linear Progress').fontSize(9).fontColor(0xCCCCCC).width('90%')
Progress({ value: 20,
total: 150 ,
style: ProgressStyle.Linear }).width(200).value(this.value).key('LPValue')
Progress({ value: 20, style: ProgressStyle.Linear }).width(200).value(this.value).key('LPValue')
Progress({ value: 20, total: 150, style: ProgressStyle.Linear }).color(Color.Red).width(200)
Text('Eclipse Progress').fontSize(40).fontColor(0x0F0F0F).width('90%')
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/List.test.ets
浏览文件 @
ee562c51
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
...
...
@@ -44,8 +45,7 @@ import borderJsunit from './general-properties/BorderJsunit.test.ets';
import flexJsunit from './general-properties/FlexJsunit.test.ets';
import gridJsunit from './GridJsunit.test.ets';
import canvasJsunit from './CanvasJsunit.test.ets';
import rotationGestureJsUnit from './general-properties/RotationGestureJsunit.test.ets';
import textJsunit from './textJsunit.test.ets';
import textJsunit from './TextJsunit.test.ets';
import badgeJsunit from './BadgeJsunit.test.ets';
import longPressGestureJsUnit from './LongPressGesture.test.ets';
import buttonJsunit from './ButtonJsunit.test.ets';
...
...
@@ -89,7 +89,6 @@ export default function testsuite() {
borderJsunit();
flexJsunit();
gridJsunit();
rotationGestureJsUnit();
textJsunit();
badgeJsunit();
canvasJsunit();
...
...
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/ProgressJsunit.test.ets
浏览文件 @
ee562c51
...
...
@@ -53,7 +53,7 @@ export default function progressJsunit() {
try {
let eventData = {
data: {
"value":
88
"value":
100
}
}
var innerEvent = {
...
...
@@ -69,7 +69,7 @@ export default function progressJsunit() {
let strJson = getInspectorByKey('LPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_100 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("
88
.000000");
expect(obj.$attrs.value).assertEqual("
100
.000000");
console.info('testProgress_100 END');
done();
});
...
...
@@ -94,7 +94,7 @@ export default function progressJsunit() {
try {
let eventData = {
data: {
"value":
74
"value":
100
}
}
var innerEvent = {
...
...
@@ -110,7 +110,7 @@ export default function progressJsunit() {
let strJson = getInspectorByKey('EPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_300 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("
74
.000000");
expect(obj.$attrs.value).assertEqual("
100
.000000");
console.info('testProgress_300 END');
done();
});
...
...
@@ -135,7 +135,7 @@ export default function progressJsunit() {
try {
let eventData = {
data: {
"value":
61
"value":
100
}
}
var innerEvent = {
...
...
@@ -151,7 +151,7 @@ export default function progressJsunit() {
let strJson = getInspectorByKey('EPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_500 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("
61
.000000");
expect(obj.$attrs.value).assertEqual("
100
.000000");
console.info('testProgress_500 END');
done();
});
...
...
@@ -166,5 +166,95 @@ export default function progressJsunit() {
console.info('testProgress_600 END');
done();
});
it('testProgress_700', 0, async function (done) {
console.info('testProgress_700 START');
let strJson1 = getInspectorByKey('LPValue');
let objLP = JSON.parse(strJson1);
console.info("testProgress_700 component objLP is: " + objLP.$attrs.value);
await Utils.sleep(1000);
try {
let eventData = {
data: {
"value": 0
}
}
var innerEvent = {
eventId: 42,
priority: events_emitter.EventPriority.LOW
}
console.info("testProgress_700 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testProgress_700 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('LPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_700 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("0.000000");
console.info('testProgress_700 END');
done();
});
it('testProgress_800', 0, async function (done) {
console.info('testProgress_800 START');
let strJson1 = getInspectorByKey('EPValue');
let objEP = JSON.parse(strJson1);
console.info("testProgress_800 component objEP is: " + objEP.$attrs.value);
await Utils.sleep(1000);
try {
let eventData = {
data: {
"value": 0
}
}
var innerEvent = {
eventId: 41,
priority: events_emitter.EventPriority.LOW
}
console.info("testProgress_800 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testProgress_800 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('EPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_800 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("0.000000");
console.info('testProgress_800 END');
done();
});
it('testProgress_900', 0, async function (done) {
console.info('testProgress_900 START');
let strJson1 = getInspectorByKey('CPValue');
let objCP = JSON.parse(strJson1);
console.info("testProgress_900 component objCP is: " + objCP.$attrs.value);
await Utils.sleep(1000);
try {
let eventData = {
data: {
"value": 0
}
}
var innerEvent = {
eventId: 40,
priority: events_emitter.EventPriority.LOW
}
console.info("testProgress_900 start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("testProgress_900 change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('EPValue');
let obj = JSON.parse(strJson);
console.info("testProgress_900 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.value).assertEqual("0.000000");
console.info('testProgress_900 END');
done();
});
})
}
\ No newline at end of file
ace/ace_ets_component/entry/src/main/ets/MainAbility/test/general-properties/RotationGestureJsunit.test.ets
已删除
100755 → 0
浏览文件 @
1afabe1d
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
import Utils from '../Utils';
import events_emitter from '@ohos.events.emitter';
export default function rotationGestureJsUnit() {
describe('rotationGestureTest', function () {
var x_value;
var y_value;
beforeEach(async function (done) {
let options = {
uri: 'pages/general-properties/rotationGesture',
}
try {
router.clear();
let pages = router.getState();
console.info("get rotationGesture state success " + JSON.stringify(pages));
if (!("rotationGesture" == pages.name)) {
console.info("get rotationGesture state name " + JSON.stringify(pages.name));
let result = await router.push(options);
await Utils.sleep(1000);
console.info("push rotationGesture page result " + JSON.stringify(result));
}
} catch (err) {
console.error("push rotationGesture page error " + JSON.stringify(result));
}
done()
});
afterEach(async function () {
await Utils.sleep(1000);
console.info("rotationGesture after each called");
});
it('rotationGestureTest_0100', 0, async function (done) {
console.info('rotationGestureTest_0100 START');
let strJson = getInspectorByKey('gesture');
console.info("rotationGestureTest_0100 component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("rotationGestureTest_0100 component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Flex');
console.info('rotationGestureTest_0100 END');
done();
});
it('rotationGestureTest_0200', 0, async function (done) {
console.info('rotationGestureTest_0200 START');
let rect = await Utils.getComponentRect('gesture')
console.info("rotationGestureTest_0200 rectInfo is " + JSON.stringify(rect));
x_value = rect.left + (rect.right - rect.left) / 20
y_value = rect.top + (rect.bottom - rect.top) / 20
console.info("rotationGestureTest_0200 onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value);
let point: TouchObject = {
id: 2,
x: x_value,
y: y_value,
type: TouchType.Down,
}
await Utils.sleep(1000)
var callback = (eventData) => {
console.info("rotationGestureTest_0200 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual(true)
expect(eventData.data.EVENT_TYPE).assertEqual('Down')
}
var innerEvent = {
eventId: 56,
priority: events_emitter.EventPriority.LOW
}
try {
events_emitter.on(innerEvent, callback)
} catch (err) {
console.info("rotationGestureTest_0200 on events_emitter err : " + JSON.stringify(err));
}
console.info('rotationGestureTest_0200 testSendTouchEvent ' + sendTouchEvent(point));
await Utils.sleep(1000)
console.info('rotationGestureTest_0200 END');
done();
});
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录