未验证 提交 dfbfe0c7 编写于 作者: O openharmony_ci 提交者: Gitee

!9662 【ACE子系统】修改测试用例

Merge pull request !9662 from hekun/master
......@@ -45,120 +45,6 @@ export default function textStyleJsunit() {
console.info("textStyle after each called");
});
it('testTextStyle001', 0, async function (done) {
console.info('[testTextStyle001] START');
await Utils.sleep(1000);
let strJson = getInspectorByKey('fontColor');
console.info("[testTextStyle001] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testTextStyle001] fontColor: " + obj.$attrs.fontColor);
expect(obj.$attrs.fontColor).assertEqual('#FF000000');
done();
});
it('testTextStyle002', 0, async function (done) {
console.info('[testTextStyle002] START');
try {
let eventData = {
data: {
"fontColor": Color.Blue
}
}
let indexEvent = {
eventId: 37,
priority: events_emitter.EventPriority.LOW
}
console.info("[testTextStyle002] start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("[testTextStyle002] change component data error: " + err.message);
}
await Utils.sleep(3000);
let strJson = getInspectorByKey('fontColor');
console.info("[testTextStyle002] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testTextStyle002] fontColor: " + obj.$attrs.fontColor);
expect(obj.$attrs.fontColor).assertEqual('#FF000000');
done();
});
it('testTextStyle003', 0, async function (done) {
console.info('[testTextStyle003] START');
try {
let eventData = {
data: {
"fontColor": 0x80000000
}
}
let indexEvent = {
eventId: 37,
priority: events_emitter.EventPriority.LOW
}
console.info("[testTextStyle003] start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("[testTextStyle003] change component data error: " + err.message);
}
await Utils.sleep(3000);
let strJson = getInspectorByKey('fontColor');
console.info("[testTextStyle003] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testTextStyle003] fontColor: " + obj.$attrs.fontColor);
expect(obj.$attrs.fontColor).assertEqual('#FF000000');
done();
});
it('testTextStyle004', 0, async function (done) {
console.info('[testTextStyle004] START');
try {
let eventData = {
data: {
"fontColor": 0x7FFFFFFF
}
}
let indexEvent = {
eventId: 37,
priority: events_emitter.EventPriority.LOW
}
console.info("[testTextStyle004] start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("[testTextStyle004] change component data error: " + err.message);
}
await Utils.sleep(3000);
let strJson = getInspectorByKey('fontColor');
console.info("[testTextStyle004] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testTextStyle004] fontColor: " + obj.$attrs.fontColor);
expect(obj.$attrs.fontColor).assertEqual('#FF000000');
done();
});
it('testTextStyle005', 0, async function (done) {
console.info('[testTextStyle005] START');
try {
let eventData = {
data: {
"fontColor": 'error'
}
}
let indexEvent = {
eventId: 37,
priority: events_emitter.EventPriority.LOW
}
console.info("[testTextStyle005] start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("[testTextStyle005] change component data error: " + err.message);
}
await Utils.sleep(4000);
let strJson = getInspectorByKey('fontColor');
console.info("[testTextStyle005] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testTextStyle005] fontColor: " + obj.$attrs.fontColor);
expect(obj.$attrs.fontColor).assertEqual('#FF000000');
done();
});
it('testTextStyle006', 0, async function (done) {
console.info('[testTextStyle006] START');
......
......@@ -18,7 +18,7 @@ import events_emitter from '@ohos.events.emitter'
@Component
struct TextExample {
@State fontSize: number = 9;
@State fontColor: string = "0xCCCCCC";
@State fontColor: string = "#330A59F8";
@State textAlign: TextAlign = TextAlign.Start;
@State textOverflow: TextOverflow = TextOverflow.Clip;
@State decoration: TextDecorationType = TextDecorationType.None;
......
......@@ -183,56 +183,5 @@ export default function spanJsunit() {
done();
});
it('testSpan008', 0, async function (done) {
console.info('[testSpan008] START');
try {
let eventData = {
data: {
"fontColorValue": 'abc'
}
}
let indexEvent = {
eventId: 1031,
priority: events_emitter.EventPriority.LOW
}
console.info("[testSpan008] start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("[testSpan008] change component data error: " + err.message);
}
await Utils.sleep(4000);
let strJson = getInspectorByKey('fontColor');
console.info("[testSpan008] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testSpan008] fontColor:" + obj);
expect(obj.$attrs.fontColor).assertEqual('#FF000990');
done();
});
it('testSpan009', 0, async function (done) {
console.info('[testSpan009] START');
try {
let eventData = {
data: {
"fontColorValue": '-1'
}
}
let indexEvent = {
eventId: 1032,
priority: events_emitter.EventPriority.LOW
}
console.info("[testSpan009] start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("[testSpan009] change component data error: " + err.message);
}
await Utils.sleep(4000);
let strJson = getInspectorByKey('fontColor');
console.info("[testSpan009] component strJson:" + strJson);
let obj = JSON.parse(strJson);
console.info("[testSpan009] fontColor:" + obj);
expect(obj.$attrs.fontColor).assertEqual('#FF000990');
done();
});
})
}
\ No newline at end of file
......@@ -101,7 +101,7 @@ export default function textJsunit() {
let obj = JSON.parse(strJson);
console.info("testText_0400 component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Text');
expect(obj.$attrs.fontColor).assertEqual('#FF000000');
expect(obj.$attrs.fontColor).assertEqual('#330A59F8');
console.info('testText_0400 END');
done();
});
......@@ -217,38 +217,13 @@ export default function textJsunit() {
done();
});
it('testText_1100', 0, async function (done) {
console.info('testText_1100 START');
try {
let eventData = {
data: {
"fontColor": "-a",
}
}
let indexEvent = {
eventId: 230,
priority: events_emitter.EventPriority.LOW
}
console.info("testText_1100 start to publish emit");
events_emitter.emit(indexEvent, eventData);
} catch (err) {
console.log("testText_1100 change component data error: " + err.message);
}
await Utils.sleep(4000);
let strJsonNew = getInspectorByKey('text');
let objNew = JSON.parse(strJsonNew);
console.info("testText_1100 component objNew is: " + JSON.stringify(objNew.$attrs.fontColor));
expect(objNew.$attrs.fontColor).assertEqual('#330A59F7');
console.info('testText_1100 END');
done();
});
it('testText_1200', 0, async function (done) {
console.info('testText_1200 START');
try {
let eventData = {
data: {
"fontColor": "12321321",
"fontColor": "#FFBC0229",
}
}
let indexEvent = {
......
/**
* Copyright (c) 2022 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.
*/
export interface Callback {
(message:any):void
}
export class MessageManager {
callback:Callback
callbacks:Map<string,Callback> = new Map()
constructor() {
}
registerCallback(callback:Callback , type?:string) {
if (type == undefined) {
console.error('registerCallback callback set')
this.callback = callback
return
}
this.callbacks.set(type,callback)
}
notify(message:any, type?:string) {
if (type == undefined) {
this.callback(message)
return
}
let tmpCallback:Callback = this.callbacks.get(type)
if (tmpCallback === undefined) {
console.error('callbacks has no callback for type ' + type)
return
}
tmpCallback(message)
}
clear() {
this.callbacks.clear()
this.callback = null
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册