Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
011dea85
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看板
未验证
提交
011dea85
编写于
8月 09, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 09, 2023
浏览文件
操作
浏览文件
下载
差异文件
!9711 修改由状态变量机制变化导致的Search fail的xts
Merge pull request !9711 from 张潇/dev20230809
上级
b4eff4c2
541981e1
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
108 addition
and
137 deletion
+108
-137
arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestAbility/pages/Index.ets
...component_search/src/main/ets/TestAbility/pages/Index.ets
+43
-1
arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/MessageManager.ets
...ets_component_search/src/main/ets/test/MessageManager.ets
+54
-0
arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/Search.ets
..._ux/ace_ets_component_search/src/main/ets/test/Search.ets
+11
-136
未找到文件。
arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestAbility/pages/Index.ets
浏览文件 @
011dea85
...
...
@@ -18,6 +18,7 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry
import { Hypium } from '@ohos/hypium';
import hilog from '@ohos.hilog';
import testsuite from '../../test/List.test'
import {MessageManager,Callback} from '../../test/MessageManager.ets';
@Entry
@Component
...
...
@@ -103,6 +104,47 @@ struct SliderExample {
this.textColorResource = eventData.data.textColorResource;
}
messageManager:MessageManager = new MessageManager()
onPageShow() {
console.info('search onPageShow')
globalThis.value = {
name:'messageManager',message:this.messageManager
}
let callback:Callback = (message:any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'caretWidthResource') {
this.caretWidthResource = message.value
}
if (message.name == 'caretColorResource') {
this.caretColorResource = message.value
}
if (message.name == 'leftSearchIconColorResource') {
this.leftSearchIconColorResource = message.value
}
if (message.name == 'searchSrcPathResource') {
this.searchSrcPathResource = message.value
}
if (message.name == 'rightCancelIconColorResource') {
this.rightCancelIconColorResource = message.value
}
if (message.name == 'rightIconSrcPathResource') {
this.rightIconSrcPathResource = message.value
}
if (message.name == 'searchButtonFontSizeResource') {
this.searchButtonFontSizeResource = message.value
}
if (message.name == 'searchButtonFontColorResource') {
this.searchButtonFontColorResource = message.value
}
if (message.name == 'textColorResource') {
this.textColorResource = message.value
}
}
this.messageManager.registerCallback(callback)
}
aboutToAppear(){
var stateChangeEvent = {
eventId: 183,
...
...
arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/MessageManager.ets
0 → 100644
浏览文件 @
011dea85
/**
* Copyright (c) 2023 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
}
}
arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/Search.ets
浏览文件 @
011dea85
...
...
@@ -16,6 +16,7 @@
import { describe, beforeEach, afterEach, it, expect } from '@ohos/hypium'
import events_emitter from '@ohos.events.emitter';
import Utils from './Utils.ets';
import {MessageManager,Callback} from './MessageManager';
let emitKey = "emitUserAgent";
export default function search() {
...
...
@@ -298,21 +299,7 @@ export default function search() {
console.info("[ArkUI_Stage_Search_CaretStyle_0600]: " + JSON.stringify(newJson));
let caretWidthResource = $r('sys.float.ohos_id_text_margin_vertical');
try {
var eventData = {
data: {
"caretWidthResource": caretWidthResource
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Stage_Search_CaretStyle_0600] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Stage_Search_CaretStyle_0600] change component data error: " + err.message);
}
globalThis.value.message.notify({name:'caretWidthResource',value:caretWidthResource});
await Utils.sleep(2000);
let strJson = getInspectorByKey('searchTestResource');
...
...
@@ -660,21 +647,7 @@ export default function search() {
console.info("[ArkUI_Stage_Search_CaretStyle_1600]: " + JSON.stringify(newJson));
let caretColorResource = $r('sys.color.ohos_id_color_connected');
try {
var eventData = {
data: {
"caretColorResource": caretColorResource
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Stage_Search_CaretStyle_1600] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Stage_Search_CaretStyle_1600] change component data error: " + err.message);
}
globalThis.value.message.notify({name:'caretColorResource',value:caretColorResource});
await Utils.sleep(2000);
let strJson = getInspectorByKey('searchTestResource');
...
...
@@ -1456,21 +1429,7 @@ export default function search() {
console.info("[ArkUI_Stage_Search_SearchIcon_1700]: " + JSON.stringify(newJson));
let leftSearchIconColorResource = $r('sys.color.ohos_id_color_connected');
try {
var eventData = {
data: {
"leftSearchIconColorResource": leftSearchIconColorResource
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Stage_Search_SearchIcon_1700] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Stage_Search_SearchIcon_1700] change component data error: " + err.message);
}
globalThis.value.message.notify({name:'leftSearchIconColorResource',value:leftSearchIconColorResource});
await Utils.sleep(2000);
let strJson = getInspectorByKey('searchTestResource');
...
...
@@ -1794,21 +1753,7 @@ export default function search() {
console.info("[ArkUI_Stage_Search_SearchIcon_2600]: " + JSON.stringify(newJson));
let searchSrcPathResource = $r('sys.media.ohos_app_icon');
try {
var eventData = {
data: {
"searchSrcPathResource": searchSrcPathResource
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Stage_Search_SearchIcon_2600] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Stage_Search_SearchIcon_2600] change component data error: " + err.message);
}
globalThis.value.message.notify({name:'searchSrcPathResource',value:searchSrcPathResource});
await Utils.sleep(2000);
let strJson = getInspectorByKey('searchTestResource');
...
...
@@ -2746,21 +2691,7 @@ export default function search() {
console.info("[ArkUI_Stage_Search_CancelButton_2200]: " + JSON.stringify(newJson));
let rightCancelIconColorResource = $r('sys.color.ohos_id_color_connected');
try {
var eventData = {
data: {
"rightCancelIconColorResource": rightCancelIconColorResource
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Stage_Search_CancelButton_2200] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Stage_Search_CancelButton_2200] change component data error: " + err.message);
}
globalThis.value.message.notify({name:'rightCancelIconColorResource',value:rightCancelIconColorResource});
await Utils.sleep(2000);
let strJson = getInspectorByKey('searchTestResource');
...
...
@@ -3084,21 +3015,7 @@ export default function search() {
console.info("[ArkUI_Stage_Search_CancelButton_3100]: " + JSON.stringify(newJson));
let rightIconSrcPathResource = $r('sys.media.ohos_app_icon');
try {
var eventData = {
data: {
"rightIconSrcPathResource": rightIconSrcPathResource
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Stage_Search_CancelButton_3100] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Stage_Search_CancelButton_3100] change component data error: " + err.message);
}
globalThis.value.message.notify({name:'rightIconSrcPathResource',value:rightIconSrcPathResource});
await Utils.sleep(2000);
let strJson = getInspectorByKey('searchTestResource');
...
...
@@ -3484,21 +3401,7 @@ export default function search() {
console.info("[ArkUI_Stage_Search_SearchButton_0700]: " + JSON.stringify(newJson));
let searchButtonFontSizeResource = $r('sys.float.ohos_id_text_paragraph_margin_m');
try {
var eventData = {
data: {
"searchButtonFontSizeResource": searchButtonFontSizeResource
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Stage_Search_SearchButton_0700] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Stage_Search_SearchButton_0700] change component data error: " + err.message);
}
globalThis.value.message.notify({name:'searchButtonFontSizeResource',value:searchButtonFontSizeResource});
await Utils.sleep(5000);
let strJson = getInspectorByKey('searchTestResource');
...
...
@@ -3846,21 +3749,7 @@ export default function search() {
console.info("[ArkUI_Stage_Search_SearchButton_1700]: " + JSON.stringify(newJson));
let searchButtonFontColorResource = $r('sys.color.ohos_id_color_connected');
try {
var eventData = {
data: {
"searchButtonFontColorResource": searchButtonFontColorResource
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Stage_Search_SearchButton_1700] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Stage_Search_SearchButton_1700] change component data error: " + err.message);
}
globalThis.value.message.notify({name:'searchButtonFontColorResource',value:searchButtonFontColorResource});
await Utils.sleep(2000);
let strJson = getInspectorByKey('searchTestResource');
...
...
@@ -4180,21 +4069,7 @@ export default function search() {
console.info("[ArkUI_Stage_Search_FontColor_0500]: " + JSON.stringify(newJson));
let textColorResource = $r('sys.color.ohos_id_color_connected');
try {
var eventData = {
data: {
"textColorResource": textColorResource
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Stage_Search_FontColor_0500] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Stage_Search_FontColor_0500] change component data error: " + err.message);
}
globalThis.value.message.notify({name:'textColorResource',value:textColorResource});
await Utils.sleep(2000);
let strJson = getInspectorByKey('searchTestResource');
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录