diff --git a/arkui/ace_ets_components_ux/BUILD.gn b/arkui/ace_ets_components_ux/BUILD.gn index 752d76819d19013a6be42e323336cab93b9773ee..83745e4ef6778c53ffa2270e1ac2f9a05a284910 100644 --- a/arkui/ace_ets_components_ux/BUILD.gn +++ b/arkui/ace_ets_components_ux/BUILD.gn @@ -24,6 +24,7 @@ group("componentUxTest") { "ace_ets_component_popup:ActsAcePopupTest", "ace_ets_component_progress:ActsAceProgressTest", "ace_ets_component_radio:ActsAceRadioTest", + "ace_ets_component_search:ActsAceSearchTest", "ace_ets_component_select:ActsAceSelectTest", "ace_ets_component_sidebar:ActsAceSideBarTest", "ace_ets_component_slider:ActsAceSliderTest", diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/.gitignore b/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..eaf91e2ac647df635a09f01b8a2a254252aae8d7 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/ace_ets_component_search.iml b/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/ace_ets_component_search.iml new file mode 100644 index 0000000000000000000000000000000000000000..18ec59dd70c312989ec67b525207ca8514461e22 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/ace_ets_component_search.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/misc.xml b/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/misc.xml new file mode 100644 index 0000000000000000000000000000000000000000..9715c221cd4910f4d04f53a751b4465092f72024 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/modules.xml b/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..8cb17561ed170262bbf14749f6284698f2a7df4c --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/AppScope/app.json b/arkui/ace_ets_components_ux/ace_ets_component_search/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..6a024514cf829223927c35078d7df643f13867f0 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.acesearchtest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/AppScope/resources/base/element/string.json b/arkui/ace_ets_components_ux/ace_ets_component_search/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..df28c917848f6b974a578bb1cdc3a40d0af261d9 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"MyApplication" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/AppScope/resources/base/media/app_icon.png b/arkui/ace_ets_components_ux/ace_ets_component_search/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_components_ux/ace_ets_component_search/AppScope/resources/base/media/app_icon.png differ diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/BUILD.gn b/arkui/ace_ets_components_ux/ace_ets_component_search/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a4e3e91bf3998847513906e6325dcfc258aba348 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/BUILD.gn @@ -0,0 +1,43 @@ +# 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAceSearchTest") { + hap_profile = "src/main/module.json" + js_build_mode = "debug" + deps = [ + ":ace_ets_component_search_js_assets", + ":ace_ets_component_search_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAceSearchTest" + part_name = "ace_engine" + subsystem_name = "arkui" +} + +ohos_app_scope("ace_ets_component_search_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("ace_ets_component_search_js_assets") { + source_dir = "src/main/ets" +} + +ohos_resources("ace_ets_component_search_resources") { + sources = [ "src/main/resources" ] + deps = [ ":ace_ets_component_search_profile" ] + hap_profile = "src/main/module.json" +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/Test.json b/arkui/ace_ets_components_ux/ace_ets_component_search/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..1e08bf1cfc1715b15410a93551dc15395f4c7686 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.acesearchtest", + "module-name": "entry_test", + "shell-timeout": "600000", + "testcase-timeout": 70000 + }, + "kits": [{ + "test-file-name": [ + "ActsAceSearchTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602" + ] + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/signature/openharmony_sx.p7b b/arkui/ace_ets_components_ux/ace_ets_component_search/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..2901bd5aa6832a2629d8984588642b452bd92289 Binary files /dev/null and b/arkui/ace_ets_components_ux/ace_ets_component_search/signature/openharmony_sx.p7b differ diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestAbility/TestAbility.ets b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestAbility/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..21fd0c180b367b1e7adb09ffdcf56cd5d6c44029 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestAbility/TestAbility.ets @@ -0,0 +1,64 @@ +/* + * 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. + */ + +import hilog from '@ohos.hilog'; +import Ability from '@ohos.app.ability.UIAbility' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import testsuite from '../test/List.test' +import Window from '@ohos.window' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: Window.WindowStage) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('TestAbility/pages/Index', (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestAbility/pages/Index.ets b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestAbility/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9eb48e98165fc45848779d24d92105ca605b727f --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestAbility/pages/Index.ets @@ -0,0 +1,285 @@ +/* + * 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. + */ + +import events_emitter from '@ohos.events.emitter'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import { Hypium } from '@ohos/hypium'; +import hilog from '@ohos.hilog'; +import testsuite from '../../test/List.test' + +@Entry +@Component +struct SliderExample { + @State caretWidthNumber: number = 5 + @State caretWidthString: string = '15px' + @State caretWidthResource: Resource = $r('sys.float.ohos_id_text_margin_vertical') + @State caretColorColor: Color = Color.Red + @State caretColorNumber: number = 0x000000 + @State caretColorString: string = '#ff9a35' + @State caretColorResource: Resource = $r('sys.color.ohos_id_color_connected') + @State leftSearchIconSizeNumber: number = 20 + @State leftSearchIconSizeString: string = '50px' + @State leftSearchIconSizeResource: Resource = $r('sys.float.ohos_id_text_paragraph_margin_m') + @State leftSearchIconColorColor: Color = Color.Red + @State leftSearchIconColorNumber: number = 0x000000 + @State leftSearchIconColorString: string = '#ff9a35' + @State leftSearchIconColorResource: Resource = $r('sys.color.ohos_id_color_connected') + @State searchSrcPath: string = 'common/icon.png' + @State searchSrcPathResource: Resource = $r('sys.media.ohos_app_icon') + @State rightButtonStyleParam: CancelButtonStyle = CancelButtonStyle.INPUT + @State rightCancelIconSizeNumber: number = 20 + @State rightCancelIconSizeString: string = '50px' + @State rightCancelIconSizeResource: Resource = $r('sys.float.ohos_id_text_paragraph_margin_m') + @State rightCancelIconColorColor: Color = Color.Red + @State rightCancelIconColorNumber: number = 0x000000 + @State rightCancelIconColorString: string = '#ff9a35' + @State rightCancelIconColorResource: Resource = $r('sys.color.ohos_id_color_connected') + @State rightIconSrcPath: string = 'common/icon.png' + @State rightIconSrcPathResource: Resource = $r('sys.media.ohos_app_icon') + @State searchButtonFontSizeNumber: number = 20 + @State searchButtonFontSizeString: string = '10vp' + @State searchButtonFontSizeResource: Resource = $r('sys.float.ohos_id_text_paragraph_margin_m') + @State searchButtonFontColorColor: Color = Color.Blue + @State searchButtonFontColorNumber: number = 0x000000 + @State searchButtonFontColorString: string = '#ff9a35' + @State searchButtonFontColorResource: Resource = $r('sys.color.ohos_id_color_connected') + @State textColorColor: Color = Color.Red + @State textColorNumber: number = 0x000000 + @State textColorString: string = '#ff9a35' + @State textColorResource: Resource = $r('sys.color.ohos_id_color_connected') + @State placeholderFont: Font = { size: '16sp', weight: FontWeight.Normal } + @State textFont: Font = { size: '16sp', weight: FontWeight.Normal } + + private stateChangCallBack = (eventData) => { + console.info("search page state change called:" + JSON.stringify(eventData)); + this.caretWidthNumber = eventData.data.caretWidthNumber; + this.caretWidthString = eventData.data.caretWidthString; + this.caretWidthResource = eventData.data.caretWidthResource; + this.caretColorColor = eventData.data.caretColorColor; + this.caretColorNumber = eventData.data.caretColorNumber; + this.caretColorString = eventData.data.caretColorString; + this.caretColorResource = eventData.data.caretColorResource; + this.leftSearchIconSizeNumber = eventData.data.leftSearchIconSizeNumber; + this.leftSearchIconSizeString = eventData.data.leftSearchIconSizeString; + this.leftSearchIconSizeResource = eventData.data.leftSearchIconSizeResource; + this.leftSearchIconColorColor = eventData.data.leftSearchIconColorColor; + this.leftSearchIconColorNumber = eventData.data.leftSearchIconColorNumber; + this.leftSearchIconColorString = eventData.data.leftSearchIconColorString; + this.leftSearchIconColorResource = eventData.data.leftSearchIconColorResource; + this.searchSrcPath = eventData.data.searchSrcPath; + this.searchSrcPathResource = eventData.data.searchSrcPathResource; + this.rightButtonStyleParam = eventData.data.rightButtonStyleParam; + this.rightCancelIconSizeNumber = eventData.data.rightCancelIconSizeNumber; + this.rightCancelIconSizeString = eventData.data.rightCancelIconSizeString; + this.rightCancelIconSizeResource = eventData.data.rightCancelIconSizeResource; + this.rightCancelIconColorColor = eventData.data.rightCancelIconColorColor; + this.rightCancelIconColorNumber = eventData.data.rightCancelIconColorNumber; + this.rightCancelIconColorString = eventData.data.rightCancelIconColorString; + this.rightCancelIconColorResource = eventData.data.rightCancelIconColorResource; + this.rightIconSrcPath = eventData.data.rightIconSrcPath; + this.rightIconSrcPathResource = eventData.data.rightIconSrcPathResource; + this.searchButtonFontSizeNumber = eventData.data.searchButtonFontSizeNumber; + this.searchButtonFontSizeString = eventData.data.searchButtonFontSizeString; + this.searchButtonFontSizeResource = eventData.data.searchButtonFontSizeResource; + this.searchButtonFontColorColor = eventData.data.searchButtonFontColorColor; + this.searchButtonFontColorNumber = eventData.data.searchButtonFontColorNumber; + this.searchButtonFontColorString = eventData.data.searchButtonFontColorString; + this.searchButtonFontColorResource = eventData.data.searchButtonFontColorResource; + this.textColorColor = eventData.data.textColorColor; + this.textColorNumber = eventData.data.textColorNumber; + this.textColorString = eventData.data.textColorString; + this.textColorResource = eventData.data.textColorResource; + } + + aboutToAppear(){ + var stateChangeEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + build() { + Column() { + Search({ value: '', placeholder: 'Type to search...' }) + .searchButton('Search') + .key('searchTestDefault') + + Search({ value: '', placeholder: 'Type to search...' }) + .caretStyle({ + color: $r('sys.color.ohos_id_color_text_primary_activated') + }) + .searchIcon({ + color: $r('sys.color.ohos_id_color_secondary'), + }) + .cancelButton({ + icon: { + color: $r('sys.color.ohos_id_color_secondary'), + } + }) + .searchButton( + 'Search', + { + fontSize: $r('sys.float.ohos_id_text_size_body1'), + fontColor: $r('sys.color.ohos_id_color_text_primary_activated') + } + ) + .key('searchTestDefaultValue') + + Search({ value: '', placeholder: 'Type to search...' }) + .width(300) + .height(40) + .margin(5) + .caretStyle({ + width: this.caretWidthNumber, + color: this.caretColorNumber + }) + .searchIcon({ + size: this.leftSearchIconSizeNumber, + color: this.leftSearchIconColorNumber, + src: this.searchSrcPath + }) + .cancelButton({ + style: this.rightButtonStyleParam, + icon: { + size: this.rightCancelIconSizeNumber, + color: this.rightCancelIconColorNumber, + src: this.rightIconSrcPath + } + }) + .searchButton( + 'Search', + { + fontSize: this.searchButtonFontSizeNumber, + fontColor: this.searchButtonFontColorNumber + } + ) + .placeholderFont(this.placeholderFont) + .textFont(this.textFont) + .fontColor(this.textColorNumber) + .key('searchTestNumber') + + Search({ value: '', placeholder: 'Type to search...' }) + .width(300) + .height(40) + .margin(5) + .caretStyle({ + width: this.caretWidthString, + color: this.caretColorString + }) + .searchIcon({ + size: this.leftSearchIconSizeString, + color: this.leftSearchIconColorString, + src: this.searchSrcPath + }) + .cancelButton({ + style: this.rightButtonStyleParam, + icon: { + size: this.rightCancelIconSizeString, + color: this.rightCancelIconColorString, + src: this.rightIconSrcPath + } + }) + .searchButton( + 'Search', + { + fontSize: this.searchButtonFontSizeString, + fontColor: this.searchButtonFontColorString + } + ) + .placeholderFont(this.placeholderFont) + .textFont(this.textFont) + .fontColor(this.textColorString) + .key('searchTestString') + + Search({ value: '', placeholder: 'Type to search...' }) + .width(300) + .height(40) + .margin(5) + .caretStyle({ + width: this.caretWidthResource, + color: this.caretColorResource + }) + .searchIcon({ + size: this.leftSearchIconSizeResource, + color: this.leftSearchIconColorResource, + src: this.searchSrcPathResource + }) + .cancelButton({ + style: this.rightButtonStyleParam, + icon: { + size: this.rightCancelIconSizeResource, + color: this.rightCancelIconColorResource, + src: this.rightIconSrcPathResource + } + }) + .searchButton( + 'Search', + { + fontSize: this.searchButtonFontSizeResource, + fontColor: this.searchButtonFontColorResource + } + ) + .placeholderFont(this.placeholderFont) + .textFont(this.textFont) + .fontColor(this.textColorResource) + .key('searchTestResource') + + Search({ value: '', placeholder: 'Type to search...' }) + .width(300) + .height(40) + .margin(5) + .caretStyle({ + width: this.caretWidthNumber, + color: this.caretColorColor + }) + .searchIcon({ + size: this.leftSearchIconSizeNumber, + color: this.leftSearchIconColorColor, + src: this.searchSrcPath + }) + .cancelButton({ + style: this.rightButtonStyleParam, + icon: { + size: this.rightCancelIconSizeNumber, + color: this.rightCancelIconColorColor, + src: this.rightIconSrcPath + } + }) + .searchButton( + 'Search', + { + fontSize: this.searchButtonFontSizeNumber, + fontColor: this.searchButtonFontColorColor + } + ) + .placeholderFont(this.placeholderFont) + .textFont(this.textFont) + .fontColor(this.textColorColor) + .key('searchTestColor') + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..a46d1e1e841c63300a04e5ad1a914b9d5948a596 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,84 @@ +/* + * 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. + */ +import hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]); + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}`; + } + } + return targetParams.trim(); +} + +async function onAbilityCreateCallback() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err): Promise { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments(); + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'; + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback); + let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName; + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters); + let debug = abilityDelegatorArguments.parameters['-D']; + if (debug == 'true') { + cmd += ' -D'; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err, d) => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/List.test.ets b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4febbd43ffc6cea5238b5a8c001d66589c8dddeb --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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. + */ +import search from './Search' + +export default function testsuite() { + search() +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/Search.ets b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/Search.ets new file mode 100644 index 0000000000000000000000000000000000000000..d938a6daa036a12498d8d34164ba7131562ee41b --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/Search.ets @@ -0,0 +1,4274 @@ +/* + * 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. + */ + +import { describe, beforeEach, afterEach, it, expect } from '@ohos/hypium' +import events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets'; + +let emitKey = "emitUserAgent"; +export default function search() { + describe('ActsAceSearchTest', function () { + beforeEach(async function (done) { + await Utils.sleep(2000); + console.info("search beforeEach start"); + done(); + }) + + afterEach(async function (done) { + console.info("search afterEach start"); + let caretWidthNumber: number = 5 + let caretWidthString: string = '15px' + let caretWidthResource: Resource = $r('sys.float.ohos_id_text_margin_vertical') + let caretColorColor: Color = Color.Red + let caretColorNumber: number = 0x000000 + let caretColorString: string = '#ff9a35' + let caretColorResource: Resource = $r('sys.color.ohos_id_color_connected') + let leftSearchIconSizeNumber: number = 20 + let leftSearchIconSizeString: string = '50px' + let leftSearchIconSizeResource: Resource = $r('sys.float.ohos_id_text_paragraph_margin_m') + let leftSearchIconColorColor: Color = Color.Red + let leftSearchIconColorNumber: number = 0x000000 + let leftSearchIconColorString: string = '#ff9a35' + let leftSearchIconColorResource: Resource = $r('sys.color.ohos_id_color_connected') + let searchSrcPath: string = 'common/icon.png' + let rightButtonStyleParam: CancelButtonStyle = CancelButtonStyle.INPUT + let rightCancelIconSizeNumber: number = 20 + let rightCancelIconSizeString: string = '50px' + let rightCancelIconSizeResource: Resource = $r('sys.float.ohos_id_text_paragraph_margin_m') + let rightCancelIconColorColor: Color = Color.Red + let rightCancelIconColorNumber: number = 0x000000 + let rightCancelIconColorString: string = '#ff9a35' + let rightCancelIconColorResource: Resource = $r('sys.color.ohos_id_color_connected') + let rightIconSrcPath: string = 'common/icon.png' + let searchButtonFontSizeNumber: number = 20 + let searchButtonFontSizeString: string = '10vp' + let searchButtonFontSizeResource: Resource = $r('sys.float.ohos_id_text_paragraph_margin_m') + let searchButtonFontColorColor: Color = Color.Blue + let searchButtonFontColorNumber: number = 0x000000 + let searchButtonFontColorString: string = '#ff9a35' + let searchButtonFontColorResource: Resource = $r('sys.color.ohos_id_color_connected') + let textColorColor: Color = Color.Red + let textColorNumber: number = 0x000000 + let textColorString: string = '#ff9a35' + let textColorResource: Resource = $r('sys.color.ohos_id_color_connected') + + try { + var eventData = { + data: { + 'caretWidthNumber' : caretWidthNumber, + 'caretWidthString' : caretWidthString, + 'caretWidthResource' : caretWidthResource, + 'caretColorColor' : caretColorColor, + 'caretColorNumber' : caretColorNumber, + 'caretColorString' : caretColorString, + 'caretColorResource' : caretColorResource, + 'leftSearchIconSizeNumber' : leftSearchIconSizeNumber, + 'leftSearchIconSizeString' : leftSearchIconSizeString, + 'leftSearchIconSizeResource' : leftSearchIconSizeResource, + 'leftSearchIconColorColor' : leftSearchIconColorColor, + 'leftSearchIconColorNumber' : leftSearchIconColorNumber, + 'leftSearchIconColorString' : leftSearchIconColorString, + 'leftSearchIconColorResource' : leftSearchIconColorResource, + 'searchSrcPath' : searchSrcPath, + 'rightButtonStyleParam' : rightButtonStyleParam, + 'rightCancelIconSizeNumber' : rightCancelIconSizeNumber, + 'rightCancelIconSizeString' : rightCancelIconSizeString, + 'rightCancelIconSizeResource' : rightCancelIconSizeResource, + 'rightCancelIconColorColor' : rightCancelIconColorColor, + 'rightCancelIconColorNumber' : rightCancelIconColorNumber, + 'rightCancelIconColorString' : rightCancelIconColorString, + 'rightCancelIconColorResource' : rightCancelIconColorResource, + 'rightIconSrcPath' : rightIconSrcPath, + 'searchButtonFontSizeNumber' : searchButtonFontSizeNumber, + 'searchButtonFontSizeString' : searchButtonFontSizeString, + 'searchButtonFontSizeResource' : searchButtonFontSizeResource, + 'searchButtonFontColorColor' : searchButtonFontColorColor, + 'searchButtonFontColorNumber' : searchButtonFontColorNumber, + 'searchButtonFontColorString' : searchButtonFontColorString, + 'searchButtonFontColorResource' : searchButtonFontColorResource, + 'textColorColor' : textColorColor, + 'textColorNumber' : textColorNumber, + 'textColorString' : textColorString, + 'textColorResource' : textColorResource + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("search afterEach start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.info("search afterEach start to publish change component data error: " + err.message); + } + await Utils.sleep(2000); + done(); + }) + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_0100 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Get the default value of caretStyle.width + */ + it('[ArkUI_Stage_Search_CaretStyle_0100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_0100] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_CaretStyle_0100]: " + JSON.stringify(newJson)); + + let obj = JSON.parse(newJson); + console.info("[ArkUI_Stage_Search_CaretStyle_0100]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_0100]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("1.50vp"); + console.info("[ArkUI_Stage_Search_CaretStyle_0100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_0200 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as 10 + */ + it('[ArkUI_Stage_Search_CaretStyle_0200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_0200] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_0200]: " + JSON.stringify(newJson)); + + let caretWidthNumber = 10; + try { + var eventData = { + data: { + "caretWidthNumber": caretWidthNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_0200] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_0200] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_0200]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_0200]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_0200]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("10.00vp"); + console.info("[ArkUI_Stage_Search_CaretStyle_0200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_0300 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as 15px + */ + it('[ArkUI_Stage_Search_CaretStyle_0300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_0300] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CaretStyle_0300]: " + JSON.stringify(newJson)); + + let caretWidthString = '15px'; + try { + var eventData = { + data: { + "caretWidthString": caretWidthString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_0300] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_0300] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CaretStyle_0300]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_0300]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_0300]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("15.00px"); + console.info("[ArkUI_Stage_Search_CaretStyle_0300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_0400 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as 10fp + */ + it('[ArkUI_Stage_Search_CaretStyle_0400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_0400] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CaretStyle_0400]: " + JSON.stringify(newJson)); + + let caretWidthString = '10fp'; + try { + var eventData = { + data: { + "caretWidthString": caretWidthString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_0400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_0400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CaretStyle_0400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_0400]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_0400]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("10.00fp"); + console.info("[ArkUI_Stage_Search_CaretStyle_0400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_0500 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as 15lpx + */ + it('[ArkUI_Stage_Search_CaretStyle_0500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_0500] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CaretStyle_0500]: " + JSON.stringify(newJson)); + + let caretWidthString = '15lpx'; + try { + var eventData = { + data: { + "caretWidthString": caretWidthString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_0500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_0500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CaretStyle_0500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_0500]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_0500]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("15.00lpx"); + console.info("[ArkUI_Stage_Search_CaretStyle_0500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_0600 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as sys.float.ohos_id_text_margin_vertical + */ + it('[ArkUI_Stage_Search_CaretStyle_0600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_0600] start"); + let newJson = getInspectorByKey('searchTestResource'); + 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); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_CaretStyle_0600]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_0600]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_0600]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual('2.00vp'); + console.info("[ArkUI_Stage_Search_CaretStyle_0600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_0700 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as 0 + */ + it('[ArkUI_Stage_Search_CaretStyle_0700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_0700] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_0700]: " + JSON.stringify(newJson)); + + let caretWidthNumber = 0; + try { + var eventData = { + data: { + "caretWidthNumber": caretWidthNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_0700] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_0700] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_0700]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_0700]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_0700]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("0.00vp"); + console.info("[ArkUI_Stage_Search_CaretStyle_0700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_0800 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as -1.5 + */ + it('[ArkUI_Stage_Search_CaretStyle_0800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_0800] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_0800]: " + JSON.stringify(newJson)); + + let caretWidthNumber = -1.5; + try { + var eventData = { + data: { + "caretWidthNumber": caretWidthNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_0800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_0800] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_0800]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_0800]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_0800]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("1.50vp"); + console.info("[ArkUI_Stage_Search_CaretStyle_0800] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_0900 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as 100000 + */ + it('[ArkUI_Stage_Search_CaretStyle_0900]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_0900] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_0900]: " + JSON.stringify(newJson)); + + let caretWidthNumber = 100000; + try { + var eventData = { + data: { + "caretWidthNumber": caretWidthNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_0900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_0900] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_0900]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_0900]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_0900]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("100000.00vp"); + console.info("[ArkUI_Stage_Search_CaretStyle_0900] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_1000 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as null + */ + it('[ArkUI_Stage_Search_CaretStyle_1000]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_1000] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_1000]: " + JSON.stringify(newJson)); + + let caretWidthNumber = null; + try { + var eventData = { + data: { + "caretWidthNumber": caretWidthNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_1000] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_1000] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_1000]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_1000]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_1000]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("1.50vp"); + console.info("[ArkUI_Stage_Search_CaretStyle_1000] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_1100 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as undefined + */ + it('[ArkUI_Stage_Search_CaretStyle_1100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_1100] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_1100]: " + JSON.stringify(newJson)); + + let caretWidthNumber = undefined; + try { + var eventData = { + data: { + "caretWidthNumber": caretWidthNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_1100] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_1100] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_1100]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_1100]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_1100]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("1.50vp"); + console.info("[ArkUI_Stage_Search_CaretStyle_1100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_1200 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Get the default value of caretStyle.color + */ + it('[ArkUI_Stage_Search_CaretStyle_1200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_1200] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_CaretStyle_1200]: " + JSON.stringify(newJson)); + let newJsonDefault = getInspectorByKey('searchTestDefaultValue'); + + let obj = JSON.parse(newJson); + let objDefault = JSON.parse(newJsonDefault); + console.info("[ArkUI_Stage_Search_CaretStyle_1200]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_1200]: " + JSON.stringify(obj.$attrs.caretStyle.color)); + expect(obj.$attrs.caretStyle.color).assertEqual(objDefault.$attrs.caretStyle.color); + console.info("[ArkUI_Stage_Search_CaretStyle_1200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_1300 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.color as 0xff0000 + */ + it('[ArkUI_Stage_Search_CaretStyle_1300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_1300] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_1300]: " + JSON.stringify(newJson)); + + let caretColorNumber = 0xff0000; + try { + var eventData = { + data: { + "caretColorNumber": caretColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_1300] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_1300] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_1300]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_1300]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_1300]: " + JSON.stringify(obj.$attrs.caretStyle.color)); + expect(obj.$attrs.caretStyle.color).assertEqual("#FFFF0000"); + console.info("[ArkUI_Stage_Search_CaretStyle_1300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_1400 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.color as Color.Red + */ + it('[ArkUI_Stage_Search_CaretStyle_1400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_1400] start"); + let newJson = getInspectorByKey('searchTestColor'); + console.info("[ArkUI_Stage_Search_CaretStyle_1400]: " + JSON.stringify(newJson)); + + let caretColorColor = Color.Red; + try { + var eventData = { + data: { + "caretColorColor": caretColorColor + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_1400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_1400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestColor'); + console.info("[ArkUI_Stage_Search_CaretStyle_1400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_1400]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_1400]: " + JSON.stringify(obj.$attrs.caretStyle.color)); + expect(obj.$attrs.caretStyle.color).assertEqual("#FFFF0000"); + console.info("[ArkUI_Stage_Search_CaretStyle_1400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_1500 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.color as #ff9a35 + */ + it('[ArkUI_Stage_Search_CaretStyle_1500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_1500] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CaretStyle_1500]: " + JSON.stringify(newJson)); + + let caretColorString = '#ff9a35'; + try { + var eventData = { + data: { + "caretColorString": caretColorString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_1500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_1500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CaretStyle_1500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_1500]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_1500]: " + JSON.stringify(obj.$attrs.caretStyle.color)); + expect(obj.$attrs.caretStyle.color).assertEqual("#FFFF9A35"); + console.info("[ArkUI_Stage_Search_CaretStyle_1500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_1600 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.color as $r('sys.color.ohos_id_color_connected') + */ + it('[ArkUI_Stage_Search_CaretStyle_1600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_1600] start"); + let newJson = getInspectorByKey('searchTestResource'); + 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); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_CaretStyle_1600]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_1600]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_1600]: " + JSON.stringify(obj.$attrs.caretStyle.color)); + expect(obj.$attrs.caretStyle.color).assertEqual('#FF00CB87'); + console.info("[ArkUI_Stage_Search_CaretStyle_1600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_1700 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.color as abcdefghijk + */ + it('[ArkUI_Stage_Search_CaretStyle_1700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_1700] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CaretStyle_1700]: " + JSON.stringify(newJson)); + + let caretColorString = 'abcdefghijk'; + try { + var eventData = { + data: { + "caretColorString": caretColorString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_1700] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_1700] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CaretStyle_1700]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_1700]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_1700]: " + JSON.stringify(obj.$attrs.caretStyle.color)); + expect(obj.$attrs.caretStyle.color).assertEqual("#FF007DFF"); + console.info("[ArkUI_Stage_Search_CaretStyle_1700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_1800 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.color as null + */ + it('[ArkUI_Stage_Search_CaretStyle_1800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_1800] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_1800]: " + JSON.stringify(newJson)); + + let caretColorNumber = null; + try { + var eventData = { + data: { + "caretColorNumber": caretColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_1800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_1800] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_1800]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_1800]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_1800]: " + JSON.stringify(obj.$attrs.caretStyle.color)); + expect(obj.$attrs.caretStyle.color).assertEqual("#FF007DFF"); + console.info("[ArkUI_Stage_Search_CaretStyle_1800] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_1900 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.color as undefined + */ + it('[ArkUI_Stage_Search_CaretStyle_1900]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_1900] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_1900]: " + JSON.stringify(newJson)); + + let caretColorNumber = undefined; + try { + var eventData = { + data: { + "caretColorNumber": caretColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_1900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_1900] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_1900]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_1900]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_1900]: " + JSON.stringify(obj.$attrs.caretStyle.color)); + expect(obj.$attrs.caretStyle.color).assertEqual("#FF007DFF"); + console.info("[ArkUI_Stage_Search_CaretStyle_1900] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CaretStyle_2000 + * @tc.name Tests the caretStyle property of the search component + * @tc.desc Set the value of caretStyle.width as 10 + * Set the value of caretStyle.color as 0xff0000 + */ + it('[ArkUI_Stage_Search_CaretStyle_2000]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CaretStyle_2000] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_2000]: " + JSON.stringify(newJson)); + + let caretWidthNumber = 10; + let caretColorNumber = 0xff0000; + try { + var eventData = { + data: { + "caretWidthNumber": caretWidthNumber, + "caretColorNumber": caretColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CaretStyle_2000] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CaretStyle_2000] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CaretStyle_2000]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CaretStyle_2000]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_2000]: " + JSON.stringify(obj.$attrs.caretStyle.width)); + expect(obj.$attrs.caretStyle.width).assertEqual("10.00vp"); + console.info("[ArkUI_Stage_Search_CaretStyle_2000]: " + JSON.stringify(obj.$attrs.caretStyle)); + console.info("[ArkUI_Stage_Search_CaretStyle_2000]: " + JSON.stringify(obj.$attrs.caretStyle.color)); + expect(obj.$attrs.caretStyle.color).assertEqual("#FFFF0000"); + console.info("[ArkUI_Stage_Search_CaretStyle_2000] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_0100 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Get the default value of searchIcon.size + */ + it('[ArkUI_Stage_Search_SearchIcon_0100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_0100] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_SearchIcon_0100]: " + JSON.stringify(newJson)); + let newJsonDefault = getInspectorByKey('searchTestDefaultValue'); + + let obj = JSON.parse(newJson); + let objDefault = JSON.parse(newJsonDefault); + console.info("[ArkUI_Stage_Search_SearchIcon_0100]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_0100]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + expect(obj.$attrs.searchIcon.size).assertEqual(objDefault.$attrs.searchIcon.size); + console.info("[ArkUI_Stage_Search_SearchIcon_0100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_0200 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as 26 + */ + it('[ArkUI_Stage_Search_SearchIcon_0200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_0200] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_0200]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeNumber = 26; + try { + var eventData = { + data: { + "leftSearchIconSizeNumber": leftSearchIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_0200] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_0200] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_0200]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_0200]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_0200]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + let result : number = 26; + console.info("[ArkUI_Stage_Search_SearchIcon_0200]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.searchIcon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_SearchIcon_0200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_0300 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as 50px + */ + it('[ArkUI_Stage_Search_SearchIcon_0300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_0300] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchIcon_0300]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeString = '50px'; + try { + var eventData = { + data: { + "leftSearchIconSizeString": leftSearchIconSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_0300] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_0300] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchIcon_0300]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_0300]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_0300]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + expect(obj.$attrs.searchIcon.size).assertEqual("50.00px"); + console.info("[ArkUI_Stage_Search_SearchIcon_0300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_0400 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as 50fp + */ + it('[ArkUI_Stage_Search_SearchIcon_0400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_0400] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchIcon_0400]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeString = '50fp'; + try { + var eventData = { + data: { + "leftSearchIconSizeString": leftSearchIconSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_0400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_0400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchIcon_0400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_0400]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_0400]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + let result : number = 50; + console.info("[ArkUI_Stage_Search_SearchIcon_0400]: " + fp2px(result).toFixed(2)); + expect(obj.$attrs.searchIcon.size).assertEqual(fp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_SearchIcon_0400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_0500 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as 50lpx + */ + it('[ArkUI_Stage_Search_SearchIcon_0500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_0500] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchIcon_0500]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeString = '50lpx'; + try { + var eventData = { + data: { + "leftSearchIconSizeString": leftSearchIconSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_0500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_0500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchIcon_0500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_0500]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_0500]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + let result : number = 50; + console.info("[ArkUI_Stage_Search_SearchIcon_0500]: " + lpx2px(result).toFixed(2)); + expect(obj.$attrs.searchIcon.size).assertEqual(lpx2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_SearchIcon_0500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_0600 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as $r('sys.float.ohos_id_text_paragraph_margin_m') + */ + it('[ArkUI_Stage_Search_SearchIcon_0600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_0600] start"); + let newJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_SearchIcon_0600]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeResource = $r('sys.float.ohos_id_text_paragraph_margin_m'); + try { + var eventData = { + data: { + "leftSearchIconSizeResource": leftSearchIconSizeResource + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_0600] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_0600] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_SearchIcon_0600]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_0600]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_0600]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + let result : number = 16; + console.info("[ArkUI_Stage_Search_SearchIcon_0600]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.searchIcon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_SearchIcon_0600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_0700 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as 40 + */ + it('[ArkUI_Stage_Search_SearchIcon_0700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_0700] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_0700]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeNumber = 40; + try { + var eventData = { + data: { + "leftSearchIconSizeNumber": leftSearchIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_0700] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_0700] change component data error: " + err.message); + } + await Utils.sleep(5000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_0700]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_0700]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_0700]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + let result : number = 40; + console.info("[ArkUI_Stage_Search_SearchIcon_0700]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.searchIcon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_SearchIcon_0700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_0800 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as 0 + */ + it('[ArkUI_Stage_Search_SearchIcon_0800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_0800] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_0800]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeNumber = 0; + try { + var eventData = { + data: { + "leftSearchIconSizeNumber": leftSearchIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_0800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_0800] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_0800]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_0800]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_0800]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + let result : number = 0; + console.info("[ArkUI_Stage_Search_SearchIcon_0800]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.searchIcon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_SearchIcon_0800] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_0900 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as -16 + */ + it('[ArkUI_Stage_Search_SearchIcon_0900]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_0900] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_0900]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeNumber = -16; + try { + var eventData = { + data: { + "leftSearchIconSizeNumber": leftSearchIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_0900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_0900] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_0900]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_0900]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_0900]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + expect(obj.$attrs.searchIcon.size).assertEqual("24.00px"); + console.info("[ArkUI_Stage_Search_SearchIcon_0900] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_1000 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as 10000 + */ + it('[ArkUI_Stage_Search_SearchIcon_1000]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_1000] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_1000]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeNumber = 10000; + try { + var eventData = { + data: { + "leftSearchIconSizeNumber": leftSearchIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_1000] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_1000] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_1000]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_1000]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_1000]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + let result : number = 10000; + console.info("[ArkUI_Stage_Search_SearchIcon_1000]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.searchIcon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_SearchIcon_1000] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_1100 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as null + */ + it('[ArkUI_Stage_Search_SearchIcon_1100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_1100] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_1100]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeNumber = null; + try { + var eventData = { + data: { + "leftSearchIconSizeNumber": leftSearchIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_1100] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_1100] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_1100]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_1100]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_1100]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + expect(obj.$attrs.searchIcon.size).assertEqual("24.00px"); + console.info("[ArkUI_Stage_Search_SearchIcon_1100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_1200 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as undefined + */ + it('[ArkUI_Stage_Search_SearchIcon_1200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_1200] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_1200]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeNumber = undefined; + try { + var eventData = { + data: { + "leftSearchIconSizeNumber": leftSearchIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_1200] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_1200] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_1200]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_1200]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_1200]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + expect(obj.$attrs.searchIcon.size).assertEqual("24.00px"); + console.info("[ArkUI_Stage_Search_SearchIcon_1200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_1300 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Get the default value of searchIcon.color + */ + it('[ArkUI_Stage_Search_SearchIcon_1300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_1300] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_SearchIcon_1300]: " + JSON.stringify(newJson)); + let newJsonDefault = getInspectorByKey('searchTestDefaultValue'); + + let obj = JSON.parse(newJson); + let objDefault = JSON.parse(newJsonDefault); + console.info("[ArkUI_Stage_Search_SearchIcon_1300]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_1300]: " + JSON.stringify(obj.$attrs.searchIcon.color)); + expect(obj.$attrs.searchIcon.color).assertEqual(objDefault.$attrs.searchIcon.color); + console.info("[ArkUI_Stage_Search_SearchIcon_1300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_1400 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.color as 0x00ff00 + */ + it('[ArkUI_Stage_Search_SearchIcon_1400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_1400] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_1400]: " + JSON.stringify(newJson)); + + let leftSearchIconColorNumber = 0x00ff00; + try { + var eventData = { + data: { + "leftSearchIconColorNumber": leftSearchIconColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_1400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_1400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_1400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_1400]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_1400]: " + JSON.stringify(obj.$attrs.searchIcon.color)); + expect(obj.$attrs.searchIcon.color).assertEqual("#FF00FF00"); + console.info("[ArkUI_Stage_Search_SearchIcon_1400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_1500 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.color as Color.Red + */ + it('[ArkUI_Stage_Search_SearchIcon_1500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_1500] start"); + let newJson = getInspectorByKey('searchTestColor'); + console.info("[ArkUI_Stage_Search_SearchIcon_1500]: " + JSON.stringify(newJson)); + + let leftSearchIconColorColor = Color.Red; + try { + var eventData = { + data: { + "leftSearchIconColorColor": leftSearchIconColorColor + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_1500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_1500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestColor'); + console.info("[ArkUI_Stage_Search_SearchIcon_1500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_1500]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_1500]: " + JSON.stringify(obj.$attrs.searchIcon.color)); + expect(obj.$attrs.searchIcon.color).assertEqual("#FFFF0000"); + console.info("[ArkUI_Stage_Search_SearchIcon_1500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_1600 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.color as #ff9a35 + */ + it('[ArkUI_Stage_Search_SearchIcon_1600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_1600] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchIcon_1600]: " + JSON.stringify(newJson)); + + let leftSearchIconColorString = '#ff9a35'; + try { + var eventData = { + data: { + "leftSearchIconColorString": leftSearchIconColorString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_1600] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_1600] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchIcon_1600]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_1600]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_1600]: " + JSON.stringify(obj.$attrs.searchIcon.color)); + expect(obj.$attrs.searchIcon.color).assertEqual("#FFFF9A35"); + console.info("[ArkUI_Stage_Search_SearchIcon_1600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_1700 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.color as $r('sys.color.ohos_id_color_connected') + */ + it('[ArkUI_Stage_Search_SearchIcon_1700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_1700] start"); + let newJson = getInspectorByKey('searchTestResource'); + 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); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_SearchIcon_1700]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_1700]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_1700]: " + JSON.stringify(obj.$attrs.searchIcon.color)); + expect(obj.$attrs.searchIcon.color).assertEqual('#FF00CB87'); + console.info("[ArkUI_Stage_Search_SearchIcon_1700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_1800 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.color as abcdefghijk + */ + it('[ArkUI_Stage_Search_SearchIcon_1800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_1800] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchIcon_1800]: " + JSON.stringify(newJson)); + + let leftSearchIconColorString = 'abcdefghijk'; + try { + var eventData = { + data: { + "leftSearchIconColorString": leftSearchIconColorString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_1800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_1800] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchIcon_1800]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_1800]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_1800]: " + JSON.stringify(obj.$attrs.searchIcon.color)); + expect(obj.$attrs.searchIcon.color).assertEqual("#99182431"); + console.info("[ArkUI_Stage_Search_SearchIcon_1800] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_1900 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.color as null + */ + it('[ArkUI_Stage_Search_SearchIcon_1900]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_1900] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_1900]: " + JSON.stringify(newJson)); + + let leftSearchIconColorNumber = null; + try { + var eventData = { + data: { + "leftSearchIconColorNumber": leftSearchIconColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_1900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_1900] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_1900]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_1900]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_1900]: " + JSON.stringify(obj.$attrs.searchIcon.color)); + expect(obj.$attrs.searchIcon.color).assertEqual("#99182431"); + console.info("[ArkUI_Stage_Search_SearchIcon_1900] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_2000 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.color as undefined + */ + it('[ArkUI_Stage_Search_SearchIcon_2000]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_2000] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2000]: " + JSON.stringify(newJson)); + + let leftSearchIconColorNumber = undefined; + try { + var eventData = { + data: { + "leftSearchIconColorNumber": leftSearchIconColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_2000] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_2000] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2000]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_2000]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2000]: " + JSON.stringify(obj.$attrs.searchIcon.color)); + expect(obj.$attrs.searchIcon.color).assertEqual("#99182431"); + console.info("[ArkUI_Stage_Search_SearchIcon_2000] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_2100 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.size as 26 + * Set the value of searchIcon.color as 0x00ff00 + */ + it('[ArkUI_Stage_Search_SearchIcon_2100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_2100] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2100]: " + JSON.stringify(newJson)); + + let leftSearchIconSizeNumber = 26; + let leftSearchIconColorNumber = 0x00ff00; + try { + var eventData = { + data: { + "leftSearchIconSizeNumber": leftSearchIconSizeNumber, + "leftSearchIconColorNumber": leftSearchIconColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_2100] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_2100] change component data error: " + err.message); + } + await Utils.sleep(2100); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2100]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_2100]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2100]: " + JSON.stringify(obj.$attrs.searchIcon.size)); + let result : number = 26; + console.info("[ArkUI_Stage_Search_SearchIcon_2100]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.searchIcon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_SearchIcon_2100]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2100]: " + JSON.stringify(obj.$attrs.searchIcon.color)); + expect(obj.$attrs.searchIcon.color).assertEqual("#FF00FF00"); + console.info("[ArkUI_Stage_Search_SearchIcon_2100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_2200 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Get the default value of searchIcon.src + */ + it('[ArkUI_Stage_Search_SearchIcon_2200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_2200] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_SearchIcon_2200]: " + JSON.stringify(newJson)); + + let obj = JSON.parse(newJson); + console.info("[ArkUI_Stage_Search_SearchIcon_2200]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2200]: " + JSON.stringify(obj.$attrs.searchIcon.src)); + expect(obj.$attrs.searchIcon.src).assertEqual('resource:///ohos_search.svg'); + console.info("[ArkUI_Stage_Search_SearchIcon_2200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_2300 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.src as common/icon2.svg + */ + it('[ArkUI_Stage_Search_SearchIcon_2300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_2300] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2300]: " + JSON.stringify(newJson)); + + let searchSrcPath = 'common/icon2.svg'; + try { + var eventData = { + data: { + "searchSrcPath": searchSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_2300] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_2300] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2300]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_2300]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2300]: " + JSON.stringify(obj.$attrs.searchIcon.src)); + expect(obj.$attrs.searchIcon.src).assertEqual('common/icon2.svg'); + console.info("[ArkUI_Stage_Search_SearchIcon_2300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_2400 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.src as common/icon2.jpg + */ + it('[ArkUI_Stage_Search_SearchIcon_2400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_2400] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2400]: " + JSON.stringify(newJson)); + + let searchSrcPath = 'common/icon2.jpg'; + try { + var eventData = { + data: { + "searchSrcPath": searchSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_2400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_2400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_2400]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2400]: " + JSON.stringify(obj.$attrs.searchIcon.src)); + expect(obj.$attrs.searchIcon.src).assertEqual('common/icon2.jpg'); + console.info("[ArkUI_Stage_Search_SearchIcon_2400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_2500 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.src as common/icon2.png + */ + it('[ArkUI_Stage_Search_SearchIcon_2500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_2500] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2500]: " + JSON.stringify(newJson)); + + let searchSrcPath = 'common/icon2.png'; + try { + var eventData = { + data: { + "searchSrcPath": searchSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_2500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_2500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_2500]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2500]: " + JSON.stringify(obj.$attrs.searchIcon.src)); + expect(obj.$attrs.searchIcon.src).assertEqual('common/icon2.png'); + console.info("[ArkUI_Stage_Search_SearchIcon_2500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_2600 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.src as $r('sys.media.ohos_app_icon') + */ + it('[ArkUI_Stage_Search_SearchIcon_2600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_2600] start"); + let newJson = getInspectorByKey('searchTestResource'); + 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); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_SearchIcon_2600]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_2600]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2600]: " + JSON.stringify(obj.$attrs.searchIcon.src)); + expect(obj.$attrs.searchIcon.src).assertEqual('resource:///125829858.png'); + console.info("[ArkUI_Stage_Search_SearchIcon_2600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_2700 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.src as abc/def/ghi.jkl + */ + it('[ArkUI_Stage_Search_SearchIcon_2700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_2700] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2700]: " + JSON.stringify(newJson)); + + let searchSrcPath = 'abc/def/ghi.jkl'; + try { + var eventData = { + data: { + "searchSrcPath": searchSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_2700] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_2700] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2700]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_2700]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2700]: " + JSON.stringify(obj.$attrs.searchIcon.src)); + expect(obj.$attrs.searchIcon.src).assertEqual('abc/def/ghi.jkl'); + console.info("[ArkUI_Stage_Search_SearchIcon_2700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_2800 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.src as '' + */ + it('[ArkUI_Stage_Search_SearchIcon_2800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_2800] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2800]: " + JSON.stringify(newJson)); + + let searchSrcPath = ''; + try { + var eventData = { + data: { + "searchSrcPath": searchSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_2800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_2800] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2800]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_2800]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2800]: " + JSON.stringify(obj.$attrs.searchIcon.src)); + expect(obj.$attrs.searchIcon.src).assertEqual('resource:///ohos_search.svg'); + console.info("[ArkUI_Stage_Search_SearchIcon_2800] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_2900 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.src as null + */ + it('[ArkUI_Stage_Search_SearchIcon_2900]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_2900] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2900]: " + JSON.stringify(newJson)); + + let searchSrcPath = null; + try { + var eventData = { + data: { + "searchSrcPath": searchSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_2900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_2900] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_2900]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_2900]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_2900]: " + JSON.stringify(obj.$attrs.searchIcon.src)); + expect(obj.$attrs.searchIcon.src).assertEqual('resource:///ohos_search.svg'); + console.info("[ArkUI_Stage_Search_SearchIcon_2900] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchIcon_3000 + * @tc.name Tests the searchIcon property of the search component + * @tc.desc Set the value of searchIcon.src as undefined + */ + it('[ArkUI_Stage_Search_SearchIcon_3000]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchIcon_3000] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_3000]: " + JSON.stringify(newJson)); + + let searchSrcPath = undefined; + try { + var eventData = { + data: { + "searchSrcPath": searchSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchIcon_3000] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchIcon_3000] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchIcon_3000]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchIcon_3000]: " + JSON.stringify(obj.$attrs.searchIcon)); + console.info("[ArkUI_Stage_Search_SearchIcon_3000]: " + JSON.stringify(obj.$attrs.searchIcon.src)); + expect(obj.$attrs.searchIcon.src).assertEqual('resource:///ohos_search.svg'); + console.info("[ArkUI_Stage_Search_SearchIcon_3000] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_0100 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Get the default value of cancelButton.style + */ + it('[ArkUI_Stage_Search_CancelButton_0100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_0100] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_CancelButton_0100]: " + JSON.stringify(newJson)); + + let obj = JSON.parse(newJson); + console.info("[ArkUI_Stage_Search_CancelButton_0100]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_0100]: " + JSON.stringify(obj.$attrs.cancelButton.style)); + expect(obj.$attrs.cancelButton.style).assertEqual("CancelButtonStyle.INPUT"); + console.info("[ArkUI_Stage_Search_CancelButton_0100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_0200 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.style as CancelButtonStyle.CONSTANT + */ + it('[ArkUI_Stage_Search_CancelButton_0200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_0200] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_0200]: " + JSON.stringify(newJson)); + + let rightButtonStyleParam = CancelButtonStyle.CONSTANT; + try { + var eventData = { + data: { + "rightButtonStyleParam": rightButtonStyleParam + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_0200] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_0200] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_0200]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_0200]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_0200]: " + JSON.stringify(obj.$attrs.cancelButton.style)); + expect(obj.$attrs.cancelButton.style).assertEqual("CancelButtonStyle.CONSTANT"); + console.info("[ArkUI_Stage_Search_CancelButton_0200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_0300 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.style as CancelButtonStyle.INVISIBLE + */ + it('[ArkUI_Stage_Search_CancelButton_0300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_0300] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_0300]: " + JSON.stringify(newJson)); + + let rightButtonStyleParam = CancelButtonStyle.INVISIBLE; + try { + var eventData = { + data: { + "rightButtonStyleParam": rightButtonStyleParam + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_0300] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_0300] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_0300]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_0300]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_0300]: " + JSON.stringify(obj.$attrs.cancelButton.style)); + expect(obj.$attrs.cancelButton.style).assertEqual("CancelButtonStyle.INVISIBLE"); + console.info("[ArkUI_Stage_Search_CancelButton_0300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_0400 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.style as null + */ + it('[ArkUI_Stage_Search_CancelButton_0400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_0400] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_0400]: " + JSON.stringify(newJson)); + + let rightButtonStyleParam = null; + try { + var eventData = { + data: { + "rightButtonStyleParam": rightButtonStyleParam + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_0400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_0400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_0400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_0400]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_0400]: " + JSON.stringify(obj.$attrs.cancelButton.style)); + expect(obj.$attrs.cancelButton.style).assertEqual("CancelButtonStyle.INPUT"); + console.info("[ArkUI_Stage_Search_CancelButton_0400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_0500 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.style as undefined + */ + it('[ArkUI_Stage_Search_CancelButton_0500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_0500] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_0500]: " + JSON.stringify(newJson)); + + let rightButtonStyleParam = undefined; + try { + var eventData = { + data: { + "rightButtonStyleParam": rightButtonStyleParam + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_0500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_0500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_0500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_0500]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_0500]: " + JSON.stringify(obj.$attrs.cancelButton.style)); + expect(obj.$attrs.cancelButton.style).assertEqual("CancelButtonStyle.INPUT"); + console.info("[ArkUI_Stage_Search_CancelButton_0500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_0600 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Get the default value of cancelButton.icon.size + */ + it('[ArkUI_Stage_Search_CancelButton_0600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_0600] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_CancelButton_0600]: " + JSON.stringify(newJson)); + let newJsonDefault = getInspectorByKey('searchTestDefaultValue'); + + let obj = JSON.parse(newJson); + let objDefault = JSON.parse(newJsonDefault); + console.info("[ArkUI_Stage_Search_CancelButton_0600]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_0600]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual(objDefault.$attrs.cancelButton.icon.size); + console.info("[ArkUI_Stage_Search_CancelButton_0600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_0700 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as 26 + */ + it('[ArkUI_Stage_Search_CancelButton_0700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_0700] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_0700]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeNumber = 26; + try { + var eventData = { + data: { + "rightCancelIconSizeNumber": rightCancelIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_0700] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_0700] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_0700]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_0700]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_0700]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + let result : number = 26; + console.info("[ArkUI_Stage_Search_CancelButton_0700]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_CancelButton_0700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_0800 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as 50px + */ + it('[ArkUI_Stage_Search_CancelButton_0800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_0800] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CancelButton_0800]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeString = '50px'; + try { + var eventData = { + data: { + "rightCancelIconSizeString": rightCancelIconSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_0800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_0800] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CancelButton_0800]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_0800]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_0800]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual("50.00px"); + console.info("[ArkUI_Stage_Search_CancelButton_0800] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_0900 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as 50fp + */ + it('[ArkUI_Stage_Search_CancelButton_0900]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_0900] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CancelButton_0900]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeString = '50fp'; + try { + var eventData = { + data: { + "rightCancelIconSizeString": rightCancelIconSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_0900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_0900] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CancelButton_0900]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_0900]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_0900]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + let result : number = 50; + console.info("[ArkUI_Stage_Search_CancelButton_0900]: " + fp2px(result).toFixed(2)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual(fp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_CancelButton_0900] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_1000 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as 50lpx + */ + it('[ArkUI_Stage_Search_CancelButton_1000]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_1000] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CancelButton_1000]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeString = '50lpx'; + try { + var eventData = { + data: { + "rightCancelIconSizeString": rightCancelIconSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_1000] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_1000] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CancelButton_1000]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_1000]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_1000]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + let result : number = 50; + console.info("[ArkUI_Stage_Search_CancelButton_1000]: " + lpx2px(result).toFixed(2)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual(lpx2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_CancelButton_1000] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_1100 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as $r('sys.float.ohos_id_text_paragraph_margin_m') + */ + it('[ArkUI_Stage_Search_CancelButton_1100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_1100] start"); + let newJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_CancelButton_1100]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeResource = $r('sys.float.ohos_id_text_paragraph_margin_m'); + try { + var eventData = { + data: { + "rightCancelIconSizeResource": rightCancelIconSizeResource + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_1100] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_1100] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_CancelButton_1100]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_1100]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_1100]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + let result : number = 16; + console.info("[ArkUI_Stage_Search_CancelButton_1100]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_CancelButton_1100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_1200 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as 40 + */ + it('[ArkUI_Stage_Search_CancelButton_1200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_1200] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1200]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeNumber = 40; + try { + var eventData = { + data: { + "rightCancelIconSizeNumber": rightCancelIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_1200] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_1200] change component data error: " + err.message); + } + await Utils.sleep(5000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1200]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_1200]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_1200]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + let result : number = 40; + console.info("[ArkUI_Stage_Search_CancelButton_1200]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_CancelButton_1200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_1300 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as 0 + */ + it('[ArkUI_Stage_Search_CancelButton_1300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_1300] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1300]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeNumber = 0; + try { + var eventData = { + data: { + "rightCancelIconSizeNumber": rightCancelIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_1300] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_1300] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1300]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_1300]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_1300]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + let result : number = 0; + console.info("[ArkUI_Stage_Search_CancelButton_1300]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_CancelButton_1300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_1400 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as -16 + */ + it('[ArkUI_Stage_Search_CancelButton_1400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_1400] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1400]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeNumber = -16; + try { + var eventData = { + data: { + "rightCancelIconSizeNumber": rightCancelIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_1400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_1400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_1400]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_1400]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual("24.00px"); + console.info("[ArkUI_Stage_Search_CancelButton_1400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_1500 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as 10000 + */ + it('[ArkUI_Stage_Search_CancelButton_1500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_1500] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1500]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeNumber = 10000; + try { + var eventData = { + data: { + "rightCancelIconSizeNumber": rightCancelIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_1500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_1500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_1500]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_1500]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + let result : number = 10000; + console.info("[ArkUI_Stage_Search_CancelButton_1500]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_CancelButton_1500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_1600 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as null + */ + it('[ArkUI_Stage_Search_CancelButton_1600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_1600] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1600]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeNumber = null; + try { + var eventData = { + data: { + "rightCancelIconSizeNumber": rightCancelIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_1600] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_1600] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1600]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_1600]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_1600]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual("24.00px"); + console.info("[ArkUI_Stage_Search_CancelButton_1600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_1700 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as undefined + */ + it('[ArkUI_Stage_Search_CancelButton_1700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_1700] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1700]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeNumber = undefined; + try { + var eventData = { + data: { + "rightCancelIconSizeNumber": rightCancelIconSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_1700] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_1700] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1700]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_1700]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_1700]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual("24.00px"); + console.info("[ArkUI_Stage_Search_CancelButton_1700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_1800 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Get the default value of cancelButton.icon.color + */ + it('[ArkUI_Stage_Search_CancelButton_1800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_1800] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_CancelButton_1800]: " + JSON.stringify(newJson)); + let newJsonDefault = getInspectorByKey('searchTestDefaultValue'); + + let obj = JSON.parse(newJson); + let objDefault = JSON.parse(newJsonDefault); + console.info("[ArkUI_Stage_Search_CancelButton_1800]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_1800]: " + JSON.stringify(obj.$attrs.cancelButton.icon.color)); + expect(obj.$attrs.cancelButton.icon.color).assertEqual(objDefault.$attrs.cancelButton.icon.color); + console.info("[ArkUI_Stage_Search_CancelButton_1800] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_1900 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.color as 0x00ff00 + */ + it('[ArkUI_Stage_Search_CancelButton_1900]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_1900] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1900]: " + JSON.stringify(newJson)); + + let rightCancelIconColorNumber = 0x00ff00; + try { + var eventData = { + data: { + "rightCancelIconColorNumber": rightCancelIconColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_1900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_1900] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_1900]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_1900]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_1900]: " + JSON.stringify(obj.$attrs.cancelButton.icon.color)); + expect(obj.$attrs.cancelButton.icon.color).assertEqual("#FF00FF00"); + console.info("[ArkUI_Stage_Search_CancelButton_1900] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_2000 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.color as Color.Red + */ + it('[ArkUI_Stage_Search_CancelButton_2000]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_2000] start"); + let newJson = getInspectorByKey('searchTestColor'); + console.info("[ArkUI_Stage_Search_CancelButton_2000]: " + JSON.stringify(newJson)); + + let rightCancelIconColorColor = Color.Red; + try { + var eventData = { + data: { + "rightCancelIconColorColor": rightCancelIconColorColor + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_2000] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_2000] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestColor'); + console.info("[ArkUI_Stage_Search_CancelButton_2000]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_2000]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2000]: " + JSON.stringify(obj.$attrs.cancelButton.icon.color)); + expect(obj.$attrs.cancelButton.icon.color).assertEqual("#FFFF0000"); + console.info("[ArkUI_Stage_Search_CancelButton_2000] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_2100 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.color as #ff9a35 + */ + it('[ArkUI_Stage_Search_CancelButton_2100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_2100] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CancelButton_2100]: " + JSON.stringify(newJson)); + + let rightCancelIconColorString = '#ff9a35'; + try { + var eventData = { + data: { + "rightCancelIconColorString": rightCancelIconColorString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_2100] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_2100] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CancelButton_2100]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_2100]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2100]: " + JSON.stringify(obj.$attrs.cancelButton.icon.color)); + expect(obj.$attrs.cancelButton.icon.color).assertEqual("#FFFF9A35"); + console.info("[ArkUI_Stage_Search_CancelButton_2100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_2200 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.color as $r('sys.color.ohos_id_color_connected') + */ + it('[ArkUI_Stage_Search_CancelButton_2200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_2200] start"); + let newJson = getInspectorByKey('searchTestResource'); + 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); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_CancelButton_2200]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_2200]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2200]: " + JSON.stringify(obj.$attrs.cancelButton.icon.color)); + expect(obj.$attrs.cancelButton.icon.color).assertEqual('#FF00CB87'); + console.info("[ArkUI_Stage_Search_CancelButton_2200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_2300 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.color as abcdefghijk + */ + it('[ArkUI_Stage_Search_CancelButton_2300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_2300] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CancelButton_2300]: " + JSON.stringify(newJson)); + + let rightCancelIconColorString = 'abcdefghijk'; + try { + var eventData = { + data: { + "rightCancelIconColorString": rightCancelIconColorString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_2300] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_2300] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_CancelButton_2300]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_2300]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2300]: " + JSON.stringify(obj.$attrs.cancelButton.icon.color)); + expect(obj.$attrs.cancelButton.icon.color).assertEqual("#99182431"); + console.info("[ArkUI_Stage_Search_CancelButton_2300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_2400 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.color as null + */ + it('[ArkUI_Stage_Search_CancelButton_2400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_2400] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_2400]: " + JSON.stringify(newJson)); + + let rightCancelIconColorNumber = null; + try { + var eventData = { + data: { + "rightCancelIconColorNumber": rightCancelIconColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_2400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_2400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_2400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_2400]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2400]: " + JSON.stringify(obj.$attrs.cancelButton.icon.color)); + expect(obj.$attrs.cancelButton.icon.color).assertEqual("#99182431"); + console.info("[ArkUI_Stage_Search_CancelButton_2400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_2500 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.color as undefined + */ + it('[ArkUI_Stage_Search_CancelButton_2500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_2500] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_2500]: " + JSON.stringify(newJson)); + + let rightCancelIconColorNumber = undefined; + try { + var eventData = { + data: { + "rightCancelIconColorNumber": rightCancelIconColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_2500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_2500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_2500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_2500]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2500]: " + JSON.stringify(obj.$attrs.cancelButton.icon.color)); + expect(obj.$attrs.cancelButton.icon.color).assertEqual("#99182431"); + console.info("[ArkUI_Stage_Search_CancelButton_2500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_2600 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.size as 26 + * Set the value of cancelButton.icon.color as 0x00ff00 + */ + it('[ArkUI_Stage_Search_CancelButton_2600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_2600] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_2600]: " + JSON.stringify(newJson)); + + let rightCancelIconSizeNumber = 26; + let rightCancelIconColorNumber = 0x00ff00; + try { + var eventData = { + data: { + "rightCancelIconSizeNumber": rightCancelIconSizeNumber, + "rightCancelIconColorNumber": rightCancelIconColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_2600] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_2600] change component data error: " + err.message); + } + await Utils.sleep(2700); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_2600]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_2600]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2600]: " + JSON.stringify(obj.$attrs.cancelButton.icon.size)); + let result : number = 26; + console.info("[ArkUI_Stage_Search_CancelButton_2600]: " + vp2px(result).toFixed(2)); + expect(obj.$attrs.cancelButton.icon.size).assertEqual(vp2px(result).toFixed(2) + "px"); + console.info("[ArkUI_Stage_Search_CancelButton_2600]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2600]: " + JSON.stringify(obj.$attrs.cancelButton.icon.color)); + expect(obj.$attrs.cancelButton.icon.color).assertEqual("#FF00FF00"); + console.info("[ArkUI_Stage_Search_CancelButton_2600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_2700 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Get the default value of cancelButton.icon.src + */ + it('[ArkUI_Stage_Search_CancelButton_2700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_2700] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_CancelButton_2700]: " + JSON.stringify(newJson)); + + let obj = JSON.parse(newJson); + console.info("[ArkUI_Stage_Search_CancelButton_2700]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2700]: " + JSON.stringify(obj.$attrs.cancelButton.icon.src)); + expect(obj.$attrs.cancelButton.icon.src).assertEqual('resource:///ohos_close.svg'); + console.info("[ArkUI_Stage_Search_CancelButton_2700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_2800 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.src as common/icon2.svg + */ + it('[ArkUI_Stage_Search_CancelButton_2800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_2800] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_2800]: " + JSON.stringify(newJson)); + + let rightIconSrcPath = 'common/icon2.svg'; + try { + var eventData = { + data: { + "rightIconSrcPath": rightIconSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_2800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_2800] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_2800]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_2800]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2800]: " + JSON.stringify(obj.$attrs.cancelButton.icon.src)); + expect(obj.$attrs.cancelButton.icon.src).assertEqual('common/icon2.svg'); + console.info("[ArkUI_Stage_Search_CancelButton_2800] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_2900 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.src as common/icon2.jpg + */ + it('[ArkUI_Stage_Search_CancelButton_2900]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_2900] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_2900]: " + JSON.stringify(newJson)); + + let rightIconSrcPath = 'common/icon2.jpg'; + try { + var eventData = { + data: { + "rightIconSrcPath": rightIconSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_2900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_2900] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_2900]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_2900]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_2900]: " + JSON.stringify(obj.$attrs.cancelButton.icon.src)); + expect(obj.$attrs.cancelButton.icon.src).assertEqual('common/icon2.jpg'); + console.info("[ArkUI_Stage_Search_CancelButton_2900] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_3000 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.src as common/icon2.png + */ + it('[ArkUI_Stage_Search_CancelButton_3000]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_3000] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_3000]: " + JSON.stringify(newJson)); + + let rightIconSrcPath = 'common/icon2.png'; + try { + var eventData = { + data: { + "rightIconSrcPath": rightIconSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_3000] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_3000] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_3000]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_3000]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_3000]: " + JSON.stringify(obj.$attrs.cancelButton.icon.src)); + expect(obj.$attrs.cancelButton.icon.src).assertEqual('common/icon2.png'); + console.info("[ArkUI_Stage_Search_CancelButton_3000] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_3100 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.src as $r('sys.media.ohos_app_icon') + */ + it('[ArkUI_Stage_Search_CancelButton_3100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_3100] start"); + let newJson = getInspectorByKey('searchTestResource'); + 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); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_CancelButton_3100]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_3100]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_3100]: " + JSON.stringify(obj.$attrs.cancelButton.icon.src)); + expect(obj.$attrs.cancelButton.icon.src).assertEqual('resource:///125829858.png'); + console.info("[ArkUI_Stage_Search_CancelButton_3100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_3200 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.src as abc/def/ghi.jkl + */ + it('[ArkUI_Stage_Search_CancelButton_3200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_3200] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_3200]: " + JSON.stringify(newJson)); + + let rightIconSrcPath = 'abc/def/ghi.jkl'; + try { + var eventData = { + data: { + "rightIconSrcPath": rightIconSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_3200] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_3200] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_3200]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_3200]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_3200]: " + JSON.stringify(obj.$attrs.cancelButton.icon.src)); + expect(obj.$attrs.cancelButton.icon.src).assertEqual('abc/def/ghi.jkl'); + console.info("[ArkUI_Stage_Search_CancelButton_3200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_3300 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.src as '' + */ + it('[ArkUI_Stage_Search_CancelButton_3300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_3300] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_3300]: " + JSON.stringify(newJson)); + + let rightIconSrcPath = ''; + try { + var eventData = { + data: { + "rightIconSrcPath": rightIconSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_3300] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_3300] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_3300]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_3300]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_3300]: " + JSON.stringify(obj.$attrs.cancelButton.icon.src)); + expect(obj.$attrs.cancelButton.icon.src).assertEqual('resource:///ohos_close.svg'); + console.info("[ArkUI_Stage_Search_CancelButton_3300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_3400 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.src as null + */ + it('[ArkUI_Stage_Search_CancelButton_3400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_3400] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_3400]: " + JSON.stringify(newJson)); + + let rightIconSrcPath = null; + try { + var eventData = { + data: { + "rightIconSrcPath": rightIconSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_3400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_3400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_3400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_3400]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_3400]: " + JSON.stringify(obj.$attrs.cancelButton.icon.src)); + expect(obj.$attrs.cancelButton.icon.src).assertEqual('resource:///ohos_close.svg'); + console.info("[ArkUI_Stage_Search_CancelButton_3400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_CancelButton_3500 + * @tc.name Tests the cancelButton property of the search component + * @tc.desc Set the value of cancelButton.icon.src as undefined + */ + it('[ArkUI_Stage_Search_CancelButton_3500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_CancelButton_3500] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_3500]: " + JSON.stringify(newJson)); + + let rightIconSrcPath = undefined; + try { + var eventData = { + data: { + "rightIconSrcPath": rightIconSrcPath + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_CancelButton_3500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_CancelButton_3500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_CancelButton_3500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_CancelButton_3500]: " + JSON.stringify(obj.$attrs.cancelButton)); + console.info("[ArkUI_Stage_Search_CancelButton_3500]: " + JSON.stringify(obj.$attrs.cancelButton.icon.src)); + expect(obj.$attrs.cancelButton.icon.src).assertEqual('resource:///ohos_close.svg'); + console.info("[ArkUI_Stage_Search_CancelButton_3500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_0100 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Get the default value of searchButton.fontSize + */ + it('[ArkUI_Stage_Search_SearchButton_0100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_0100] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_SearchButton_0100]: " + JSON.stringify(newJson)); + let newJsonDefault = getInspectorByKey('searchTestDefaultValue'); + + let obj = JSON.parse(newJson); + let objDefault = JSON.parse(newJsonDefault); + console.info("[ArkUI_Stage_Search_SearchButton_0100]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_0100]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual(objDefault.$attrs.searchButtonOption.fontSize); + console.info("[ArkUI_Stage_Search_SearchButton_0100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_0200 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as 20vp + */ + it('[ArkUI_Stage_Search_SearchButton_0200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_0200] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0200]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeString = '20vp'; + try { + var eventData = { + data: { + "searchButtonFontSizeString": searchButtonFontSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_0200] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_0200] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0200]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_0200]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_0200]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual("20.00vp"); + console.info("[ArkUI_Stage_Search_SearchButton_0200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_0300 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as 40vp + */ + it('[ArkUI_Stage_Search_SearchButton_0300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_0300] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0300]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeString = '40vp'; + try { + var eventData = { + data: { + "searchButtonFontSizeString": searchButtonFontSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_0300] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_0300] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0300]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_0300]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_0300]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual("40.00vp"); + console.info("[ArkUI_Stage_Search_SearchButton_0300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_0400 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as 20 + */ + it('[ArkUI_Stage_Search_SearchButton_0400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_0400] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchButton_0400]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeNumber = 20; + try { + var eventData = { + data: { + "searchButtonFontSizeNumber": searchButtonFontSizeNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_0400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_0400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchButton_0400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_0400]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_0400]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual('20.00fp'); + console.info("[ArkUI_Stage_Search_SearchButton_0400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_0500 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as 40fp + */ + it('[ArkUI_Stage_Search_SearchButton_0500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_0500] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0500]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeString = '40px'; + try { + var eventData = { + data: { + "searchButtonFontSizeString": searchButtonFontSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_0500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_0500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_0500]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_0500]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual("40.00px"); + console.info("[ArkUI_Stage_Search_SearchButton_0500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_0600 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as 40lpx + */ + it('[ArkUI_Stage_Search_SearchButton_0600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_0600] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0600]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeString = '40lpx'; + try { + var eventData = { + data: { + "searchButtonFontSizeString": searchButtonFontSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_0600] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_0600] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0600]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_0600]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_0600]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual("40.00lpx"); + console.info("[ArkUI_Stage_Search_SearchButton_0600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_0700 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as $r('sys.float.ohos_id_text_paragraph_margin_m') + */ + it('[ArkUI_Stage_Search_SearchButton_0700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_0700] start"); + let newJson = getInspectorByKey('searchTestResource'); + 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); + } + await Utils.sleep(5000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_SearchButton_0700]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_0700]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_0700]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual('16.00vp'); + console.info("[ArkUI_Stage_Search_SearchButton_0700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_0800 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as 0vp + */ + it('[ArkUI_Stage_Search_SearchButton_0800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_0800] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0800]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeString = '0vp'; + try { + var eventData = { + data: { + "searchButtonFontSizeString": searchButtonFontSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_0800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_0800] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0800]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_0800]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_0800]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual("0.00vp"); + console.info("[ArkUI_Stage_Search_SearchButton_0800] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_0900 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as 800vp + */ + it('[ArkUI_Stage_Search_SearchButton_0900]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_0900] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0900]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeString = '800vp'; + try { + var eventData = { + data: { + "searchButtonFontSizeString": searchButtonFontSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_0900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_0900] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_0900]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_0900]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_0900]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual("800.00vp"); + console.info("[ArkUI_Stage_Search_SearchButton_0900] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_1000 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as -14vp + */ + it('[ArkUI_Stage_Search_SearchButton_1000]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_1000] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_1000]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeString = '-14vp'; + try { + var eventData = { + data: { + "searchButtonFontSizeString": searchButtonFontSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_1000] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_1000] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_1000]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_1000]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_1000]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual("16.00fp"); + console.info("[ArkUI_Stage_Search_SearchButton_1000] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_1100 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as null + */ + it('[ArkUI_Stage_Search_SearchButton_1100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_1100] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_1100]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeString = null; + try { + var eventData = { + data: { + "searchButtonFontSizeString": searchButtonFontSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_1100] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_1100] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_1100]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_1100]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_1100]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual("16.00fp"); + console.info("[ArkUI_Stage_Search_SearchButton_1100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_1200 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as undefined + */ + it('[ArkUI_Stage_Search_SearchButton_1200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_1200] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_1200]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeString = undefined; + try { + var eventData = { + data: { + "searchButtonFontSizeString": searchButtonFontSizeString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_1200] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_1200] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_1200]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_1200]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_1200]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual("16.00fp"); + console.info("[ArkUI_Stage_Search_SearchButton_1200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_1300 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Get the default value of searchButton.fontColor + */ + it('[ArkUI_Stage_Search_SearchButton_1300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_1300] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_SearchButton_1300]: " + JSON.stringify(newJson)); + let newJsonDefault = getInspectorByKey('searchTestDefaultValue'); + + let obj = JSON.parse(newJson); + let objDefault = JSON.parse(newJsonDefault); + console.info("[ArkUI_Stage_Search_SearchButton_1300]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_1300]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontColor)); + expect(obj.$attrs.searchButtonOption.fontColor).assertEqual(objDefault.$attrs.searchButtonOption.fontColor); + console.info("[ArkUI_Stage_Search_SearchButton_1300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_1400 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontColor as 0xff0000 + */ + it('[ArkUI_Stage_Search_SearchButton_1400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_1400] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchButton_1400]: " + JSON.stringify(newJson)); + + let searchButtonFontColorNumber = 0xff0000; + try { + var eventData = { + data: { + "searchButtonFontColorNumber": searchButtonFontColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_1400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_1400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchButton_1400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_1400]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_1400]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontColor)); + expect(obj.$attrs.searchButtonOption.fontColor).assertEqual("#FFFF0000"); + console.info("[ArkUI_Stage_Search_SearchButton_1400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_1500 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontColor as Color.Blue + */ + it('[ArkUI_Stage_Search_SearchButton_1500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_1500] start"); + let newJson = getInspectorByKey('searchTestColor'); + console.info("[ArkUI_Stage_Search_SearchButton_1500]: " + JSON.stringify(newJson)); + + let searchButtonFontColorColor = Color.Blue; + try { + var eventData = { + data: { + "searchButtonFontColorColor": searchButtonFontColorColor + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_1500] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_1500] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestColor'); + console.info("[ArkUI_Stage_Search_SearchButton_1500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_1500]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_1500]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontColor)); + expect(obj.$attrs.searchButtonOption.fontColor).assertEqual("#FF0000FF"); + console.info("[ArkUI_Stage_Search_SearchButton_1500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_1600 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontColor as #ff9a35 + */ + it('[ArkUI_Stage_Search_SearchButton_1600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_1600] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_1600]: " + JSON.stringify(newJson)); + + let searchButtonFontColorString = '#ff9a35'; + try { + var eventData = { + data: { + "searchButtonFontColorString": searchButtonFontColorString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_1600] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_1600] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_1600]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_1600]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_1600]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontColor)); + expect(obj.$attrs.searchButtonOption.fontColor).assertEqual("#FFFF9A35"); + console.info("[ArkUI_Stage_Search_SearchButton_1600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_1700 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontColor as $r('sys.color.ohos_id_color_connected') + */ + it('[ArkUI_Stage_Search_SearchButton_1700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_1700] start"); + let newJson = getInspectorByKey('searchTestResource'); + 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); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_SearchButton_1700]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_1700]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_1700]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontColor)); + expect(obj.$attrs.searchButtonOption.fontColor).assertEqual('#FF00CB87'); + console.info("[ArkUI_Stage_Search_SearchButton_1700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_1800 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontColor as abcdefghijk + */ + it('[ArkUI_Stage_Search_SearchButton_1800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_1800] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_1800]: " + JSON.stringify(newJson)); + + let searchButtonFontColorString = 'abcdefghijk'; + try { + var eventData = { + data: { + "searchButtonFontColorString": searchButtonFontColorString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_1800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_1800] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_SearchButton_1800]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_1800]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_1800]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontColor)); + expect(obj.$attrs.searchButtonOption.fontColor).assertEqual("#FF007DFF"); + console.info("[ArkUI_Stage_Search_SearchButton_1800] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_1900 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontColor as null + */ + it('[ArkUI_Stage_Search_SearchButton_1900]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_1900] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchButton_1900]: " + JSON.stringify(newJson)); + + let searchButtonFontColorNumber = null; + try { + var eventData = { + data: { + "searchButtonFontColorNumber": searchButtonFontColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_1900] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_1900] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchButton_1900]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_1900]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_1900]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontColor)); + expect(obj.$attrs.searchButtonOption.fontColor).assertEqual("#FF007DFF"); + console.info("[ArkUI_Stage_Search_SearchButton_1900] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_2000 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontColor as undefined + */ + it('[ArkUI_Stage_Search_SearchButton_2000]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_2000] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchButton_2000]: " + JSON.stringify(newJson)); + + let searchButtonFontColorNumber = undefined; + try { + var eventData = { + data: { + "searchButtonFontColorNumber": searchButtonFontColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_2000] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_2000] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchButton_2000]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_2000]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_2000]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontColor)); + expect(obj.$attrs.searchButtonOption.fontColor).assertEqual("#FF007DFF"); + console.info("[ArkUI_Stage_Search_SearchButton_2000] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_SearchButton_2100 + * @tc.name Tests the searchButton property of the search component + * @tc.desc Set the value of searchButton.fontSize as 20 + * Set the value of searchButton.fontColor as 0xff0000 + */ + it('[ArkUI_Stage_Search_SearchButton_2100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_SearchButton_2100] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchButton_2100]: " + JSON.stringify(newJson)); + + let searchButtonFontSizeNumber = 20; + let searchButtonFontColorNumber = 0xff0000; + try { + var eventData = { + data: { + "searchButtonFontSizeNumber": searchButtonFontSizeNumber, + "searchButtonFontColorNumber": searchButtonFontColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_SearchButton_2100] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_SearchButton_2100] change component data error: " + err.message); + } + await Utils.sleep(2100); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_SearchButton_2100]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_SearchButton_2100]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_2100]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontSize)); + expect(obj.$attrs.searchButtonOption.fontSize).assertEqual("20.00fp"); + console.info("[ArkUI_Stage_Search_SearchButton_2100]: " + JSON.stringify(obj.$attrs.searchButton)); + console.info("[ArkUI_Stage_Search_SearchButton_2100]: " + JSON.stringify(obj.$attrs.searchButtonOption.fontColor)); + expect(obj.$attrs.searchButtonOption.fontColor).assertEqual("#FFFF0000"); + console.info("[ArkUI_Stage_Search_SearchButton_2100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_FontColor_0100 + * @tc.name Tests the fontColor property of the search component + * @tc.desc Get the default value of fontColor + */ + it('[ArkUI_Stage_Search_FontColor_0100]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_FontColor_0100] start"); + let newJson = getInspectorByKey('searchTestDefault'); + console.info("[ArkUI_Stage_Search_FontColor_0100]: " + JSON.stringify(newJson)); + + let obj = JSON.parse(newJson); + console.info("[ArkUI_Stage_Search_FontColor_0100]: " + JSON.stringify(obj.$attrs.fontColor)); + expect(obj.$attrs.fontColor).assertEqual("#FF182431"); + console.info("[ArkUI_Stage_Search_FontColor_0100] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_FontColor_0200 + * @tc.name Tests the fontColor property of the search component + * @tc.desc Set the value of fontColor as 0xff0000 + */ + it('[ArkUI_Stage_Search_FontColor_0200]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_FontColor_0200] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_FontColor_0200]: " + JSON.stringify(newJson)); + + let textColorNumber = 0xff0000; + try { + var eventData = { + data: { + "textColorNumber": textColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_FontColor_0200] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_FontColor_0200] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_FontColor_0200]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_FontColor_0200]: " + JSON.stringify(obj.$attrs.fontColor)); + expect(obj.$attrs.fontColor).assertEqual("#FFFF0000"); + console.info("[ArkUI_Stage_Search_FontColor_0200] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_FontColor_0300 + * @tc.name Tests the fontColor property of the search component + * @tc.desc Set the value of fontColor as Color.Red + */ + it('[ArkUI_Stage_Search_FontColor_0300]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_FontColor_0300] start"); + let newJson = getInspectorByKey('searchTestColor'); + console.info("[ArkUI_Stage_Search_FontColor_0300]: " + JSON.stringify(newJson)); + + let textColorColor = Color.Red; + try { + var eventData = { + data: { + "textColorColor": textColorColor + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_FontColor_0300] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_FontColor_0300] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestColor'); + console.info("[ArkUI_Stage_Search_FontColor_0300]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_FontColor_0300]: " + JSON.stringify(obj.$attrs.fontColor)); + expect(obj.$attrs.fontColor).assertEqual("#FFFF0000"); + console.info("[ArkUI_Stage_Search_FontColor_0300] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_FontColor_0400 + * @tc.name Tests the fontColor property of the search component + * @tc.desc Set the value of fontColor as #ff9a35 + */ + it('[ArkUI_Stage_Search_FontColor_0400]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_FontColor_0400] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_FontColor_0400]: " + JSON.stringify(newJson)); + + let textColorString = '#ff9a35'; + try { + var eventData = { + data: { + "textColorString": textColorString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_FontColor_0400] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_FontColor_0400] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_FontColor_0400]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_FontColor_0400]: " + JSON.stringify(obj.$attrs.fontColor)); + expect(obj.$attrs.fontColor).assertEqual("#FFFF9A35"); + console.info("[ArkUI_Stage_Search_FontColor_0400] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_FontColor_0500 + * @tc.name Tests the fontColor property of the search component + * @tc.desc Set the value of fontColor as $r('sys.color.ohos_id_color_connected') + */ + it('[ArkUI_Stage_Search_FontColor_0500]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_FontColor_0500] start"); + let newJson = getInspectorByKey('searchTestResource'); + 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); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestResource'); + console.info("[ArkUI_Stage_Search_FontColor_0500]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_FontColor_0500]: " + JSON.stringify(obj.$attrs.fontColor)); + expect(obj.$attrs.fontColor).assertEqual('#FF00CB87'); + console.info("[ArkUI_Stage_Search_FontColor_0500] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_FontColor_0600 + * @tc.name Tests the fontColor property of the search component + * @tc.desc Set the value of fontColor as abcdefghijk + */ + it('[ArkUI_Stage_Search_FontColor_0600]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_FontColor_0600] start"); + let newJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_FontColor_0600]: " + JSON.stringify(newJson)); + + let textColorString = 'abcdefghijk'; + try { + var eventData = { + data: { + "textColorString": textColorString + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_FontColor_0600] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_FontColor_0600] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestString'); + console.info("[ArkUI_Stage_Search_FontColor_0600]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_FontColor_0600]: " + JSON.stringify(obj.$attrs.fontColor)); + expect(obj.$attrs.fontColor).assertEqual("#FF182431"); + console.info("[ArkUI_Stage_Search_FontColor_0600] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_FontColor_0700 + * @tc.name Tests the fontColor property of the search component + * @tc.desc Set the value of fontColor as null + */ + it('[ArkUI_Stage_Search_FontColor_0700]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_FontColor_0700] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_FontColor_0700]: " + JSON.stringify(newJson)); + + let textColorNumber = null; + try { + var eventData = { + data: { + "textColorNumber": textColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_FontColor_0700] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_FontColor_0700] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_FontColor_0700]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_FontColor_0700]: " + JSON.stringify(obj.$attrs.fontColor)); + expect(obj.$attrs.fontColor).assertEqual("#FF182431"); + console.info("[ArkUI_Stage_Search_FontColor_0700] end"); + done(); + }); + + /** + * @tc.number ArkUI_Stage_Search_FontColor_0800 + * @tc.name Tests the fontColor property of the search component + * @tc.desc Set the value of fontColor as undefined + */ + it('[ArkUI_Stage_Search_FontColor_0800]', 0, async function (done) { + console.info("[ArkUI_Stage_Search_FontColor_0800] start"); + let newJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_FontColor_0800]: " + JSON.stringify(newJson)); + + let textColorNumber = undefined; + try { + var eventData = { + data: { + "textColorNumber": textColorNumber + } + } + var innerEvent = { + eventId: 183, + priority: events_emitter.EventPriority.LOW + } + console.info("[ArkUI_Stage_Search_FontColor_0800] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[ArkUI_Stage_Search_FontColor_0800] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('searchTestNumber'); + console.info("[ArkUI_Stage_Search_FontColor_0800]: " + JSON.stringify(strJson)) + let obj = JSON.parse(strJson); + console.info("[ArkUI_Stage_Search_FontColor_0800]: " + JSON.stringify(obj.$attrs.fontColor)); + expect(obj.$attrs.fontColor).assertEqual("#FF182431"); + console.info("[ArkUI_Stage_Search_FontColor_0800] end"); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/Utils.ets b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f5af86ac64b95969d282053243e4e777e5386a2 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/ets/test/Utils.ets @@ -0,0 +1,25 @@ +/* + * 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 default class Utils { + static sleep(time){ + return new Promise((resolve,reject)=>{ + setTimeout(()=>{ + resolve("ok") + },time) + }).then(()=>{ + console.info(`sleep ${time} over...`) + }) + } +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/module.json b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..52b58e7da8a7c36f4cf263adaea710db6076eefb --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry_test", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "abilities": [ + { + "name": "TestAbility", + "srcEntrance": "./ets/TestAbility/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "visible": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/element/color.json b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02 --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/element/string.json b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/media/icon.png b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/media/icon.png differ diff --git a/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/profile/test_pages.json b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..77e90731b5a38d861663029b483df3d3ac9ec74b --- /dev/null +++ b/arkui/ace_ets_components_ux/ace_ets_component_search/src/main/resources/base/profile/test_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "TestAbility/pages/Index" + ] +}