提交 1a9b24e2 编写于 作者: B bayanxing

解决ace_ets_component_three部分用例无效及存在断言设置错误、eventId冲突等问题

Signed-off-by: Nbayanxing <bayanxing@kaihong.com>
上级 3de19324
......@@ -115,6 +115,29 @@ struct ButtonExample {
console.info("button3 emit action state err: " + JSON.stringify(err.message))
}
})
Button('button4')
.key('button4')
.backgroundColor(0x317aff)
.width(90)
.fontColor(this.fontColorValue)
.onClick(() => {
try {
var backData = {
data: {
"fontColorValue": this.fontColorValue,
}
}
var backEvent = {
eventId: 77996,
priority: events_emitter.EventPriority.LOW
}
console.info("button4 start to emit action state")
events_emitter.emit(backEvent, backData)
} catch (err) {
console.info("button4 emit action state err: " + JSON.stringify(err.message))
}
})
Button('Click')
.backgroundColor(0x2788D9)
.width(200)
......
......@@ -32,7 +32,7 @@ struct GestureSettingsExample {
}
}
var backEvent = {
eventId: 50,
eventId: 150,
priority: events_emitter.EventPriority.LOW
}
console.info("click to emit action state")
......
......@@ -52,6 +52,7 @@ export default function aboutToDisappearJsunit() {
let callback = (indexEvent) => {
console.info("aboutToDisappearTest_0100 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.ACTION).assertEqual(false);
done();
}
let indexEvent = {
eventId: 49,
......@@ -65,7 +66,6 @@ export default function aboutToDisappearJsunit() {
console.info("aboutToDisappearTest_0100 click result is: " + JSON.stringify(sendEventByKey('button1', 10, "")));
await Utils.sleep(1000);
console.info('aboutToDisappearTest_0100 END');
done();
});
})
}
......@@ -55,7 +55,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_0100 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.duration).assertEqual('100')
expect(indexEvent.data.duration).assertEqual('100')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -76,8 +76,8 @@ export default function animateJsunit() {
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.curve).assertEqual('Ease')
console.info("animateTest_0200 get state result is: " + JSON.stringify(indexEvent))
expect(indexEvent.data.curve).assertEqual('Ease')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -98,8 +98,8 @@ export default function animateJsunit() {
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.iteration).assertEqual('1')
console.info("animateTest_0300 get state result is: " + JSON.stringify(indexEvent))
expect(indexEvent.data.iteration).assertEqual('1')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -121,7 +121,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_0400 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.tempo).assertEqual(1000)
expect(indexEvent.data.tempo).assertEqual(1000)
}
try {
events_emitter.on(indexEvent, callback);
......@@ -143,7 +143,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.playmode).assertEqual('normal')
expect(indexEvent.data.playmode).assertEqual('normal')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -179,7 +179,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_0600 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.duration).assertEqual('2000')
expect(indexEvent.data.duration).assertEqual(2000)
}
try {
events_emitter.on(indexEvent, callback);
......@@ -215,7 +215,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_0700 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.curve).assertEqual('Linear')
expect(indexEvent.data.curve).assertEqual('Linear')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -251,7 +251,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_0800 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.iteration).assertEqual('2')
expect(indexEvent.data.iteration).assertEqual('2')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -287,7 +287,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_0900 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.tempo).assertEqual('20000')
expect(indexEvent.data.tempo).assertEqual('20000')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -323,7 +323,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_1000 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.playmode).assertEqual('alternate')
expect(indexEvent.data.playmode).assertEqual('alternate')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -359,7 +359,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_1100 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.duration).assertEqual('-1000')
expect(indexEvent.data.duration).assertEqual('-1000')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -395,7 +395,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_1200 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.duration).assertEqual('100000000')
expect(indexEvent.data.duration).assertEqual('100000000')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -431,7 +431,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_1300 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.curve).assertEqual('123')
expect(indexEvent.data.curve).assertEqual('123')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -467,7 +467,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_1400 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.curve).assertEqual('abc')
expect(indexEvent.data.curve).assertEqual('abc')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -503,7 +503,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_1500 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.iteration).assertEqual('121212121212')
expect(indexEvent.data.iteration).assertEqual('121212121212')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -539,7 +539,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_1600 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.iteration).assertEqual('-5')
expect(indexEvent.data.iteration).assertEqual('-5')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -575,7 +575,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_1700 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.tempo).assertEqual('12121212121212')
expect(indexEvent.data.tempo).assertEqual('12121212121212')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -611,7 +611,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_1800 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.tempo).assertEqual('-5')
expect(indexEvent.data.tempo).assertEqual('-5')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -647,7 +647,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_1900 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.playmode).assertEqual('aaa')
expect(indexEvent.data.playmode).assertEqual('aaa')
}
try {
events_emitter.on(indexEvent, callback);
......@@ -683,7 +683,7 @@ export default function animateJsunit() {
}
let callback = (indexEvent) => {
console.info("animateTest_2000 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.playmode).assertEqual('123456')
expect(indexEvent.data.playmode).assertEqual('123456')
}
try {
events_emitter.on(indexEvent, callback);
......
......@@ -42,6 +42,11 @@ export default function buttonJsunit() {
done()
});
beforeEach(async function () {
await Utils.sleep(1000);
console.info("button before each called");
})
afterEach(async function () {
await Utils.sleep(1000);
console.info("button after each called");
......@@ -65,7 +70,7 @@ export default function buttonJsunit() {
let obj = JSON.parse(strJson);
console.info("[testButton02] component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Button');
expect(obj.$attrs.type).assertEqual('ButtonType.Normal');
expect(obj.$attrs.type).assertEqual('ButtonType.Capsule');
done();
});
......@@ -243,7 +248,8 @@ export default function buttonJsunit() {
}
let callback = (indexEvent) => {
console.info("testButton10 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.fontColorValue).assertEqual(Color.Pink)
expect(indexEvent.data.fontColorValue).assertEqual(Color.Pink)
done();
}
try {
events_emitter.on(indexEvent, callback);
......@@ -253,7 +259,6 @@ export default function buttonJsunit() {
console.info("testButton10 click result is: " + JSON.stringify(sendEventByKey('button3', 10, "")));
await Utils.sleep(1000);
console.info('[testButton10] END');
done();
});
it('testButton11', 0, async function (done) {
......@@ -280,7 +285,8 @@ export default function buttonJsunit() {
}
let callback = (indexEvent) => {
console.info("testButton11 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.fontColorValue).assertEqual(332)
expect(indexEvent.data.fontColorValue).assertEqual(332)
done();
}
try {
events_emitter.on(indexEvent, callback);
......@@ -290,7 +296,6 @@ export default function buttonJsunit() {
console.info("testButton11 click result is: " + JSON.stringify(sendEventByKey('button2', 10, "")));
await Utils.sleep(1000);
console.info('[testButton11] END');
done();
});
it('testButton12', 0, async function (done) {
......@@ -305,6 +310,7 @@ export default function buttonJsunit() {
expect(event.screenY).assertEqual(485)
expect(event.x).assertEqual(100)
expect(event.y).assertEqual(50)
done();
}
var innerEvent = {
eventId: 4,
......@@ -318,7 +324,6 @@ export default function buttonJsunit() {
console.info('[testButton12] sendEventByKey ' + JSON.stringify(sendEventByKey('buttonClick', 10, "")));
await Utils.sleep(1000)
console.info('[testButton12] testSendTouchEvent END');
done();
});
it('testButton13', 0, async function (done) {
......@@ -378,7 +383,7 @@ export default function buttonJsunit() {
try {
let eventData = {
data: {
"fontColorValue": ab996
"fontColorValue": "ab996"
}
}
let indexEventOne = {
......@@ -390,14 +395,17 @@ export default function buttonJsunit() {
} catch (err) {
console.log("testButton15 change component data error: " + err.message);
}
await Utils.sleep(1000);
await Utils.sleep(500);
let indexEvent = {
eventId: 77,
eventId: 77996,
priority: events_emitter.EventPriority.LOW
}
let callback = (indexEvent) => {
console.info("testButton15 get state result is: " + JSON.stringify(indexEvent))
except(indexEvent.data.fontColorValue).assertEqual('ab996')
console.info("testButton15 indexEvent.data.fontColorValue is: " + indexEvent.data.fontColorValue)
expect(indexEvent.data.fontColorValue).assertEqual('ab996')
console.info('[testButton15] END');
done();
}
try {
events_emitter.on(indexEvent, callback);
......@@ -405,9 +413,6 @@ export default function buttonJsunit() {
console.info("testButton15 on events_emitter err : " + JSON.stringify(err));
}
console.info("testButton15 click result is: " + JSON.stringify(sendEventByKey('button4', 10, "")));
await Utils.sleep(1000);
console.info('[testButton15] END');
done();
});
})
}
\ No newline at end of file
......@@ -52,6 +52,7 @@ export default function longPressGestureJsunit() {
let callback = (eventData) => {
console.info("testLongPressGesture01 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual('onAction')
done();
}
let innerEvent = {
eventId: 125,
......@@ -75,6 +76,7 @@ export default function longPressGestureJsunit() {
let callback = (eventData) => {
console.info("testLongPressGesture02 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual('onActionEnd')
done();
}
let innerEvent = {
eventId: 126,
......@@ -89,7 +91,6 @@ export default function longPressGestureJsunit() {
console.info("testLongPressGesture02 sendEventByKey result: " + JSON.stringify(sendEventByKey('flex', 11, "")));
await Utils.sleep(1000);
console.info('testLongPressGesture02 END');
done();
});
})
}
......@@ -62,6 +62,7 @@ export default function motionPathJsunit() {
console.info("motionPathTest_0200 get state result is: " + JSON.stringify(indexEventOne));
expect(indexEventOne.data.fromX).assertEqual(0);
expect(indexEventOne.data.toY).assertEqual(1);
done();
}
let indexEventOne = {
eventId: 133,
......@@ -84,6 +85,7 @@ export default function motionPathJsunit() {
let callback = (indexEvent) => {
console.info("motionPathTest_0300 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.ACTION).assertEqual(true);
done();
}
let indexEvent = {
eventId: 132,
......@@ -97,7 +99,6 @@ export default function motionPathJsunit() {
console.info("motionPathTest_0300 click result is: " + JSON.stringify(sendEventByKey('button', 10, "")));
await Utils.sleep(1000);
console.info('motionPathTest_0300 END');
done();
});
})
}
......@@ -87,6 +87,7 @@ export default function ResponseRegionJsunit() {
console.info("[testResponseRegion02] get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual(true)
expect(eventData.data.EVENT_TYPE).assertEqual('Down')
done();
}
var innerEventTwo = {
eventId: 31,
......@@ -100,7 +101,6 @@ export default function ResponseRegionJsunit() {
console.info('[testResponseRegion02] testSendTouchEvent ' + sendTouchEvent(point));
await Utils.sleep(1000)
console.info('[testResponseRegion02] END');
done();
});
})
}
......@@ -286,6 +286,7 @@ export default function tabsJsunit() {
let callback = (indexEvent) => {
console.info("testTabs_1400 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.ACTION).assertEqual(true);
done();
}
let indexEvent = {
eventId: 212,
......@@ -299,7 +300,6 @@ export default function tabsJsunit() {
console.info("testTabs_1400 click result is: " + JSON.stringify(sendEventByKey('tabContent1', 10, "")));
await Utils.sleep(1000);
console.info('testTabs_1400 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.
先完成此消息的编辑!
想要评论请 注册