Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
576afcfd
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
576afcfd
编写于
6月 28, 2023
作者:
S
sunjiakun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add indexer update textinterface
Signed-off-by:
N
sunjiakun
<
sunjiakun3@huawei.com
>
上级
06833552
变更
19
展开全部
隐藏空白更改
内联
并排
Showing
19 changed file
with
1509 addition
and
0 deletion
+1509
-0
arkui/ace_ets_components_ux/BUILD.gn
arkui/ace_ets_components_ux/BUILD.gn
+1
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/AppScope/app.json
...components_ux/ace_ets_component_indexer/AppScope/app.json
+19
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/AppScope/resources/base/element/string.json
...onent_indexer/AppScope/resources/base/element/string.json
+8
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/AppScope/resources/base/media/app_icon.png
...ponent_indexer/AppScope/resources/base/media/app_icon.png
+0
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/BUILD.gn
.../ace_ets_components_ux/ace_ets_component_indexer/BUILD.gn
+43
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/Test.json
...ace_ets_components_ux/ace_ets_component_indexer/Test.json
+26
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/signature/openharmony_sx.p7b
...ux/ace_ets_component_indexer/signature/openharmony_sx.p7b
+0
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/TestAbility/TestAbility.ets
...omponent_indexer/src/main/ets/TestAbility/TestAbility.ets
+63
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/TestAbility/pages/Index.ets
...omponent_indexer/src/main/ets/TestAbility/pages/Index.ets
+441
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
..._indexer/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+84
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/test/AlphabetIndexer.ets
...s_component_indexer/src/main/ets/test/AlphabetIndexer.ets
+555
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/test/List.test.ets
...ace_ets_component_indexer/src/main/ets/test/List.test.ets
+19
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/test/Utils.ets
..._ux/ace_ets_component_indexer/src/main/ets/test/Utils.ets
+142
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/module.json
...ponents_ux/ace_ets_component_indexer/src/main/module.json
+41
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/resources/base/element/color.json
...ponent_indexer/src/main/resources/base/element/color.json
+24
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/resources/base/element/string.json
...onent_indexer/src/main/resources/base/element/string.json
+36
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/resources/base/media/icon.png
..._component_indexer/src/main/resources/base/media/icon.png
+0
-0
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/resources/base/profile/test_pages.json
...t_indexer/src/main/resources/base/profile/test_pages.json
+5
-0
arkui/ace_ets_components_ux/ace_ets_component_text/src/main/ets/TestAbility/pages/Index.ets
...s_component_text/src/main/ets/TestAbility/pages/Index.ets
+2
-0
未找到文件。
arkui/ace_ets_components_ux/BUILD.gn
浏览文件 @
576afcfd
...
@@ -21,6 +21,7 @@ group("componentUxTest") {
...
@@ -21,6 +21,7 @@ group("componentUxTest") {
"ace_ets_component_clickeffect:ActsAceClickEffectTest",
"ace_ets_component_clickeffect:ActsAceClickEffectTest",
"ace_ets_component_datapanel:ActsAceDatapanelTest",
"ace_ets_component_datapanel:ActsAceDatapanelTest",
"ace_ets_component_datepicker:ActsAceDatePickerTest",
"ace_ets_component_datepicker:ActsAceDatePickerTest",
"ace_ets_component_indexer:ActsAlphabetIndexerTest",
"ace_ets_component_list:ActsAceListTest",
"ace_ets_component_list:ActsAceListTest",
"ace_ets_component_menu:ActsAceMenuTest",
"ace_ets_component_menu:ActsAceMenuTest",
"ace_ets_component_popup:ActsAcePopupTest",
"ace_ets_component_popup:ActsAcePopupTest",
...
...
arkui/ace_ets_components_ux/ace_ets_component_indexer/AppScope/app.json
0 → 100644
浏览文件 @
576afcfd
{
"app"
:
{
"bundleName"
:
"com.example.alphabetindexer"
,
"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
arkui/ace_ets_components_ux/ace_ets_component_indexer/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
576afcfd
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"AlphabetIndexerTest"
}
]
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_indexer/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
576afcfd
6.6 KB
arkui/ace_ets_components_ux/ace_ets_component_indexer/BUILD.gn
0 → 100644
浏览文件 @
576afcfd
# 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAlphabetIndexerTest") {
hap_profile = "src/main/module.json"
js_build_mode = "debug"
deps = [
":ace_ets_component_alphabetIndexer_js_assets",
":ace_ets_component_alphabetIndexer_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAlphabetIndexerTest"
part_name = "ace_engine"
subsystem_name = "arkui"
}
ohos_app_scope("ace_ets_component_alphabetIndexer_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("ace_ets_component_alphabetIndexer_js_assets") {
source_dir = "src/main/ets"
}
ohos_resources("ace_ets_component_alphabetIndexer_resources") {
sources = [ "src/main/resources" ]
deps = [ ":ace_ets_component_alphabetIndexer_profile" ]
hap_profile = "src/main/module.json"
}
arkui/ace_ets_components_ux/ace_ets_component_indexer/Test.json
0 → 100644
浏览文件 @
576afcfd
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"600000"
,
"bundle-name"
:
"com.example.alphabetindexer"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
240000
},
"kits"
:
[{
"test-file-name"
:
[
"ActsAlphabetIndexerTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
},
{
"type"
:
"ShellKit"
,
"run-command"
:
[
"power-shell wakeup"
,
"power-shell setmode 602"
]
}
]
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_indexer/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
576afcfd
文件已添加
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/TestAbility/TestAbility.ets
0 → 100644
浏览文件 @
576afcfd
/*
* 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');
}
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/TestAbility/pages/Index.ets
0 → 100644
浏览文件 @
576afcfd
/*
* 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 AlphabetIndexerTest {
private arrayA: string[] = ['安', '爱', '奥']
private arrayB: string[] = ['卜', '白', '包', '毕', '丙']
private arrayC: string[] = ['曹', '成', '陈', '催']
private arrayH: string[] = ['韩', '何', '郝', '黑']
private arrayL: string[] = ['刘', '李', '楼', '梁', '雷', '吕', '柳', '卢']
private arrayT: string[] = ['太', '天', '田', '唐', '陶', '汤']
private value: string[] = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
@State popupSelectedColorStr: string = '#00FF00'
@State popupUnselectedColorStr: string = '#DA70D6'
@State popupItemBackgroundStr: string = '#FFD700'
@State popupItemFontSizeStr: string = '20'
@State popupItemFontWeightStr: string = '400'
@State popupSpaceStr: string = '120'
@State popupSelectedColor: Color = Color.Orange
@State popupUnselectedColor: Color = Color.Green
@State popupItemBackgroundColor: Color = Color.Pink
@State popupSelectedColorNum: number = 0x00CED1
@State popupUnselectedColorNum: number = 0xC0FF3E
@State popupItemBackgroundNum: number = 0x8470FF
@State popupItemFontSizeNum: number = 30
@State popupItemFontWeightNum: number = FontWeight.Normal
@State popupSpaceNum: number = 50
@State popupSelectedColorRes: Resource = $r('app.color.popupSelectedColor')
@State popupUnselectedColorRes: Resource = $r('app.color.popupUnselectedColor')
@State popupItemBackgroundRes: Resource = $r('app.color.popupItemBackground')
@State popupItemFontSizeRes: Resource = $r('app.string.fontSize')
@State popupSpaceRes: Resource = $r('app.string.popupSpace')
@State popupItemFontWeightFont: number = FontWeight.Bolder
@State nullFlag1: boolean = false
@State nullFlag2: boolean = false
@State nullFlag3: boolean = false
@State nullFlag4: boolean = false
@State nullFlag5: boolean = false
private stateChangCallBack = (eventData) => {
console.info("sideBar page state change called:" + JSON.stringify(eventData));
if (eventData != null) {
if (eventData.data.popupSelectedColorStr != null) {
this.popupSelectedColorStr = eventData.data.popupSelectedColorStr;
}
if (eventData.data.popupUnselectedColorStr != null) {
this.popupUnselectedColorStr = eventData.data.popupUnselectedColorStr;
}
if (eventData.data.popupItemBackgroundStr != null) {
this.popupItemBackgroundStr = eventData.data.popupItemBackgroundStr;
}
if (eventData.data.popupItemFontSizeStr != null) {
this.popupItemFontSizeStr = eventData.data.popupItemFontSizeStr;
}
if (eventData.data.popupItemFontWeightStr != null) {
this.popupItemFontWeightStr = eventData.data.popupItemFontWeightStr;
}
if (eventData.data.popupSpaceStr != null) {
this.popupSpaceStr = eventData.data.popupSpaceStr;
}
if (eventData.data.popupSelectedColor != null) {
this.popupSelectedColor = eventData.data.popupSelectedColor;
}
if (eventData.data.popupUnselectedColor != null) {
this.popupUnselectedColor = eventData.data.popupUnselectedColor;
}
if (eventData.data.popupItemBackgroundColor != null) {
this.popupItemBackgroundColor = eventData.data.popupItemBackgroundColor;
}
if (eventData.data.popupSelectedColorNum != null) {
this.popupSelectedColorNum = eventData.data.popupSelectedColorNum;
}
if (eventData.data.popupUnselectedColorNum != null) {
this.popupUnselectedColorNum = eventData.data.popupUnselectedColorNum;
}
if (eventData.data.popupItemBackgroundNum != null) {
this.popupItemBackgroundNum = eventData.data.popupItemBackgroundNum;
}
if (eventData.data.popupItemFontSizeNum != null) {
this.popupItemFontSizeNum = eventData.data.popupItemFontSizeNum;
}
if (eventData.data.popupItemFontWeightStr != null) {
this.popupItemFontWeightStr = eventData.data.popupItemFontWeightStr;
}
if (eventData.data.popupSpaceNum != null) {
this.popupSpaceNum = eventData.data.popupSpaceNum;
}
if (eventData.data.popupSelectedColorRes != null) {
this.popupSelectedColorRes = eventData.data.popupSelectedColorRes;
}
if (eventData.data.popupUnselectedColorRes != null) {
this.popupUnselectedColorRes = eventData.data.popupUnselectedColorRes;
}
if (eventData.data.popupItemBackgroundRes != null) {
this.popupItemBackgroundRes = eventData.data.popupItemBackgroundRes;
}
if (eventData.data.popupItemFontSizeRes != null) {
this.popupItemFontSizeRes = eventData.data.popupItemFontSizeRes;
}
if (eventData.data.popupSpaceRes != null) {
this.popupSpaceRes = eventData.data.popupSpaceRes;
}
if (eventData.data.popupItemFontWeightFont != null) {
this.popupItemFontWeightFont = eventData.data.popupItemFontWeightFont;
}
if (eventData.data.nullFlag1 != null) {
this.nullFlag1 = eventData.data.nullFlag1;
}
if (eventData.data.nullFlag2 != null) {
this.nullFlag2 = eventData.data.nullFlag2;
}
if (eventData.data.nullFlag3 != null) {
this.nullFlag3 = eventData.data.nullFlag3;
}
if (eventData.data.nullFlag4 != null) {
this.nullFlag4 = eventData.data.nullFlag4;
}
if (eventData.data.nullFlag5 != null) {
this.nullFlag5 = eventData.data.nullFlag5;
}
}
}
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() {
Row() {
AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.key('alphabetIndexerTest1')
.font({ size: 18, weight: FontWeight.Normal })
.selectedFont({ size: 28, weight: FontWeight.Bold })
.color(0x000000)
.selectedColor(0xFF1493)
.backgroundColor(0xF8F8FF)
.selectedBackgroundColor(0xBEBEBE)
.itemSize(26)
.onSelect((index: number) => {
console.info(this.value[index] + ' Selected!')
})
.usingPopup(true)
.alignStyle(IndexerAlign.Left)
.popupFont({ size: 28, weight: FontWeight.Bold })
.popupColor(0xFFA500)
.popupBackground(0x32CD32)
.onRequestPopupData((index: number) => {
if (this.value[index] == 'A') {
return this.arrayA
} else if (this.value[index] == 'B') {
return this.arrayB
} else if (this.value[index] == 'C') {
return this.arrayC
} else if (this.value[index] == 'L') {
return this.arrayL
} else if (this.value[index] == 'T') {
return this.arrayT
} else {
return []
}
})
.onPopupSelect((index: number) => {
console.info('onPopupSelected label :' + index)
})
.margin({ top: 20 })
AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.key('alphabetIndexerTest2')
.font({ size: 18, weight: FontWeight.Normal })
.selectedFont({ size: 28, weight: FontWeight.Bold })
.color(0x000000)
.selectedColor(0xFF1493)
.backgroundColor(0xF8F8FF)
.selectedBackgroundColor(0xBEBEBE)
.itemSize(26)
.onSelect((index: number) => {
console.info(this.value[index] + ' Selected!')
})
.usingPopup(true)
.popupFont({ size: 28, weight: FontWeight.Bold })
.popupColor(0xFFA500)
.popupBackground(0x32CD32)
.onRequestPopupData((index: number) => {
if (this.value[index] == 'A') {
return this.arrayA
} else if (this.value[index] == 'B') {
return this.arrayB
} else if (this.value[index] == 'C') {
return this.arrayC
} else if (this.value[index] == 'L') {
return this.arrayL
} else if (this.value[index] == 'T') {
return this.arrayT
} else {
return []
}
})
.onPopupSelect((index: number) => {
console.info('onPopupSelected label :' + index)
})
.margin({ top: 20, left: 20 })
.alignStyle(IndexerAlign.Left,this.nullFlag5 ? null : this.popupSpaceNum)
.popupSelectedColor(this.nullFlag1 ? null : this.popupSelectedColorNum)
.popupUnselectedColor(this.nullFlag2 ? null : this.popupUnselectedColorNum)
.popupItemBackgroundColor(this.nullFlag3 ? null : this.popupItemBackgroundNum)
.popupItemFont(this.nullFlag4 ? null : { size: this.popupItemFontSizeNum, weight: this.popupItemFontWeightNum })
AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.key('alphabetIndexerTest3')
.font({ size: 18, weight: FontWeight.Normal })
.selectedFont({ size: 28, weight: FontWeight.Bold })
.color(0x000000)
.selectedColor(0xFF1493)
.backgroundColor(0xF8F8FF)
.selectedBackgroundColor(0xBEBEBE)
.itemSize(26)
.onSelect((index: number) => {
console.info(this.value[index] + ' Selected!')
})
.usingPopup(true)
.popupFont({ size: 28, weight: FontWeight.Bold })
.popupColor(0xFFA500)
.popupBackground(0x32CD32)
.onRequestPopupData((index: number) => {
if (this.value[index] == 'A') {
return this.arrayA
} else if (this.value[index] == 'B') {
return this.arrayB
} else if (this.value[index] == 'C') {
return this.arrayC
} else if (this.value[index] == 'L') {
return this.arrayL
} else if (this.value[index] == 'T') {
return this.arrayT
} else {
return []
}
})
.onPopupSelect((index: number) => {
console.info('onPopupSelected label :' + index)
})
.margin({ top: 20, left: 20 })
.alignStyle(IndexerAlign.Left,this.nullFlag5 ? null : this.popupSpaceStr)
.popupSelectedColor(this.nullFlag1 ? null : this.popupSelectedColorStr)
.popupUnselectedColor(this.nullFlag2 ? null : this.popupUnselectedColorStr)
.popupItemBackgroundColor(this.nullFlag3 ? null : this.popupItemBackgroundStr)
.popupItemFont(this.nullFlag4 ? null : { size: this.popupItemFontSizeStr, weight: this.popupItemFontWeightStr })
AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.key('alphabetIndexerTest4')
.font({ size: 18, weight: FontWeight.Normal })
.selectedFont({ size: 28, weight: FontWeight.Bold })
.color(0x000000)
.selectedColor(0xFF1493)
.backgroundColor(0xF8F8FF)
.selectedBackgroundColor(0xBEBEBE)
.itemSize(26)
.onSelect((index: number) => {
console.info(this.value[index] + ' Selected!')
})
.usingPopup(true)
.popupFont({ size: 28, weight: FontWeight.Bold })
.popupColor(0xFFA500)
.popupBackground(0x32CD32)
.onRequestPopupData((index: number) => {
if (this.value[index] == 'A') {
return this.arrayA
} else if (this.value[index] == 'B') {
return this.arrayB
} else if (this.value[index] == 'C') {
return this.arrayC
} else if (this.value[index] == 'L') {
return this.arrayL
} else if (this.value[index] == 'T') {
return this.arrayT
} else {
return []
}
})
.onPopupSelect((index: number) => {
console.info('onPopupSelected label :' + index)
})
.margin({ top: 20, left: 20 })
.alignStyle(IndexerAlign.Left,this.nullFlag5 ? null : this.popupSpaceRes)
.popupSelectedColor(this.nullFlag1 ? null : this.popupSelectedColorRes)
.popupUnselectedColor(this.nullFlag2 ? null : this.popupUnselectedColorRes)
.popupItemBackgroundColor(this.nullFlag3 ? null : this.popupItemBackgroundRes)
.popupItemFont(this.nullFlag4 ? null : { size: this.popupItemFontSizeRes, weight: this.popupItemFontWeightFont })
AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.key('alphabetIndexerTest5')
.font({ size: 18, weight: FontWeight.Normal })
.selectedFont({ size: 28, weight: FontWeight.Bold })
.color(0x000000)
.selectedColor(0xFF1493)
.backgroundColor(0xF8F8FF)
.selectedBackgroundColor(0xBEBEBE)
.itemSize(26)
.onSelect((index: number) => {
console.info(this.value[index] + ' Selected!')
})
.usingPopup(true)
.popupFont({ size: 28, weight: FontWeight.Bold })
.popupColor(0xFFA500)
.popupBackground(0x32CD32)
.onRequestPopupData((index: number) => {
if (this.value[index] == 'A') {
return this.arrayA
} else if (this.value[index] == 'B') {
return this.arrayB
} else if (this.value[index] == 'C') {
return this.arrayC
} else if (this.value[index] == 'L') {
return this.arrayL
} else if (this.value[index] == 'T') {
return this.arrayT
} else {
return []
}
})
.onPopupSelect((index: number) => {
console.info('onPopupSelected label :' + index)
})
.margin({ top: 20, left: 20 })
.alignStyle(IndexerAlign.Left,this.popupSpaceNum)
.popupSelectedColor(this.popupSelectedColor)
.popupUnselectedColor(this.popupUnselectedColor)
.popupItemBackgroundColor(this.popupItemBackgroundColor)
.popupItemFont({ size: this.popupItemFontSizeNum, weight: this.popupItemFontWeightNum })
AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.key('alphabetIndexerTest6')
.font({ size: 18, weight: FontWeight.Normal })
.selectedFont({ size: 28, weight: FontWeight.Bold })
.color(0x000000)
.selectedColor(0xFF1493)
.backgroundColor(0xF8F8FF)
.selectedBackgroundColor(0xBEBEBE)
.itemSize(26)
.onSelect((index: number) => {
console.info(this.value[index] + ' Selected!')
})
.usingPopup(true)
.alignStyle(IndexerAlign.Left)
.popupFont({ size: 28, weight: FontWeight.Bold })
.popupColor(0xFFA500)
.popupBackground(0x32CD32)
.onRequestPopupData((index: number) => {
if (this.value[index] == 'A') {
return this.arrayA
} else if (this.value[index] == 'B') {
return this.arrayB
} else if (this.value[index] == 'C') {
return this.arrayC
} else if (this.value[index] == 'L') {
return this.arrayL
} else if (this.value[index] == 'T') {
return this.arrayT
} else {
return []
}
})
.onPopupSelect((index: number) => {
console.info('onPopupSelected label :' + index)
})
.margin({ top: 20, left: 20 })
.popupItemFont({ size: this.popupItemFontSizeNum })
AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.key('alphabetIndexerTest7')
.font({ size: 18, weight: FontWeight.Normal })
.selectedFont({ size: 28, weight: FontWeight.Bold })
.color(0x000000)
.selectedColor(0xFF1493)
.backgroundColor(0xF8F8FF)
.selectedBackgroundColor(0xBEBEBE)
.itemSize(26)
.onSelect((index: number) => {
console.info(this.value[index] + ' Selected!')
})
.usingPopup(true)
.alignStyle(IndexerAlign.Left)
.popupFont({ size: 28, weight: FontWeight.Bold })
.popupColor(0xFFA500)
.popupBackground(0x32CD32)
.onRequestPopupData((index: number) => {
if (this.value[index] == 'A') {
return this.arrayA
} else if (this.value[index] == 'B') {
return this.arrayB
} else if (this.value[index] == 'C') {
return this.arrayC
} else if (this.value[index] == 'L') {
return this.arrayL
} else if (this.value[index] == 'T') {
return this.arrayT
} else {
return []
}
})
.onPopupSelect((index: number) => {
console.info('onPopupSelected label :' + index)
})
.margin({ top: 20, left: 20 })
.popupItemFont({ weight: this.popupItemFontWeightNum })
}.backgroundColor(0x00FFFF).width('100%').height('100%')
}
}
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
576afcfd
/*
* 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
<
void
>
{
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
'
);
}
}
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/test/AlphabetIndexer.ets
0 → 100644
浏览文件 @
576afcfd
此差异已折叠。
点击以展开。
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
576afcfd
/*
* 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 alphabetIndexer from './AlphabetIndexer'
export default function testsuite() {
alphabetIndexer()
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/ets/test/Utils.ets
0 → 100644
浏览文件 @
576afcfd
/*
* 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 { expect } from "@ohos/hypium";
export default class Utils {
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve("ok")
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
static registerEvent(testCaseName, expectedValue, eventId, done) {
console.info(`[${testCaseName}] START`);
try {
let callBack = (backData) => {
console.info(`${testCaseName} get result is:` + JSON.stringify(backData));
expect(backData.data.ACTION).assertEqual(expectedValue);
console.info(`[${testCaseName}] END`);
done()
}
let innerEvent = {
eventId: eventId,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(innerEvent, callBack)
} catch (err) {
console.info(`[${testCaseName}] err:` + JSON.stringify(err));
}
}
static emitEvent(actualValue, eventId) {
try {
let backData = {
data: {
"ACTION": actualValue
}
}
let backEvent = {
eventId: eventId,
priority: events_emitter.EventPriority.LOW
}
console.info("webFlag start to emit action state");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("webFlag emit action state err: " + JSON.stringify(err));
}
}
static registerEventTwo(testCaseName, eventId, done) {
console.info(`[${testCaseName}] START`);
try {
let callBack = (backData) => {
console.info(`${testCaseName} get result is:` + JSON.stringify(backData));
expect(backData.data.actualValue).assertLarger(backData.data.expectedValue - 100);
expect(backData.data.actualValue).assertLess(backData.data.expectedValue - (-100));
console.info(`[${testCaseName}] END`);
done()
}
let innerEvent = {
eventId: eventId,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(innerEvent, callBack)
} catch (err) {
console.info(`[${testCaseName}] err:` + JSON.stringify(err));
}
}
static emitEventTwo(expectedValue, actualValue, eventId) {
try {
let backData = {
data: {
"expectedValue": expectedValue,
"actualValue": actualValue
}
}
let backEvent = {
eventId: eventId,
priority: events_emitter.EventPriority.LOW
}
console.info("webFlag start to emit action state");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("webFlag emit action state err: " + JSON.stringify(err));
}
}
static registerContainEvent(testCaseName, expectedValue, eventId, done) {
console.info(`[${testCaseName}] START`);
try {
let callBack = (backData) => {
console.info(`${testCaseName} get result is:` + JSON.stringify(backData));
expect(backData.data.ACTION).assertContain(expectedValue);
console.info(`[${testCaseName}] END`);
done()
}
let innerEvent = {
eventId: eventId,
priority: events_emitter.EventPriority.LOW
}
events_emitter.on(innerEvent, callBack)
} catch (err) {
console.info(`[${testCaseName}] err:` + JSON.stringify(err));
}
}
static commitKey(emitKey) {
try {
let backData = {
data: {
"ACTION": emitKey
}
}
let backEvent = {
eventId: 10,
priority: events_emitter.EventPriority.LOW
}
console.info("start send emitKey");
events_emitter.emit(backEvent, backData);
} catch (err) {
console.info("emit emitKey err: " + JSON.stringify(err));
}
}
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/module.json
0 → 100644
浏览文件 @
576afcfd
{
"module"
:
{
"name"
:
"phone"
,
"type"
:
"feature"
,
"description"
:
"$string:module_test_desc"
,
"mainElement"
:
"TestAbility"
,
"deviceTypes"
:
[
"default"
,
"tablet"
],
"deliveryWithInstall"
:
true
,
"installationFree"
:
false
,
"pages"
:
"$profile:test_pages"
,
"metadata"
:
[{
"name"
:
"ArkTSPartialUpdate"
,
"value"
:
"true"
}],
"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"
]
}
]
}
]
}
}
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/resources/base/element/color.json
0 → 100644
浏览文件 @
576afcfd
{
"color"
:
[
{
"name"
:
"start_window_background"
,
"value"
:
"#FFFFFF"
},
{
"name"
:
"Divider_color"
,
"value"
:
"#000000"
},
{
"name"
:
"popupSelectedColor"
,
"value"
:
"#00C5CD"
},
{
"name"
:
"popupUnselectedColor"
,
"value"
:
"#FFEC8B"
},
{
"name"
:
"popupItemBackground"
,
"value"
:
"#4EEE94"
}
]
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
576afcfd
{
"string"
:
[
{
"name"
:
"module_test_desc"
,
"value"
:
"test ability description"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"the test ability"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"test label"
},
{
"name"
:
"popupSelectedColor"
,
"value"
:
"#00C5CD"
},
{
"name"
:
"popupUnselectedColor"
,
"value"
:
"#4EEE94"
},
{
"name"
:
"popupItemBackground"
,
"value"
:
"#FFEC8B"
},
{
"name"
:
"fontSize"
,
"value"
:
"25px"
},
{
"name"
:
"popupSpace"
,
"value"
:
"10"
}
]
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
576afcfd
6.6 KB
arkui/ace_ets_components_ux/ace_ets_component_indexer/src/main/resources/base/profile/test_pages.json
0 → 100644
浏览文件 @
576afcfd
{
"src"
:
[
"TestAbility/pages/Index"
]
}
arkui/ace_ets_components_ux/ace_ets_component_text/src/main/ets/TestAbility/pages/Index.ets
浏览文件 @
576afcfd
...
@@ -280,6 +280,7 @@ struct textTest {
...
@@ -280,6 +280,7 @@ struct textTest {
.height(20)
.height(20)
.maxLines(1)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Clip })
.textOverflow({ overflow: TextOverflow.Clip })
.textAlign(TextAlign.JUSTIFY)
.fontSize(15)
.fontSize(15)
}
}
...
@@ -294,6 +295,7 @@ struct textTest {
...
@@ -294,6 +295,7 @@ struct textTest {
.key('ArkUX_Stage_Text_TextAlign_0200')
.key('ArkUX_Stage_Text_TextAlign_0200')
.height(20)
.height(20)
.textAlign(TextAlign.Start)
.textAlign(TextAlign.Start)
.textOverflow({ overflow: TextOverflow.MARQUEE })
}
}
ListItem() {
ListItem() {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录