提交 dc12624e 编写于 作者: B bayanxing

ace_ets_component部分用例未走回调便判断pass问题修复

Signed-off-by: Nbayanxing <bayanxing@kaihong.com>
上级 e84cc522
......@@ -22,7 +22,7 @@ import prompt from '@system.prompt'
@Component
struct AppearExample {
@State isShow: boolean = true
@State appearFlag: boolean = false
@State appearFlag: string = "appearStatusOff"
@State disAppearFlag: boolean = false
private changeAppear: string = 'Hide Text'
private myText: string = 'Text for onAppear'
......@@ -52,26 +52,41 @@ struct AppearExample {
.key('appear')
.onClick(() => {
this.isShow = !this.isShow
try {
var backData = {
data: {
"ACTION": this.isShow,
}
}
var backEvent = {
eventId: 58,
priority: events_emitter.EventPriority.LOW
}
console.info("appearFlag start to emit action state")
events_emitter.emit(backEvent, backData)
} catch {
console.info("appearFlag emit action state err: " + JSON.stringify(err.message))
}
}).margin(3).backgroundColor(0x2788D9)
if (this.isShow) {
Text(this.myText)
.onAppear(() => {
this.appearFlag = true
this.appearFlag = "appearStatusOn"
this.changeAppear = 'Show Text'
console.info('appearFlag current action state is: ' + this.appearFlag);
prompt.showToast({ message: 'The text is shown', duration: 2000 })
try {
var backData = {
var backData2 = {
data: {
"ACTION": this.appearFlag,
"APPEAR": this.appearFlag,
}
}
var backEvent = {
var backEvent2 = {
eventId: 59,
priority: events_emitter.EventPriority.LOW
}
console.info("appearFlag start to emit action state")
events_emitter.emit(backEvent, backData)
events_emitter.emit(backEvent2, backData2)
} catch {
console.info("appearFlag emit action state err: " + JSON.stringify(err.message))
}
......@@ -82,17 +97,17 @@ struct AppearExample {
console.info('disAppearFlag current action state is: ' + this.disAppearFlag);
prompt.showToast({ message: 'The text is hidden', duration: 2000 })
try {
var backData = {
var backData1 = {
data: {
"ACTION": this.disAppearFlag,
}
}
var backEvent = {
var backEvent1 = {
eventId: 60,
priority: events_emitter.EventPriority.LOW
}
console.info("disAppearFlag start to emit action state")
events_emitter.emit(backEvent, backData)
events_emitter.emit(backEvent1, backData1)
} catch {
console.info("disAppearFlag emit action state err: " + JSON.stringify(err.message))
}
......
......@@ -54,17 +54,17 @@ struct AreaExample {
this.onActionCalled = true;
console.info('onAreaChange current action state is: ' + this.onActionCalled);
try {
var backData = {
var backData1 = {
data: {
"ACTION": this.onActionCalled,
}
}
var backEvent = {
var backEvent1 = {
eventId: 62,
priority: events_emitter.EventPriority.LOW
}
console.info("onAreaChange start to emit action state")
events_emitter.emit(backEvent, backData)
events_emitter.emit(backEvent1, backData1)
} catch (err) {
console.info("onAreaChange emit action state err: " + JSON.stringify(err.message))
}
......
......@@ -210,7 +210,7 @@ struct SwiperExample {
this.loop = eventData.data.loop;
}
if (eventData.data.duration != null) {
this.duration = parseInt(eventData.data.duration);
this.duration = eventData.data.duration;
}
if (eventData.data.vertical != null) {
this.vertical = eventData.data.vertical;
......
......@@ -22,25 +22,6 @@ import events_emitter from '@ohos.events.emitter';
struct TouchAbleExample {
@State text1: string = '';
@State text2: string = '';
@State touchableValue: boolean = false;
private stateChangCallBack = (eventData) => {
console.info("[TouchAble] page stateChangCallBack");
if (eventData != null) {
console.info("[TouchAble] page state change called:" + JSON.stringify(eventData));
if (eventData.data.touchableValue != null) {
this.touchableValue = eventData.data.touchableValue;
}
}
}
onPageShow() {
console.info('[TouchAble] page show called');
var stateChangeEvent = {
eventId: 44,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(stateChangeEvent, this.stateChangCallBack);
}
build() {
Stack() {
......@@ -52,6 +33,7 @@ struct TouchAbleExample {
console.info(this.text1 = 'Rect Clicked')
})
.overlay(this.text1, { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
Ellipse()
.fill(Color.Pink)
.width(150)
......
......@@ -51,58 +51,57 @@ export default function appearJsunit() {
console.info('[testAppear01] START');
await Utils.sleep(1000);
try {
let callBackAppear = (backData) => {
console.info("testAppear01 get appearEvent result is: " + JSON.stringify(appearEvent));
expect(backData.data.ACTION).assertEqual(true);
let callBackAppear1 = (backData) => {
console.info("testAppear01 get appearEvent result is: " + JSON.stringify(backData));
expect(backData.data.ACTION).assertEqual(false);
done();
}
var appearEvent = {
var appearEvent1 = {
eventId: 58,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(appearEvent, callBackAppear);
events_emitter.on(appearEvent1, callBackAppear1);
} catch (err) {
console.info("testAppear01 on appearEvent err : " + JSON.stringify(err));
}
console.info("testAppear01 click result is: " + JSON.stringify(sendEventByKey('appear', 10, "")));
console.info('[testAppear01] END');
done();
});
it('testAppear02', 0, async function (done) {
console.info('[testAppear02] START');
await Utils.sleep(1000);
try {
let callBackAppear = (backData) => {
console.info("testAppear02 get appearEvent result is: " + JSON.stringify(appearEvent));
expect(backData.data.ACTION).assertEqual(true);
let callBackDisAppear = (backData1) => {
console.info("testAppear02 get disAppearEvent result is: " + JSON.stringify(backData1));
console.info("testAppear02 get backData1.data.ACTION result is: " + backData1.data.ACTION);
expect(backData1.data.ACTION).assertEqual(true);
done();
}
var appearEvent = {
eventId: 59,
var disAppearEvent = {
eventId: 60,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(appearEvent, callBackAppear);
events_emitter.on(disAppearEvent, callBackDisAppear);
} catch (err) {
console.info("testAppear02 on appearEvent err : " + JSON.stringify(err));
console.info("testAppear02 on disAppearEvent err : " + JSON.stringify(err));
}
console.info("testAppear02 appearEvent click result is: " + JSON.stringify(sendEventByKey('appear', 10, "")));
try {
let callBackDisAppear = (backData) => {
console.info("testAppear02 get disAppearEvent result is: " + JSON.stringify(disAppearEvent));
expect(backData.data.ACTION).assertEqual(true);
await Utils.sleep(1000);
console.info('[testAppear03] START');
let callBackAppear2 = (backData2) => {
console.info("testAppear03 get appearEvent result is: " + JSON.stringify(backData2));
console.info("testAppear03 get backData2.data.APPEAR: " + backData2.data.APPEAR);
expect(backData2.data.APPEAR).assertEqual("appearStatusOn");
done();
}
var disAppearEvent = {
eventId: 60,
var appearEvent2 = {
eventId: 59,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(disAppearEvent, callBackDisAppear);
try {
console.info("testAppear03 appearEvent click result is: " + JSON.stringify(sendEventByKey('appear', 10, "")));
events_emitter.on(appearEvent2, callBackAppear2);
} catch (err) {
console.info("testAppear02 on disAppearEvent err : " + JSON.stringify(err));
console.info("testAppear03 on appearEvent err : " + JSON.stringify(err));
}
console.info("testAppear02 disAppearEvent click result is: " + JSON.stringify(sendEventByKey('appear', 10, "")));
console.info('[testAppear02] END');
done();
});
})
}
......@@ -48,9 +48,10 @@ export default function areaChangeJsunit() {
it('areaChangeTest_0300', 0, async function (done) {
console.info('areaChangeTest_0300 START');
await Utils.sleep(1000);
let callback = (indexEvent) => {
console.info("areaChangeTest_0300 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.value).assertEqual('TextText');
let callback = (backData) => {
console.info("areaChangeTest_0300 get state result is: " + JSON.stringify(backData));
expect(backData.data.value).assertEqual('TextText');
done();
}
let indexEvent = {
eventId: 61,
......@@ -61,44 +62,24 @@ export default function areaChangeJsunit() {
} catch (err) {
console.info("areaChangeTest_0300 on events_emitter err : " + JSON.stringify(err));
}
console.info("areaChangeTest_0300 click result is: " + JSON.stringify(sendEventByKey('text1', 10, "")));
var innerEventOne = {
eventId: 62,
priority: events_emitter.EventPriority.LOW
}
await Utils.sleep(1500);
var callback1 = (eventData) => {
console.info("areaChangeTest_0300 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual(true);
}
try {
events_emitter.on(innerEventOne, callback1);
} catch (err) {
console.info("areaChangeTest_0300 on events_emitter err : " + JSON.stringify(err));
}
console.info('areaChangeTest_0300 END');
done();
});
it('areaChangeTest_0400', 0, async function (done) {
console.info('areaChangeTest_0400 START');
await Utils.sleep(1000);
let callback = (indexEvent) => {
console.info("areaChangeTest_0400 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.value).assertEqual('TextTextText');
let callback1 = (eventData) => {
console.info("areaChangeTest_0400 get state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual(true);
done();
}
let indexEvent = {
let indexEvent1 = {
eventId: 62,
priority: events_emitter.EventPriority.LOW
}
try {
events_emitter.on(indexEvent, callback);
events_emitter.on(indexEvent1, callback1);
} catch (err) {
console.info("areaChangeTest_0400 on events_emitter err : " + JSON.stringify(err));
}
console.info("areaChangeTest_0400 click result is: " + JSON.stringify(sendEventByKey('text1', 10, "")));
console.info('areaChangeTest_0400 END');
done();
console.info("areaChangeTest_0300 click result is: " + JSON.stringify(sendEventByKey('text1', 10, "")));
});
})
}
......@@ -52,6 +52,7 @@ export default function marqueeJsunit() {
let callback = (indexEvent) => {
console.info("testMarquee_0100 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.start).assertEqual(true);
done();
}
let indexEvent = {
eventId: 130,
......@@ -67,6 +68,7 @@ export default function marqueeJsunit() {
var callback1 = (eventData) => {
console.info("testMarquee_0100 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.fontColor).assertEqual(Color.Blue);
done();
}
var innerEventOne = {
eventId: 127,
......@@ -78,7 +80,6 @@ export default function marqueeJsunit() {
console.info("testMarquee_0100 on events_emitter err : " + JSON.stringify(err));
}
console.info('testMarquee_0100 END');
done();
});
it('testMarquee_0200', 0, async function (done) {
......@@ -87,6 +88,7 @@ export default function marqueeJsunit() {
let callback = (indexEvent) => {
console.info("testMarquee_0200 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.start).assertEqual(true);
done();
}
let indexEvent = {
eventId: 130,
......@@ -102,6 +104,7 @@ export default function marqueeJsunit() {
var callback1 = (eventData) => {
console.info("testMarquee_0200 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.fontSize).assertEqual(50);
done();
}
var innerEventOne = {
eventId: 128,
......@@ -113,7 +116,6 @@ export default function marqueeJsunit() {
console.info("testMarquee_0200 on events_emitter err : " + JSON.stringify(err));
}
console.info('testMarquee_0200 END');
done();
});
it('testMarquee_0300', 0, async function (done) {
......@@ -122,6 +124,7 @@ export default function marqueeJsunit() {
let callback = (indexEvent) => {
console.info("testMarquee_0300 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.start).assertEqual(true);
done();
}
let indexEvent = {
eventId: 130,
......@@ -137,6 +140,7 @@ export default function marqueeJsunit() {
var callback1 = (eventData) => {
console.info("testMarquee_0300 get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual(true);
done();
}
var innerEventOne = {
eventId: 129,
......@@ -148,7 +152,6 @@ export default function marqueeJsunit() {
console.info("testMarquee_0300 on events_emitter err : " + JSON.stringify(err));
}
console.info('testMarquee_0300 END');
done();
});
})
}
\ No newline at end of file
......@@ -164,6 +164,7 @@ export default function swiperJsunit() {
let callback = (indexEvent) => {
console.info("swiperTest_0800 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.ACTION).assertEqual(true);
done();
}
let indexEvent = {
eventId: 205,
......@@ -177,7 +178,6 @@ export default function swiperJsunit() {
console.info("swiperTest_0800 click result is: " + JSON.stringify(sendEventByKey('button1', 10, "")));
await Utils.sleep(1000);
console.info('swiperTest_0800 END');
done();
});
it('swiperTest_0900', 0, async function (done) {
......@@ -186,6 +186,7 @@ export default function swiperJsunit() {
let callback = (indexEvent) => {
console.info("swiperTest_0900 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.ACTION).assertEqual(true);
done();
}
let indexEvent = {
eventId: 206,
......@@ -199,7 +200,6 @@ export default function swiperJsunit() {
console.info("swiperTest_0900 click result is: " + JSON.stringify(sendEventByKey('button2', 10, "")));
await Utils.sleep(1000);
console.info('swiperTest_0900 END');
done();
});
it('swiperTest_1000', 0, async function (done) {
......@@ -208,6 +208,7 @@ export default function swiperJsunit() {
let callbackOne = (indexEventOne) => {
console.info("swiperTest_1000 get state result is: " + JSON.stringify(indexEventOne));
expect(indexEventOne.data.ACTION).assertEqual(true);
done();
}
let indexEventOne = {
eventId: 206,
......@@ -223,6 +224,7 @@ export default function swiperJsunit() {
let callback = (indexEvent) => {
console.info("swiperTest_1000 get state result is: " + JSON.stringify(indexEvent));
expect(indexEvent.data.ACTION).assertEqual(true);
done();
}
let indexEvent = {
eventId: 204,
......@@ -234,7 +236,6 @@ export default function swiperJsunit() {
console.info("swiperTest_1000 on events_emitter err : " + JSON.stringify(err));
}
console.info('swiperTest_1000 END');
done();
});
it('swiperTest_1100', 0, async function (done) {
......
......@@ -60,6 +60,8 @@ export default function touchAbleJsunit() {
var callbackTwo = (eventData) => {
console.info("[testTouchAble002] get event state result is: " + JSON.stringify(eventData));
expect(eventData.data.ACTION).assertEqual('Ellipse Clicked')
console.info('[testTouchAble002] END');
done();
}
var innerEventTwo = {
eventId: 237,
......@@ -70,10 +72,7 @@ export default function touchAbleJsunit() {
} catch (err) {
console.info("[testTouchAble002] on events_emitter err : " + JSON.stringify(err));
}
console.info('[testClickEvent001] sendEventByKey ' + JSON.stringify(sendEventByKey('ellipse', 10, "")));
await Utils.sleep(1000)
console.info('[testTouchAble002] END');
done();
console.info("testClickEvent002 click result is: " + JSON.stringify(sendEventByKey('ellipse', 10, "")));
});
})
}
\ No newline at end of file
......@@ -55,6 +55,7 @@ export default function touchJsunit() {
console.info("testTouch01 get backEvent result is: " + JSON.stringify(backEvent));
console.info("testTouch01 get flag result is: " + JSON.stringify(backData.data.ACTION));
expect(backData.data.ACTION).assertEqual(true);
done();
}
var backEvent = {
eventId: 43,
......@@ -66,7 +67,6 @@ export default function touchJsunit() {
}
console.info("testTouch01 click result is: " + JSON.stringify(sendEventByKey('touch', 10, "")));
console.info('[testTouch01] END');
done();
});
})
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册