Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b0dc057d
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
接近 2 年 前同步成功
通知
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看板
提交
b0dc057d
编写于
3月 17, 2023
作者:
C
chensi10
浏览文件
操作
浏览文件
下载
差异文件
Merge branch master of
https://gitee.com/openharmony/xts_acts
Signed-off-by:
N
chensi10
<
chensi52@huawei.com
>
上级
a56dd44f
9b4d5d28
变更
72
显示空白变更内容
内联
并排
Showing
72 changed file
with
6690 addition
and
1063 deletion
+6690
-1063
applications/kitframework/BUILD.gn
applications/kitframework/BUILD.gn
+0
-3
applications/kitframework_ipcamera/BUILD.gn
applications/kitframework_ipcamera/BUILD.gn
+0
-3
arkui/ace_ets_components_ux/BUILD.gn
arkui/ace_ets_components_ux/BUILD.gn
+1
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/AppScope/app.json
...ts_components_ux/ace_ets_component_tabs/AppScope/app.json
+19
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/AppScope/resources/base/element/string.json
...omponent_tabs/AppScope/resources/base/element/string.json
+8
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/AppScope/resources/base/media/app_icon.png
...component_tabs/AppScope/resources/base/media/app_icon.png
+0
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/BUILD.gn
arkui/ace_ets_components_ux/ace_ets_component_tabs/BUILD.gn
+43
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/Test.json
arkui/ace_ets_components_ux/ace_ets_component_tabs/Test.json
+26
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/signature/openharmony_sx.p7b
...ts_ux/ace_ets_component_tabs/signature/openharmony_sx.p7b
+0
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/TestAbility/TestAbility.ets
...s_component_tabs/src/main/ets/TestAbility/TestAbility.ets
+63
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/TestAbility/pages/Index.ets
...s_component_tabs/src/main/ets/TestAbility/pages/Index.ets
+358
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
...ent_tabs/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
+85
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/test/List.test.ets
...ux/ace_ets_component_tabs/src/main/ets/test/List.test.ets
+19
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/test/Tabs.ets
...ents_ux/ace_ets_component_tabs/src/main/ets/test/Tabs.ets
+510
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/test/Utils.ets
...nts_ux/ace_ets_component_tabs/src/main/ets/test/Utils.ets
+26
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/module.json
...components_ux/ace_ets_component_tabs/src/main/module.json
+41
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/resources/base/element/color.json
...component_tabs/src/main/resources/base/element/color.json
+16
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/resources/base/element/string.json
...omponent_tabs/src/main/resources/base/element/string.json
+48
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/resources/base/media/icon.png
...ets_component_tabs/src/main/resources/base/media/icon.png
+0
-0
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/resources/base/profile/test_pages.json
...nent_tabs/src/main/resources/base/profile/test_pages.json
+5
-0
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js
...ributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js
+1
-1
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/relationalStoreEtsunit.test.ets
...t/entry/src/main/ets/test/relationalStoreEtsunit.test.ets
+238
-245
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
+1
-1
multimedia/media/media_js_standard/AVPlayerTestBase.js
multimedia/media/media_js_standard/AVPlayerTestBase.js
+1655
-29
multimedia/media/media_js_standard/avPlayer/Test.json
multimedia/media/media_js_standard/avPlayer/Test.json
+52
-6
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/MainAbility/MainAbility.ts
...rd/avPlayer/entry/src/main/ets/MainAbility/MainAbility.ts
+1
-0
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerStabilityTest.test.js
...yer/entry/src/main/ets/test/AVPlayerStabilityTest.test.js
+1167
-38
time/timeTest/entry/src/main/ets/test/List.test.ets
time/timeTest/entry/src/main/ets/test/List.test.ets
+2
-0
time/timeTest/entry/src/main/ets/test/systemTimeCommonEvent.test.ets
...st/entry/src/main/ets/test/systemTimeCommonEvent.test.ets
+162
-0
validator/acts_validator/src/main/ets/pages/ArkUI/ArkUI_index.ets
...r/acts_validator/src/main/ets/pages/ArkUI/ArkUI_index.ets
+8
-9
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasFillStyle.ets
...ts_validator/src/main/ets/pages/ArkUI/CanvasFillStyle.ets
+15
-3
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasFont.ets
...or/acts_validator/src/main/ets/pages/ArkUI/CanvasFont.ets
+220
-44
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasGlobalAlpha.ets
..._validator/src/main/ets/pages/ArkUI/CanvasGlobalAlpha.ets
+5
-2
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasGlobalCompositeOperation.ets
...c/main/ets/pages/ArkUI/CanvasGlobalCompositeOperation.ets
+77
-11
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineCap.ets
...acts_validator/src/main/ets/pages/ArkUI/CanvasLineCap.ets
+15
-3
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineDashOffset.ets
...lidator/src/main/ets/pages/ArkUI/CanvasLineDashOffset.ets
+4
-2
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineJoin.ets
...cts_validator/src/main/ets/pages/ArkUI/CanvasLineJoin.ets
+15
-3
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineWidth.ets
...ts_validator/src/main/ets/pages/ArkUI/CanvasLineWidth.ets
+5
-2
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasMiterLimit.ets
...s_validator/src/main/ets/pages/ArkUI/CanvasMiterLimit.ets
+0
-82
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowBlur.ets
...s_validator/src/main/ets/pages/ArkUI/CanvasShadowBlur.ets
+5
-3
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowColor.ets
..._validator/src/main/ets/pages/ArkUI/CanvasShadowColor.ets
+15
-3
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowOffsetX.ets
...alidator/src/main/ets/pages/ArkUI/CanvasShadowOffsetX.ets
+5
-2
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowOffsetY.ets
...alidator/src/main/ets/pages/ArkUI/CanvasShadowOffsetY.ets
+4
-2
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasStrokeStyle.ets
..._validator/src/main/ets/pages/ArkUI/CanvasStrokeStyle.ets
+15
-3
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasTextAlign.ets
...ts_validator/src/main/ets/pages/ArkUI/CanvasTextAlign.ets
+30
-10
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasTextBaseline.ets
...validator/src/main/ets/pages/ArkUI/CanvasTextBaseline.ets
+30
-10
validator/acts_validator/src/main/ets/pages/Audio/Audio_index.ets
...r/acts_validator/src/main/ets/pages/Audio/Audio_index.ets
+7
-8
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation0.ets
...alidator/src/main/ets/pages/Camera/CameraOrientation0.ets
+0
-97
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation180.ets
...idator/src/main/ets/pages/Camera/CameraOrientation180.ets
+0
-96
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation270.ets
...idator/src/main/ets/pages/Camera/CameraOrientation270.ets
+0
-96
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation90.ets
...lidator/src/main/ets/pages/Camera/CameraOrientation90.ets
+0
-96
validator/acts_validator/src/main/ets/pages/Camera/Camera_index.ets
...acts_validator/src/main/ets/pages/Camera/Camera_index.ets
+10
-14
validator/acts_validator/src/main/ets/pages/Experience/ColdStartTest.ets
...validator/src/main/ets/pages/Experience/ColdStartTest.ets
+193
-0
validator/acts_validator/src/main/ets/pages/Experience/DeskFps.ets
.../acts_validator/src/main/ets/pages/Experience/DeskFps.ets
+20
-5
validator/acts_validator/src/main/ets/pages/Experience/Experience_index.ets
...idator/src/main/ets/pages/Experience/Experience_index.ets
+16
-8
validator/acts_validator/src/main/ets/pages/Experience/HotStartTest.ets
..._validator/src/main/ets/pages/Experience/HotStartTest.ets
+179
-0
validator/acts_validator/src/main/ets/pages/Experience/KeyboardDisplayTest.ets
...tor/src/main/ets/pages/Experience/KeyboardDisplayTest.ets
+120
-0
validator/acts_validator/src/main/ets/pages/Experience/KeyboardInputTest.ets
...dator/src/main/ets/pages/Experience/KeyboardInputTest.ets
+120
-0
validator/acts_validator/src/main/ets/pages/Experience/PhotoFps.ets
...acts_validator/src/main/ets/pages/Experience/PhotoFps.ets
+20
-7
validator/acts_validator/src/main/ets/pages/Experience/ScrollListTest.ets
...alidator/src/main/ets/pages/Experience/ScrollListTest.ets
+0
-52
validator/acts_validator/src/main/ets/pages/Experience/ScrollPhotosList.ets
...idator/src/main/ets/pages/Experience/ScrollPhotosList.ets
+120
-0
validator/acts_validator/src/main/ets/pages/Experience/StartBackgroundTask.ets
...tor/src/main/ets/pages/Experience/StartBackgroundTask.ets
+118
-0
validator/acts_validator/src/main/ets/pages/Experience/StartNotification.ets
...dator/src/main/ets/pages/Experience/StartNotification.ets
+118
-0
validator/acts_validator/src/main/ets/pages/Experience/StartTaskManager.ets
...idator/src/main/ets/pages/Experience/StartTaskManager.ets
+118
-0
validator/acts_validator/src/main/ets/pages/Experience/ViewPhotoTest.ets
...validator/src/main/ets/pages/Experience/ViewPhotoTest.ets
+120
-0
validator/acts_validator/src/main/ets/pages/Player/Player_index.ets
...acts_validator/src/main/ets/pages/Player/Player_index.ets
+7
-8
validator/acts_validator/src/main/ets/pages/common/CameraOrientation.ets
...validator/src/main/ets/pages/common/CameraOrientation.ets
+1
-1
validator/acts_validator/src/main/ets/pages/common/ExperienceCustomContainer.ets
...r/src/main/ets/pages/common/ExperienceCustomContainer.ets
+1
-1
validator/acts_validator/src/main/ets/pages/common/StartExperienceCustomContainer.ets
.../main/ets/pages/common/StartExperienceCustomContainer.ets
+170
-0
validator/acts_validator/src/main/ets/pages/common/TimeExperienceCustomContainer.ets
...c/main/ets/pages/common/TimeExperienceCustomContainer.ets
+165
-0
validator/acts_validator/src/main/ets/pages/index.ets
validator/acts_validator/src/main/ets/pages/index.ets
+42
-48
validator/acts_validator/src/main/resources/base/profile/main_pages.json
...validator/src/main/resources/base/profile/main_pages.json
+10
-6
未找到文件。
applications/kitframework/BUILD.gn
浏览文件 @
b0dc057d
...
...
@@ -31,7 +31,4 @@ hctest_suite("ActsKitFwkApiTest") {
# dir for oem_auth_config.h and oem_auth_result_storage.h
"//vendor/kitframework/include/",
]
# un-comment this Macro for token-persist-test
# defines = [ "TOKEN_PERSIST_TEST" ]
}
applications/kitframework_ipcamera/BUILD.gn
浏览文件 @
b0dc057d
...
...
@@ -43,7 +43,4 @@ executable("ActsKitFwkApiTest") {
]
output_extension = "bin"
# un-comment this Macro for token-persist-test
# defines = [ "TOKEN_PERSIST_TEST" ]
}
arkui/ace_ets_components_ux/BUILD.gn
浏览文件 @
b0dc057d
...
...
@@ -18,6 +18,7 @@ group("componentUxTest") {
"ace_ets_component_select:ActsAceSelectTest",
"ace_ets_component_sidebar:ActsAceSideBarTest",
"ace_ets_component_swiper:ActsAceSwiperTest",
"ace_ets_component_tabs:ActsAceTabsTest",
]
}
}
arkui/ace_ets_components_ux/ace_ets_component_tabs/AppScope/app.json
0 → 100644
浏览文件 @
b0dc057d
{
"app"
:
{
"bundleName"
:
"com.example.acetabstest"
,
"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_tabs/AppScope/resources/base/element/string.json
0 → 100644
浏览文件 @
b0dc057d
{
"string"
:[
{
"name"
:
"app_name"
,
"value"
:
"MyApplication"
}
]
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_tabs/AppScope/resources/base/media/app_icon.png
0 → 100644
浏览文件 @
b0dc057d
6.6 KB
arkui/ace_ets_components_ux/ace_ets_component_tabs/BUILD.gn
0 → 100644
浏览文件 @
b0dc057d
# 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("ActsAceTabsTest") {
hap_profile = "src/main/module.json"
js_build_mode = "debug"
deps = [
":ace_ets_component_tabs_js_assets",
":ace_ets_component_tabs_resources",
]
ets2abc = true
certificate_profile = "signature/openharmony_sx.p7b"
hap_name = "ActsAceTabsTest"
part_name = "ace_engine"
subsystem_name = "arkui"
}
ohos_app_scope("ace_ets_component_tabs_profile") {
app_profile = "AppScope/app.json"
sources = [ "AppScope/resources" ]
}
ohos_js_assets("ace_ets_component_tabs_js_assets") {
source_dir = "src/main/ets"
}
ohos_resources("ace_ets_component_tabs_resources") {
sources = [ "src/main/resources" ]
deps = [ ":ace_ets_component_tabs_profile" ]
hap_profile = "src/main/module.json"
}
arkui/ace_ets_components_ux/ace_ets_component_tabs/Test.json
0 → 100644
浏览文件 @
b0dc057d
{
"description"
:
"Configuration for hjunit demo Tests"
,
"driver"
:
{
"type"
:
"OHJSUnitTest"
,
"test-timeout"
:
"600000"
,
"bundle-name"
:
"com.example.acetabstest"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"600000"
,
"testcase-timeout"
:
240000
},
"kits"
:
[{
"test-file-name"
:
[
"ActsAceTabsTest.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_tabs/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
b0dc057d
文件已添加
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/TestAbility/TestAbility.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* 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');
}
}
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/TestAbility/pages/Index.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* 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 TabsExample {
private controller: TabsController = new TabsController()
private controller2: TabsController = new TabsController()
private controller3: TabsController = new TabsController()
private controller4: TabsController = new TabsController()
@State strokeWidthStr: string = '10px'
@State dividerColorStr: string = 'red'
@State startMarginStr: string = '5px'
@State endMarginStr: string = '5px'
@State nullFlag: boolean = false
@State strokeWidthNum: number = 10
@State dividerColorNum: number = 0xFFFF0000
@State startMarginNum: number = 5
@State endMarginNum: number = 5
@State strokeWidthRes: Resource = $r("app.string.Divider_Stroke_Width")
@State dividerColorRes: Resource = $r("app.color.Divider_Color")
@State startMarginRes: Resource = $r("app.string.Divider_Start_Margin")
@State endMarginRes: Resource = $r("app.string.Divider_End_Margin")
@State dividerColor: Color = Color.Red
@State overflowFlag: boolean = false
@State selfIndicatorColor: Color = Color.Red
@State selfIndicatorHeight: number = 10
@State selfIndicatorWidth: number = 30
@State selfIndicatorBorderRadius: number = 5
@State selfSubTabBorderRadius: number = 20
@State selfMarginTop: number = 10
@State selfIndicatorColorStr: string = "#FFFF0000"
@State selfIndicatorHeightStr: string = "10vp"
@State selfIndicatorWidthStr: string = "30vp"
@State selfIndicatorBorderRadiusStr: string = "5vp"
@State selfSubTabBorderRadiusStr: string = "20vp"
@State selfMarginTopStr: string = "10vp"
@State selfSelectedMode: SelectedMode = SelectedMode.INDICATOR
private stateChangCallBack = (eventData) => {
console.info("tabs page state change called:" + JSON.stringify(eventData));
if (eventData != null) {
if (eventData.data.dividerColorStr != null) {
this.dividerColorStr = eventData.data.dividerColorStr;
}
if (eventData.data.strokeWidthStr != null) {
this.strokeWidthStr = eventData.data.strokeWidthStr;
}
if (eventData.data.startMarginStr != null) {
this.startMarginStr = eventData.data.startMarginStr;
}
if (eventData.data.endMarginStr != null) {
this.endMarginStr = eventData.data.endMarginStr;
}
if (eventData.data.nullFlag != null) {
this.nullFlag = eventData.data.nullFlag;
}
if (eventData.data.dividerColor != null) {
this.dividerColor = eventData.data.dividerColor;
}
if (eventData.data.strokeWidthNum != null) {
this.strokeWidthNum = eventData.data.strokeWidthNum;
}
if (eventData.data.startMarginNum != null) {
this.startMarginNum = eventData.data.startMarginNum;
}
if (eventData.data.endMarginNum != null) {
this.endMarginNum = eventData.data.endMarginNum;
}
if (eventData.data.dividerColorRes != null) {
this.dividerColorRes = eventData.data.dividerColorRes;
}
if (eventData.data.strokeWidthRes != null) {
this.strokeWidthRes = eventData.data.strokeWidthRes;
}
if (eventData.data.startMarginRes != null) {
this.startMarginRes = eventData.data.startMarginRes;
}
if (eventData.data.endMarginRes != null) {
this.endMarginRes = eventData.data.endMarginRes;
}
if (eventData.data.overflowFlag != null) {
this.overflowFlag = eventData.data.overflowFlag;
}
if (eventData.data.selfIndicatorColor != null) {
this.selfIndicatorColor = eventData.data.selfIndicatorColor;
}
if (eventData.data.selfIndicatorHeight != null) {
this.selfIndicatorHeight = eventData.data.selfIndicatorHeight;
}
if (eventData.data.selfIndicatorWidth != null) {
this.selfIndicatorWidth = eventData.data.selfIndicatorWidth;
}
if (eventData.data.selfIndicatorBorderRadius != null) {
this.selfIndicatorBorderRadius = eventData.data.selfIndicatorBorderRadius;
}
if (eventData.data.selfSelectedMode != null) {
this.selfSelectedMode = eventData.data.selfSelectedMode;
}
if (eventData.data.selfSubTabBorderRadius != null) {
this.selfSubTabBorderRadius = eventData.data.selfSubTabBorderRadius;
}
if (eventData.data.selfMarginTop != null) {
this.selfMarginTop = eventData.data.selfMarginTop;
}
if (eventData.data.selfIndicatorColorStr != null) {
this.selfIndicatorColorStr = eventData.data.selfIndicatorColorStr;
}
if (eventData.data.selfIndicatorHeightStr != null) {
this.selfIndicatorHeightStr = eventData.data.selfIndicatorHeightStr;
}
if (eventData.data.selfIndicatorWidthStr != null) {
this.selfIndicatorWidthStr = eventData.data.selfIndicatorWidthStr;
}
if (eventData.data.selfIndicatorBorderRadiusStr != null) {
this.selfIndicatorBorderRadiusStr = eventData.data.selfIndicatorBorderRadiusStr;
}
if (eventData.data.selfSubTabBorderRadiusStr != null) {
this.selfSubTabBorderRadiusStr = eventData.data.selfSubTabBorderRadiusStr;
}
if (eventData.data.selfMarginTopStr != null) {
this.selfMarginTopStr = eventData.data.selfMarginTopStr;
}
}
}
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() {
Tabs({ barPosition: BarPosition.Start, controller: this.controller }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Pink)
}.tabBar(SubTabBarStyle.of('pink').indicator({
color: this.selfIndicatorColor,
height: this.selfIndicatorHeight,
width: this.selfIndicatorWidth,
borderRadius: this.selfIndicatorBorderRadius,
marginTop: this.selfMarginTop
}).selectedMode(this.selfSelectedMode)
.board({ borderRadius: this.selfSubTabBorderRadius })
.labelStyle({ overflow: TextOverflow.Ellipsis, maxLines: 1, minFontSize: 5, heightAdaptivePolicy: TextHeightAdaptivePolicy.MIN_FONT_SIZE_FIRST,
font: { size: 15 } }))
.key('indicatorTest1')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Blue)
}.tabBar(SubTabBarStyle.of('pink').indicator({
color: this.selfIndicatorColorStr,
height: this.selfIndicatorHeightStr,
width: this.selfIndicatorWidthStr,
borderRadius: this.selfIndicatorBorderRadiusStr,
marginTop: this.selfMarginTopStr
}).selectedMode(this.selfSelectedMode)
.board({ borderRadius: this.selfSubTabBorderRadiusStr })
.labelStyle({ overflow: TextOverflow.Clip, maxLines: 1, minFontSize: 5, maxFontSize: 20, heightAdaptivePolicy: TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST,
font: { size: 15} }))
.key('indicatorTest2')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Green)
}
.tabBar(SubTabBarStyle.of('pink')
.indicator({
color: $r("app.color.Indicator_Color"),
height: $r("app.string.Indicator_Height"),
width: $r("app.string.Indicator_Width"),
borderRadius: $r("app.string.Indicator_Radius"),
marginTop: $r("app.string.Indicator_Space")
})
.selectedMode(this.selfSelectedMode)
.board({ borderRadius: $r("app.string.Indicator_Sub_Radius") })
.labelStyle({ overflow: TextOverflow.None, maxLines: 2, minFontSize: 5, maxFontSize: 20, heightAdaptivePolicy: TextHeightAdaptivePolicy.LAYOUT_CONSTRAINT_FIRST,
font: { size: 15 } }))
.key('indicatorTest3')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Yellow)
}.tabBar(SubTabBarStyle.of('pink')
.indicator({
color: 0xFFFF0000, //下划线颜色
})
.selectedMode(this.selfSelectedMode)
.board({ borderRadius: this.selfSubTabBorderRadius })
.labelStyle({ overflow: TextOverflow.None, maxLines: 10, minFontSize: 5, maxFontSize: 20, heightAdaptivePolicy: TextHeightAdaptivePolicy.MAX_LINES_FIRST,
font: { size: 15 } }))
.key('indicatorTest4')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Yellow)
}.tabBar(SubTabBarStyle.of('pink'))
.key('indicatorTest5')
}
.vertical(true).scrollable(true).barMode(BarMode.Fixed)
.barWidth(70).barHeight('100%').animationDuration(400)
.onChange((index: number) => {
console.info(index.toString())
})
.height('200vp')
.width('90%')
.divider(this.nullFlag ? null : { strokeWidth: this.strokeWidthStr,
color: this.dividerColorStr,
startMargin: this.startMarginStr,
endMargin: this.endMarginStr
})
.fadingEdge(this.overflowFlag)
.key('tabsTest')
Tabs({ barPosition: BarPosition.Start, controller: this.controller2 }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Pink)
}.tabBar('pink')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Yellow)
}.tabBar('yellow')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Blue)
}.tabBar('blue')
}
.vertical(true).scrollable(true).barMode(BarMode.Fixed)
.barWidth(70).barHeight('100%').animationDuration(400)
.onChange((index: number) => {
console.info(index.toString())
})
.height('200vp')
.width('90%')
.divider({ strokeWidth: this.strokeWidthNum,
color: this.dividerColorNum,
startMargin: this.startMarginNum,
endMargin: this.endMarginNum
})
.key('tabsTest2')
Tabs({ barPosition: BarPosition.Start, controller: this.controller3 }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Pink)
}.tabBar('pink')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Yellow)
}.tabBar('yellow')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Blue)
}.tabBar('blue')
}
.vertical(true).scrollable(true).barMode(BarMode.Fixed)
.barWidth(70).barHeight('100%').animationDuration(400)
.onChange((index: number) => {
console.info(index.toString())
})
.height('200vp')
.width('90%')
.divider({ strokeWidth: this.strokeWidthRes,
color: this.dividerColorRes,
startMargin: this.startMarginRes,
endMargin: this.endMarginRes
})
.key('tabsTest3')
Tabs({ barPosition: BarPosition.Start, controller: this.controller4 }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Pink)
}.tabBar('pink')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Yellow)
}.tabBar('yellow')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Blue)
}.tabBar('blue')
}
.vertical(true).scrollable(true).barMode(BarMode.Fixed)
.barWidth(70).barHeight('100%').animationDuration(400)
.onChange((index: number) => {
console.info(index.toString())
})
.height('200vp')
.width('90%')
.divider({ strokeWidth: this.strokeWidthStr,
color: this.dividerColor,
startMargin: this.startMarginStr,
endMargin: this.endMarginStr
})
.key('tabsTest4')
Tabs({ barPosition: BarPosition.Start, controller: this.controller4 }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Pink)
}.tabBar('pink')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Yellow)
}.tabBar('yellow')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Blue)
}.tabBar('blue')
}
.vertical(true).scrollable(true).barMode(BarMode.Fixed)
.barWidth(70).barHeight('100%').animationDuration(400)
.onChange((index: number) => {
console.info(index.toString())
})
.height('200vp')
.width('90%')
.key('tabsTest5')
}
}
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts
0 → 100644
浏览文件 @
b0dc057d
/*
* 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
:
any
)
{
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
()
var
testAbilityName
=
abilityDelegatorArguments
.
bundleName
+
'
.TestAbility
'
let
lMonitor
=
{
abilityName
:
testAbilityName
,
onAbilityCreate
:
onAbilityCreateCallback
,
};
abilityDelegator
.
addAbilityMonitor
(
lMonitor
,
addAbilityMonitorCallback
)
var
cmd
=
'
aa start -d 0 -a TestAbility
'
+
'
-b
'
+
abilityDelegatorArguments
.
bundleName
cmd
+=
'
'
+
translateParamsToString
(
abilityDelegatorArguments
.
parameters
)
var
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
:
any
,
d
:
any
)
=>
{
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
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/test/List.test.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* 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 tabs from './Tabs'
export default function testsuite() {
tabs()
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/test/Tabs.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* 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.
*/
// @ts-nocheck
import { describe, beforeEach, afterEach, it, expect } from '@ohos/hypium'
import events_emitter from '@ohos.events.emitter';
import Utils from './Utils.ets';
export default function tabs() {
describe('ActsAceTabsTest', function () {
beforeEach(async function (done) {
await Utils.sleep(2000);
console.info("tabs beforeEach start");
done();
})
afterEach(async function (done) {
console.info("tabs afterEach start");
try {
var eventData = {
data: {
"strokeWidthStr": '10px',
"dividerColorStr": 'red',
"startMarginStr": '5px',
"endMarginStr": '5px',
"nullFlag": false,
"strokeWidthNum": 10,
"dividerColorNum": 0xFFFF0000,
"startMarginNum": 5,
"endMarginNum": 5,
"dividerColor": Color.Red,
"strokeWidthRes": $r("app.string.Divider_Stroke_Width"),
"dividerColorRes": $r("app.color.Divider_Color"),
"startMarginRes": $r("app.string.Divider_Start_Margin"),
"endMarginRes": $r("app.string.Divider_End_Margin"),
"overflowFlag": false,
"selfIndicatorColor": Color.Red,
"selfIndicatorHeight": 10,
"selfIndicatorWidth": 30,
"selfIndicatorBorderRadius": 5,
"selfMarginTop": 10,
"selfSubTabBorderRadius": 20,
"selfSelectedMode": SelectedMode.INDICATOR,
"selfIndicatorColorStr": "#FFFF0000",
"selfIndicatorHeightStr": "10vp",
"selfIndicatorWidthStr": "30vp",
"selfIndicatorBorderRadiusStr": "5vp",
"selfSubTabBorderRadiusStr": "20vp",
"selfMarginTopStr": "10vp",
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_0100] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_0100] change component data error: " + err.message);
}
await Utils.sleep(2000);
done();
})
/**
* @tc.number ArkUI_Tabs_Divider_0100
* @tc.name Tests the divier property of the tabs component
* @tc.desc the default divier parameter is {}
*/
it('ArkUI_Tabs_Divider_0100', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_0100 start");
let strJson = getInspectorByKey('tabsTest5');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_0100] divider:" + obj.$attrs.divider);
if(!obj.$attrs.divider.strokeWidth) {
expect(true).assertTrue();
} else {
expect(true).assertFalse();
}
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_0200
* @tc.name Tests the divier property of the tabs component
* @tc.desc set divier parameter to type number
*/
it('ArkUI_Tabs_Divider_0200', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_0200 start");
let strJson = getInspectorByKey('tabsTest');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_0200] divider:" + JSON.stringify(obj.$attrs.divider));
let dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual("10.00px");
expect(dividerObject.color).assertEqual("#FFFF0000");
expect(dividerObject.startMargin).assertEqual("5.00px");
expect(dividerObject.endMargin).assertEqual("5.00px");
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_0300
* @tc.name Tests the divier property of the tabs component
* @tc.desc set divier parameter to type string
*/
it('ArkUI_Tabs_Divider_0300', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_0300 start");
let strJson = getInspectorByKey('tabsTest2');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_0300] divider:" + JSON.stringify(obj.$attrs.divider));
let dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual("10.00vp");
expect(dividerObject.color).assertEqual('#FFFF0000');
expect(dividerObject.startMargin).assertEqual("5.00vp");
expect(dividerObject.endMargin).assertEqual("5.00vp");
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_0400
* @tc.name Tests the divier property of the tabs component
* @tc.desc set divier parameter to type Resource
*/
it('ArkUI_Tabs_Divider_0400', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_0400 start");
await Utils.sleep(2000);
let strJson = getInspectorByKey('tabsTest3');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_0400] divider:" + JSON.stringify(obj.$attrs.divider));
let dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual("10.00px");
expect(dividerObject.color).assertEqual('#FF121212');
expect(dividerObject.startMargin).assertEqual("5.00px");
expect(dividerObject.endMargin).assertEqual("5.00px");
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_0500
* @tc.name Tests the divier property of the tabs component
* @tc.desc set divier parameter to type Color
*/
it('ArkUI_Tabs_Divider_0500', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_0500 start");
await Utils.sleep(2000);
let strJson = getInspectorByKey('tabsTest4');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_0500] divider:" + JSON.stringify(obj.$attrs.divider));
let dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual("10.00px");
expect(dividerObject.color).assertEqual("#FFFF0000");
expect(dividerObject.startMargin).assertEqual("5.00px");
expect(dividerObject.endMargin).assertEqual("5.00px");
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_0600
* @tc.name Tests the divier property of the tabs component
* @tc.desc set divier parameter to null
*/
it('ArkUI_Tabs_Divider_0600', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_0600 start");
try {
var eventData = {
data: {
"nullFlag": true,
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_0600] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_0600] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('tabsTest');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_0600] divider:" + JSON.stringify(obj.$attrs.divider));
let dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual("0.00px");
expect(dividerObject.color).assertEqual('#33182431');
expect(dividerObject.startMargin).assertEqual('0.00px');
expect(dividerObject.endMargin).assertEqual('0.00px');
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_0700
* @tc.name Tests the divier property of the tabs component
* @tc.desc set divier parameter to abnormol color value
*/
it('ArkUI_Tabs_Divider_0700', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_0700 start");
try {
var eventData = {
data: {
"strokeWidthStr": '10px',
"dividerColorStr": 'xxxxxxxx',
"startMarginStr": '5px',
"endMarginStr": '5px',
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_0700] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_0700] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('tabsTest');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_0700] divider:" + JSON.stringify(obj.$attrs.divider));
let dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual("10.00px");
expect(dividerObject.color).assertEqual('#33182431');
expect(dividerObject.startMargin).assertEqual("5.00px");
expect(dividerObject.endMargin).assertEqual("5.00px");
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_0800
* @tc.name Tests the divier property of the tabs component
* @tc.desc set divier parameter to abnormol strokeWidthStr value
*/
it('ArkUI_Tabs_Divider_0800', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_0800 start");
try {
var eventData = {
data: {
"strokeWidthStr": 'xxxxxxxx',
"dividerColorStr": 'red',
"startMarginStr": '5px',
"endMarginStr": '5px',
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_0900] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_0800] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('tabsTest');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_0800] divider:" + JSON.stringify(obj.$attrs.divider));
let dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual('0.00vp');
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_0900
* @tc.name Tests the divier property of the tabs component
* @tc.desc set divier parameter to abnormol startMarginStr value
*/
it('ArkUI_Tabs_Divider_0900', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_0900 start");
try {
var eventData = {
data: {
"strokeWidthStr": '10px',
"dividerColorStr": 'red',
"startMarginStr": 'xxxxxxxx',
"endMarginStr": '5px',
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_0900] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_0900] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('tabsTest');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_0900] divider:" + JSON.stringify(obj.$attrs.divider));
let dividerObject = obj.$attrs.divider;
expect(dividerObject.startMargin).assertEqual('0.00vp');
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_1000
* @tc.name Tests the divier property of the tabs component
* @tc.desc set divier parameter to abnormol endMarginStr value
*/
it('ArkUI_Tabs_Divider_1000', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_1000 start");
try {
var eventData = {
data: {
"strokeWidthStr": '10px',
"dividerColorStr": 'red',
"startMarginStr": '5px',
"endMarginStr": 'xxxxxxxx',
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_1000] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_1000] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('tabsTest');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_1000] divider:" + JSON.stringify(obj.$attrs.divider));
let dividerObject = obj.$attrs.divider;
expect(dividerObject.endMargin).assertEqual('0.00vp');
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_1100
* @tc.name Tests the divider and indicator.selectedMode property of the tabs component
* @tc.desc set divider and indicator.selectedMode test
*/
it('ArkUI_Tabs_Divider_1100', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_1100 start");
try {
var eventData = {
data: {
"strokeWidthStr": '10px',
"dividerColorStr": 'red',
"startMarginStr": '5px',
"endMarginStr": '5px',
"selfSelectedMode": SelectedMode.BOARD,
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_1100] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_1100] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('tabsTest');
let strJson2 = getInspectorByKey('indicatorTest1');
let obj = JSON.parse(strJson);
let obj2 = JSON.parse(strJson2);
console.info("[ArkUI_Tabs_Divider_1100] divider:" + JSON.stringify(obj.$attrs.divider));
console.info("[ArkUI_Tabs_Divider_1100] selectedMode:" + obj2.$attrs.tabBar.selectedMode);
let dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual("10.00px");
expect(dividerObject.color).assertEqual("#FFFF0000");
expect(dividerObject.startMargin).assertEqual("5.00px");
expect(dividerObject.endMargin).assertEqual("5.00px");
expect(obj2.$attrs.tabBar.selectedMode).assertEqual("SelectedMode.BOARD");
done();
});
/**
* @tc.number ArkUI_Tabs_Divider_1200
* @tc.name Tests the divier property of the tabs component
* @tc.desc set divier parameter to abnormol endMarginStr value
*/
it('ArkUI_Tabs_Divider_1200', 0, async function (done) {
console.info("ArkUI_Tabs_Divider_1200 start");
try {
var eventData = {
data: {
"strokeWidthStr": '10vp',
"startMarginStr": '10vp',
"endMarginStr": '10vp',
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_1200] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_1200] change component data error: " + err.message);
}
await Utils.sleep(2000);
let strJson = getInspectorByKey('tabsTest');
let obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_1200] divider:" + JSON.stringify(obj.$attrs.divider));
let dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual('10.00vp');
expect(dividerObject.startMargin).assertEqual('10.00vp');
expect(dividerObject.endMargin).assertEqual('10.00vp');
try {
var eventData = {
data: {
"strokeWidthStr": '10px',
"startMarginStr": '10px',
"endMarginStr": '10px',
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_1200] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_1200] change component data error: " + err.message);
}
await Utils.sleep(2000);
strJson = getInspectorByKey('tabsTest');
obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_1200] divider:" + JSON.stringify(obj.$attrs.divider));
dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual('10.00px');
expect(dividerObject.startMargin).assertEqual('10.00px');
expect(dividerObject.endMargin).assertEqual('10.00px');
try {
var eventData = {
data: {
"strokeWidthStr": '10fp',
"startMarginStr": '10fp',
"endMarginStr": '10fp',
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_1200] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_1200] change component data error: " + err.message);
}
await Utils.sleep(2000);
strJson = getInspectorByKey('tabsTest');
obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_1200] divider:" + JSON.stringify(obj.$attrs.divider));
dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual('10.00fp');
expect(dividerObject.startMargin).assertEqual('10.00fp');
expect(dividerObject.endMargin).assertEqual('10.00fp');
try {
var eventData = {
data: {
"strokeWidthStr": '10lpx',
"startMarginStr": '10lpx',
"endMarginStr": '10lpx',
}
}
var innerEvent = {
eventId: 183,
priority: events_emitter.EventPriority.LOW
}
console.info("[ArkUI_Tabs_Divider_1200] start to publish emit");
events_emitter.emit(innerEvent, eventData);
} catch (err) {
console.log("[ArkUI_Tabs_Divider_1200] change component data error: " + err.message);
}
await Utils.sleep(2000);
strJson = getInspectorByKey('tabsTest');
obj = JSON.parse(strJson);
console.info("[ArkUI_Tabs_Divider_1200] divider:" + JSON.stringify(obj.$attrs.divider));
dividerObject = obj.$attrs.divider;
expect(dividerObject.strokeWidth).assertEqual('10.00lpx');
expect(dividerObject.startMargin).assertEqual('10.00lpx');
expect(dividerObject.endMargin).assertEqual('10.00lpx');
done();
});
})
}
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/ets/test/Utils.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* 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...`)
})
}
}
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/module.json
0 → 100644
浏览文件 @
b0dc057d
{
"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_tabs/src/main/resources/base/element/color.json
0 → 100644
浏览文件 @
b0dc057d
{
"color"
:
[
{
"name"
:
"start_window_background"
,
"value"
:
"#FFFFFF"
},
{
"name"
:
"Divider_Color"
,
"value"
:
"#FF121212"
},
{
"name"
:
"Indicator_Color"
,
"value"
:
"#FFFF0000"
}
]
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
b0dc057d
{
"string"
:
[
{
"name"
:
"module_test_desc"
,
"value"
:
"test ability description"
},
{
"name"
:
"TestAbility_desc"
,
"value"
:
"the test ability"
},
{
"name"
:
"TestAbility_label"
,
"value"
:
"test label"
},
{
"name"
:
"Divider_Stroke_Width"
,
"value"
:
"10px"
},
{
"name"
:
"Divider_Start_Margin"
,
"value"
:
"5px"
},
{
"name"
:
"Divider_End_Margin"
,
"value"
:
"5px"
},
{
"name"
:
"Indicator_Height"
,
"value"
:
"10vp"
},
{
"name"
:
"Indicator_Width"
,
"value"
:
"30vp"
},
{
"name"
:
"Indicator_Radius"
,
"value"
:
"5vp"
},
{
"name"
:
"Indicator_Sub_Radius"
,
"value"
:
"20vp"
},
{
"name"
:
"Indicator_Space"
,
"value"
:
"10vp"
}
]
}
\ No newline at end of file
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
b0dc057d
6.6 KB
arkui/ace_ets_components_ux/ace_ets_component_tabs/src/main/resources/base/profile/test_pages.json
0 → 100644
浏览文件 @
b0dc057d
{
"src"
:
[
"TestAbility/pages/Index"
]
}
distributeddatamgr/distributedKVStoretest/distributedKVStorejstest/hap/src/main/js/test/SchemaJsTest.js
浏览文件 @
b0dc057d
...
...
@@ -19,7 +19,7 @@ import abilityFeatureAbility from '@ohos.ability.featureAbility'
var
context
=
abilityFeatureAbility
.
getContext
();
const
TEST_BUNDLE_NAME
=
'
ohos.acts.distributedKvStore
'
;
const
TEST_STORE_ID
=
'
s
toreId
'
;
const
TEST_STORE_ID
=
'
SchemaS
toreId
'
;
var
kvManager
=
null
;
var
kvStore
=
null
;
...
...
distributeddatamgr/relationalStoretest/relationalStoreStagetest/entry/src/main/ets/test/relationalStoreEtsunit.test.ets
浏览文件 @
b0dc057d
...
...
@@ -24,7 +24,7 @@ function sleep(ms) {
}
export default function relationalStoreTest(context){
describe('relationalStoreTest', function () {
describe('relationalStoreTest', function () {
beforeAll(async function () {
console.info(TAG + 'beforeAll')
})
...
...
@@ -62,13 +62,11 @@ describe('relationalStoreTest', function () {
} catch (err) {
expect(null).assertFail();
}
await dataRdb.deleteRdbStore(context,"secure.db");
done();
}).catch((err) => {
expect(null).assertFail();
})
await storePromise
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0100 end *************");
})
...
...
@@ -91,13 +89,11 @@ describe('relationalStoreTest', function () {
} catch (err) {
expect(null).assertFail();
}
await dataRdb.deleteRdbStore(context,"secure.db");
done();
}).catch((err) => {
expect(null).assertFail();
})
await storePromise
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0200 end *************");
})
...
...
@@ -120,13 +116,11 @@ describe('relationalStoreTest', function () {
} catch (err) {
expect(null).assertFail();
}
await dataRdb.deleteRdbStore(context,"secure.db");
done();
}).catch((err) => {
expect(null).assertFail();
})
await storePromise
storePromise = null
await dataRdb.deleteRdbStore(context,"secure.db");
done();
console.log(TAG + "************* SUB_DDM_RELATIONALETS_GETRDBSTORE_PROMISE_0300 end *************");
})
...
...
@@ -277,13 +271,13 @@ describe('relationalStoreTest', function () {
let deleteResult = false
await dataRdb.getRdbStore(context, config).then(async (store) => {
console.info(TAG + "create table success")
})
await dataRdb.deleteRdbStore(context,"secure.db").then(() => {
deleteResult = true
console.info(`${TAG} delete rdb store success,result is ${deleteResult}`)
});
expect(deleteResult).assertTrue();
done();
})
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_PROMISE_0100 end *************");
})
...
...
@@ -302,19 +296,18 @@ describe('relationalStoreTest', function () {
let deleteResult = false
await dataRdb.getRdbStore(context, config).then(async (store) => {
console.info(TAG + "create rdb store success")
})
dataRdb.deleteRdbStore(context,"secure.db", (err, data) => {
if(err == undefined){
deleteResult = true
console.info(`${TAG} delete rdb store success,result is ${deleteResult}`)
}
done();
})
await sleep(1000)
expect(deleteResult).assertTrue();
done();
})
console.log(TAG + "************* SUB_DDM_RELATIONALETS_DELETERDBSTORE_CALLBACK_0100 end *************");
})
console.log(TAG + "*************Unit Test End*************");
})
})
}
\ No newline at end of file
global/i18n_standard/intljs/src/main/js/test/Lang.test.js
浏览文件 @
b0dc057d
...
...
@@ -208,7 +208,7 @@ describe('LangTest', function () {
console
.
log
(
'
i18n_test_preferredlanguage_1100
'
+
'
start
'
);
let
value
=
I18n
.
getAppPreferredLanguage
();
console
.
log
(
'
i18n_test_preferredlanguage_1100
'
+
value
);
expect
(
value
).
assert
Equal
(
'
zh-Hans
'
);
expect
(
value
).
assert
Contain
(
'
zh
'
);
})
/* *
...
...
multimedia/media/media_js_standard/AVPlayerTestBase.js
浏览文件 @
b0dc057d
...
...
@@ -71,6 +71,16 @@ function toPreparePromise(avPlayer, playTest) {
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
async
function
preparePromise
(
avPlayer
)
{
if
(
typeof
(
avPlayer
)
==
'
undefined
'
)
{
return
;
}
await
avPlayer
.
prepare
().
then
(()
=>
{
console
.
info
(
'
case prepare called
'
);
console
.
info
(
'
case avPlayer.duration:
'
+
avPlayer
.
duration
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
function
addCnt
(
countArr
)
{
if
(
countArr
!=
null
)
{
countArr
[
0
]
++
;
...
...
@@ -387,7 +397,7 @@ export function sleep(ms) {
return
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
ms
));
}
function
setAVPlayerPlayAndPauseWithCallBack
(
src
,
avPlayer
,
playT
est
,
playT
ime
,
done
)
{
function
setAVPlayerPlayAndPauseWithCallBack
(
src
,
avPlayer
,
playTime
,
done
)
{
let
playPauseCount
=
0
;
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case setAVPlayerPlayAndPauseWithCallBack in, surfaceID is
${
surfaceID
}
`
);
...
...
@@ -399,7 +409,7 @@ function setAVPlayerPlayAndPauseWithCallBack(src, avPlayer, playTest, playTime,
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
playPauseLoopWithCallBack play state is INITIALIZED
'
)
// step 1: initialized -> prepared -> play
toPreparePromise
(
avPlayer
,
playTest
);
preparePromise
(
avPlayer
);
await
sleep
(
2000
);
avPlayer
.
play
()
break
;
...
...
@@ -453,7 +463,7 @@ function setAVPlayerPlayAndPauseWithCallBack(src, avPlayer, playTest, playTime,
});
}
export
async
function
avPlayerWithCallBack
(
src
,
avPlayer
,
playTest
,
playTime
,
done
)
{
async
function
idle
(
src
,
avPlayer
)
{
console
.
info
(
`case media source:
${
src
}
`
)
await
media
.
createAVPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
...
...
@@ -462,11 +472,15 @@ export async function avPlayerWithCallBack(src, avPlayer, playTest, playTime, do
}
else
{
console
.
error
(
'
case createAVPlayer failed
'
);
expect
().
assertFail
();
done
();
}
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
setAVPlayerPlayAndPauseWithCallBack
(
src
,
avPlayer
,
playTest
,
playTime
,
done
);
setSource
(
avPlayer
,
src
);
return
avPlayer
;
}
export
async
function
avPlayerWithCallBack
(
src
,
avPlayer
,
playTime
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
setAVPlayerPlayAndPauseWithCallBack
(
src
,
avPlayer
,
playTime
,
done
);
await
setSource
(
avPlayer
,
src
);
}
async
function
playToPauseLoop
(
avPlayer
){
...
...
@@ -489,42 +503,1654 @@ async function playToPauseLoop(avPlayer){
})
}
export
async
function
avPlayerWithoutCallBack
(
src
,
avPlayer
,
playTest
,
done
)
{
export
async
function
createToRelease
(
src
,
avPlayer
,
done
)
{
for
(
var
i
=
0
;
i
<
1000
;
i
++
){
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case avPlayerWithoutCallBack in, surfaceID is
${
surfaceID
}
`
);
console
.
info
(
`case media source:
${
src
}
`
)
await
media
.
createAVPlayer
().
then
((
video
)
=>
{
if
(
typeof
(
video
)
!=
'
undefined
'
)
{
console
.
info
(
'
case createAVPlayer success
'
);
avPlayer
=
video
;
}
else
{
console
.
error
(
'
case createAVPlayer failed
'
);
expect
().
assertFail
();
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
CreateToRelease setSource
'
);
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
INITIALIZED
)
{
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
CreateToRelease avPlayer from stop to release
'
)
console
.
info
(
`case CreateToRelease loop is
${
i
}
`
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
}
done
();
}
export
async
function
playToCompleted
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
playToCompletedLoop
(
src
,
avPlayer
,
done
);
await
setSource
(
avPlayer
,
src
);
}
async
function
playToCompletedLoop
(
src
,
avPlayer
,
done
)
{
let
playToCompletedCount
=
0
;
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case playToCompletedLoop in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
playToCompletedLoop play state is INITIALIZED
'
)
// step 1: initialized -> prepared -> play
preparePromise
(
avPlayer
);
await
sleep
(
2000
);
avPlayer
.
play
()
break
;
case
AV_PLAYER_STATE
.
PLAYING
:
avPlayer
.
loop
=
false
;
console
.
info
(
'
playToCompletedLoop play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
playToCompletedCount
++
;
if
(
playToCompletedCount
==
1001
){
// step 4: playing -> stop -> release
avPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
playToCompletedLoop avPlayer from play to stop
'
)
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
playToCompletedLoop avPlayer from stop to release
'
)
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
setSource
(
avPlayer
,
src
);
console
.
info
(
'
avPlayerWithoutCallBack setSource
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
// step 2: playing -> seek loop
avPlayer
.
seek
(
10034
,
media
.
SeekMode
.
SEEK_NEXT_SYNC
)
console
.
info
(
'
playToCompletedLoop avPlayer from play to seek,time is :
'
+
playToCompletedCount
)
}
break
;
case
AV_PLAYER_STATE
.
COMPLETED
:
expect
(
avPlayer
.
currentTime
).
assertEqual
(
avPlayer
.
duration
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
COMPLETED
);
console
.
info
(
'
playToCompletedLoop avPlayer from COMPLETED to play
'
)
// step 3: COMPLETED -> play loop
avPlayer
.
play
();
break
;
case
AV_PLAYER_STATE
.
ERROR
:
expect
().
assertFail
();
avPlayer
.
release
().
then
(()
=>
{
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
});
avPlayer
.
on
(
'
error
'
,
async
(
err
)
=>
{
console
.
error
(
`case error called, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
await
avPlayer
.
release
().
then
(()
=>
{
avPlayer
=
null
;
done
();
});
});
}
export
async
function
seekLoop
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
avPlayer
=
await
idle
(
src
,
avPlayer
)
seekLoopWithCallback
(
avPlayer
);
await
setSource
(
avPlayer
,
src
);
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
INITIALIZED
)
{
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
seekLoop case prepare success
'
);
preparePromise
(
avPlayer
);
await
sleep
(
2000
);
}
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
seekLoop play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
seekLoop play filed,error message is :
'
+
err
.
message
)
})
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
PLAYING
){
console
.
info
(
'
seekLoop avPlayer from play to seek
'
)
// play seek loop 1000 times
for
(
var
loopTime
=
0
;
loopTime
<
1000
;
loopTime
++
){
avPlayer
.
seek
(
loopTime
)
console
.
info
(
`case seekLoopWithCallback loopTime is
${
loopTime
}
`
);
}
}
await
avPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
seekLoopWithCallback avPlayer from play to stop
'
)
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
seekDone
'
]);
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
seekLoopWithCallback avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
async
function
seekLoopWithCallback
(
avPlayer
)
{
avPlayer
.
on
(
'
seekDone
'
,
async
(
seekDoneTime
)
=>
{
console
.
info
(
`case seekDone called seekDoneTime is
${
seekDoneTime
}
`
);
});
}
export
async
function
seekLoopWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case Initialized in, surfaceID is
${
surfaceID
}
`
);
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
INITIALIZED
)
{
toPreparePromise
(
avPlayer
,
playTest
);
avPlayer
.
surfaceId
=
surfaceID
;
preparePromise
(
avPlayer
);
await
sleep
(
2000
);
}
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
PREPARED
){
console
.
info
(
'
avPlayerWithoutCallBack avPlayer from PREPARED to play
'
)
// play to pause loop 1000 times
for
(
var
i
=
0
;
i
<
1000
;
i
++
){
await
playToPauseLoop
(
avPlayer
)
console
.
info
(
`case avPlayerWithoutCallBack playToPauseLoop is
${
i
}
`
);
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
seekLoopWithoutCallback play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
seekLoopWithoutCallback play filed,error message is :
'
+
err
.
message
)
})
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
PLAYING
){
console
.
info
(
'
seekLoopWithoutCallback avPlayer from play to seek
'
)
// play seek loop 1000 times
for
(
var
loopTime
=
0
;
loopTime
<
1000
;
loopTime
++
){
avPlayer
.
seek
(
loopTime
)
console
.
info
(
`case seekLoopWithoutCallback loopTime is
${
loopTime
}
`
);
}
}
await
avPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
avPlayerWithoutCallB
ack avPlayer from play to stop
'
)
console
.
info
(
'
seekLoopWithoutCallb
ack avPlayer from play to stop
'
)
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
avPlayerWithoutCallBack avPlayer from stop to release
'
)
console
.
info
(
'
seekLoopWithoutCallback avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
async
function
prepareToStopLoop
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case prepareToStopLoop Initialized in, surfaceID is
${
surfaceID
}
`
);
avPlayer
=
await
idle
(
src
,
avPlayer
)
setSource
(
avPlayer
,
src
);
console
.
info
(
'
prepareToStopLoop setSource
'
);
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
INITIALIZED
)
{
avPlayer
.
surfaceId
=
surfaceID
;
}
// prepare to stop loop 1000 times
for
(
var
i
=
0
;
i
<
1000
;
i
++
){
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
prepareToStopLoop avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
console
.
info
(
'
prepareToStopLoop avPlayer from prepare to stop
'
)
await
avPlayer
.
stop
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
STOPPED
);
console
.
info
(
'
prepareToStopLoop avPlayer state is stop
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
console
.
info
(
`case PrepareToStopLoop is
${
i
}
`
);
}
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
prepareToStopLoop avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
async
function
prepareToResetLoop
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case prepareToResetLoop Initialized in, surfaceID is
${
surfaceID
}
`
);
avPlayer
=
await
idle
(
src
,
avPlayer
)
// url -> prepare -> play -> reset loop 1000 times
for
(
var
i
=
0
;
i
<
1000
;
i
++
){
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
prepareToResetLoop setSource
'
);
console
.
info
(
'
prepareToResetLoop avPlayer state is :
'
+
avPlayer
.
state
)
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
prepareToResetLoop avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
prepareToResetLoop play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
prepareToResetLoop play filed,error message is :
'
+
err
.
message
)
})
await
avPlayer
.
reset
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
IDLE
);
console
.
info
(
'
prepareToResetLoop avPlayer state is reset
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
console
.
info
(
`case prepareToReset loop is
${
i
}
`
);
}
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
prepareToResetLoop avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
export
async
function
createToReleaseLoop
(
src
,
avPlayer
,
done
)
{
for
(
var
i
=
0
;
i
<
1000
;
i
++
){
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case createToReleaseLoop Initialized in, surfaceID is
${
surfaceID
}
`
);
avPlayer
=
await
idle
(
src
,
avPlayer
)
// url -> prepare -> play -> reset loop 1000 times
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
createToReleaseLoop setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
createToReleaseLoop avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
createToReleaseLoop play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
createToReleaseLoop play filed,error message is :
'
+
err
.
message
)
})
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
createToReleaseLoop avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
console
.
info
(
`case createToReleaseLoop loop is
${
i
}
`
);
}
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
createToReleaseLoop avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
createLoopTime
=
0
;
let
createTotalTime
=
0
;
let
createStart
;
export
async
function
createTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
createStart
=
Date
.
now
();
console
.
info
(
`createTimeWithCallback createStart time is :
${
createStart
}
`
)
createTimeWithCallback
(
src
,
avPlayer
,
done
)
}
function
createTimeCallback
(
src
,
avPlayer
,
done
){
let
end
;
let
execution
;
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`createTimeCallback stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`createTimeCallback state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
IDLE
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
IDLE
);
end
=
Date
.
now
();
console
.
info
(
`createTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
createStart
)
createTotalTime
=
createTotalTime
+
execution
;
console
.
info
(
"
createTimeCallback execution time is :
"
+
execution
)
createLoopTime
++
;
avPlayer
.
release
()
case
AV_PLAYER_STATE
.
RELEASED
:
console
.
info
(
'
createTimeCallback play state is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
if
(
createLoopTime
==
10
){
let
avg
=
createTotalTime
/
10
;
console
.
info
(
"
createTimeCallback avg time is :
"
+
avg
)
createLoopTime
=
0
;
createTotalTime
=
0
;
done
();
}
else
{
avPlayer
=
null
;
createTimeWithCallback
(
src
,
avPlayer
,
done
)
}
break
;
default
:
break
;
}
});
}
export
async
function
createTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
let
start
=
Date
.
now
();
console
.
info
(
`createTimeWithoutCallback start time is :
${
start
}
`
)
avPlayer
=
await
idle
(
src
,
avPlayer
)
let
end
=
Date
.
now
()
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
createTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
createTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
createTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
prepareTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
prepareTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
let
start
=
Date
.
now
();
console
.
info
(
`prepareTimeWithoutCallback start time is :
${
start
}
`
)
let
end
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
prepareTimeWithoutCallback avPlayer state is prepared
'
)
end
=
Date
.
now
()
console
.
info
(
`prepareTimeWithoutCallback end time is :
${
end
}
`
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
prepareTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
prepareTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
prepareTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
prepareTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
prepareTimeCallback
(
src
,
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
async
function
prepareTimeCallback
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
let
loopTime
=
0
;
let
totalTime
=
0
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
IDLE
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
IDLE
);
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
prepareTimeWithCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
let
avg
=
totalTime
/
10
;
console
.
info
(
"
prepareTimeWithCallback avg time is :
"
+
avg
)
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
setSource
(
avPlayer
,
src
)
}
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
prepareTimeWithCallback play state is INITIALIZED
'
)
// step 1: initialized -> prepared
start
=
Date
.
now
();
console
.
info
(
`prepareTimeWithCallback start time is :
${
start
}
`
)
avPlayer
.
prepare
()
break
;
case
AV_PLAYER_STATE
.
PREPARED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
prepareTimeWithCallback avPlayer state is prepared
'
)
end
=
Date
.
now
();
console
.
info
(
`prepareTimeWithCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
prepareTimeWithCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
loopTime
++
;
avPlayer
.
reset
()
break
;
default
:
break
;
}
});
}
export
async
function
playTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
playTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
playTimeWithoutCallback avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
start
=
Date
.
now
();
let
end
;
console
.
info
(
`playTimeWithoutCallback start time is :
${
start
}
`
)
await
avPlayer
.
play
().
then
(()
=>
{
end
=
Date
.
now
();
console
.
info
(
`playTimeWithoutCallback end time is :
${
end
}
`
)
console
.
info
(
'
playTimeWithoutCallback play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
playTimeWithoutCallback play filed,error message is :
'
+
err
.
message
)
})
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
playTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
playTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
playTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
playTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
playTimeCallback
(
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
export
function
playTimeCallback
(
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
let
loopTime
=
0
;
let
totalTime
=
0
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
playTimeCallback play state is INITIALIZED
'
)
// step 1: initialized -> prepared
avPlayer
.
prepare
((
err
)
=>
{
if
(
err
!=
null
)
{
console
.
error
(
`case prepare error, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
playTimeCallback play state is prepared
'
)
}
});
await
sleep
(
2000
);
break
;
case
AV_PLAYER_STATE
.
PREPARED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
playTimeCallback avPlayer state is prepared
'
)
start
=
Date
.
now
();
console
.
info
(
`playTimeCallback start time is :
${
start
}
`
)
// step 2: prapared -> play
avPlayer
.
play
()
break
;
case
AV_PLAYER_STATE
.
PLAYING
:
console
.
info
(
'
playTimeCallback play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
end
=
Date
.
now
();
console
.
info
(
`playTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
playTimeCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
loopTime
++
;
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
playTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
let
avg
=
totalTime
/
10
;
console
.
info
(
"
playTimeWithCallback avg time is :
"
+
avg
)
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
avPlayer
.
pause
()
}
break
;
case
AV_PLAYER_STATE
.
PAUSED
:
console
.
info
(
'
playTimeWithCallback play state is PAUSED
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PAUSED
);
start
=
Date
.
now
();
console
.
info
(
`playTimeCallback start time is :
${
start
}
`
)
// step 3: pause -> playing loop
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
playTimeWithCallback avPlayer from pause to play
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
});
}
export
async
function
pauseTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
let
execution
;
let
end
;
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
pauseTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
pauseTimeWithoutCallback avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
pauseTimeWithoutCallback play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
pauseTimeWithoutCallback play filed,error message is :
'
+
err
.
message
)
})
let
start
=
Date
.
now
();
console
.
info
(
`pauseTimeWithoutCallback start time is :
${
start
}
`
)
await
avPlayer
.
pause
().
then
(()
=>
{
console
.
info
(
'
pauseTimeWithoutCallback pause success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PAUSED
);
end
=
Date
.
now
();
console
.
info
(
`pauseTimeWithoutCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
pauseTimeWithoutCallback execution time is :
"
+
execution
)
},
(
err
)
=>
{
console
.
error
(
'
pauseTimeWithoutCallback pause filed,error message is :
'
+
err
.
message
)
})
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
pauseTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
pauseTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
pauseTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
pauseTimeCallback
(
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
function
pauseTimeCallback
(
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
let
loopTime
=
0
;
let
totalTime
=
0
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
pauseTimeCallback play state is INITIALIZED
'
)
// step 1: initialized -> prepared
avPlayer
.
prepare
((
err
)
=>
{
if
(
err
!=
null
)
{
console
.
error
(
`case prepare error, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
pauseTimeCallback play state is prepared
'
)
}
});
await
sleep
(
2000
);
break
;
case
AV_PLAYER_STATE
.
PREPARED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
pauseTimeCallback avPlayer state is prepared
'
)
avPlayer
.
play
()
break
;
case
AV_PLAYER_STATE
.
PLAYING
:
console
.
info
(
'
pauseTimeCallback play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
start
=
Date
.
now
();
console
.
info
(
`pauseTimeCallback start time is :
${
start
}
`
)
avPlayer
.
pause
();
break
;
case
AV_PLAYER_STATE
.
PAUSED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PAUSED
);
end
=
Date
.
now
();
console
.
info
(
`pauseTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
pauseTimeCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
loopTime
++
;
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
pauseTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
let
avg
=
totalTime
/
10
;
console
.
info
(
"
pauseTimeCallback avg time is :
"
+
avg
)
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
avPlayer
.
play
()
}
break
;
default
:
break
;
}
});
}
export
async
function
stopTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
stopTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
stopTimeWithoutCallback avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
stopTimeWithoutCallback play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
stopTimeWithoutCallback play filed,error message is :
'
+
err
.
message
)
})
let
start
=
Date
.
now
();
console
.
info
(
`stopTimeWithoutCallback start time is :
${
start
}
`
)
let
end
;
await
avPlayer
.
stop
().
then
(()
=>
{
end
=
Date
.
now
();
console
.
info
(
`stopTimeWithoutCallback end time is :
${
end
}
`
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
STOPPED
);
console
.
info
(
'
stopTimeWithoutCallback avPlayer state is stop
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
stopTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
stopTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
stopTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
stopTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
stopTimeCallback
(
src
,
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
function
stopTimeCallback
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
let
loopTime
=
0
;
let
totalTime
=
0
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
IDLE
:
setSource
(
avPlayer
,
src
);
break
;
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
stopTimeCallback play state is INITIALIZED
'
)
// step 1: initialized -> prepared
avPlayer
.
prepare
((
err
)
=>
{
if
(
err
!=
null
)
{
console
.
error
(
`case prepare error, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
stopTimeCallback play state is prepared
'
)
}
});
await
sleep
(
2000
);
break
;
case
AV_PLAYER_STATE
.
PREPARED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
stopTimeCallback avPlayer state is prepared
'
)
start
=
Date
.
now
();
console
.
info
(
`stopTimeCallback start time is :
${
start
}
`
)
loopTime
++
;
avPlayer
.
stop
()
break
;
case
AV_PLAYER_STATE
.
STOPPED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
STOPPED
);
end
=
Date
.
now
();
console
.
info
(
`stopTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
stopTimeCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
stopTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
let
avg
=
totalTime
/
10
;
console
.
info
(
"
stopTimeCallback avg time is :
"
+
avg
)
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
avPlayer
.
reset
()
}
break
;
default
:
break
;
}
});
}
export
async
function
resetTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
resetTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
resetTimeWithoutCallback avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
end
;
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
resetTimeWithoutCallback play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
resetTimeWithoutCallback play filed,error message is :
'
+
err
.
message
)
})
let
start
=
Date
.
now
();
console
.
info
(
`resetTimeWithoutCallback start time is :
${
start
}
`
)
await
avPlayer
.
reset
().
then
(()
=>
{
end
=
Date
.
now
();
console
.
info
(
`resetTimeWithoutCallback end time is :
${
end
}
`
)
console
.
info
(
'
reset success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
IDLE
);
},
(
err
)
=>
{
console
.
error
(
'
reset filed,error message is :
'
+
err
.
message
)
})
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
resetTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
resetTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
resetTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
resetTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
resetTimeCallback
(
src
,
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
function
resetTimeCallback
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
let
loopTime
=
0
;
let
totalTime
=
0
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
IDLE
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
IDLE
);
end
=
Date
.
now
();
console
.
info
(
`resetTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
resetTimeCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
loopTime
++
;
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
resetTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
let
avg
=
totalTime
/
10
;
console
.
info
(
"
resetTimeCallback avg time is :
"
+
avg
)
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
setSource
(
avPlayer
,
src
)
}
break
;
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
resetTimeCallback play state is INITIALIZED
'
)
start
=
Date
.
now
();
console
.
info
(
`resetTimeCallback start time is :
${
start
}
`
)
avPlayer
.
reset
().
then
(()
=>
{
console
.
info
(
'
reset success
'
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
});
}
export
async
function
releaseTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
releaseTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
let
start
=
Date
.
now
();
console
.
info
(
`releaseTimeWithoutCallback start time is :
${
start
}
`
)
let
end
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
releaseTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
end
=
Date
.
now
();
console
.
info
(
`releaseTimeWithoutCallback end time is :
${
end
}
`
)
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
releaseTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
releaseTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
let
releaseTotalTime
=
0
;
let
releaseLoop
=
0
;
export
async
function
releaseTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
releaseTimeCallback
(
src
,
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
function
releaseTimeCallback
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
releaseTimeCallback play state is INITIALIZED
'
)
start
=
Date
.
now
();
console
.
info
(
`releaseTimeCallback start time is :
${
start
}
`
)
avPlayer
.
release
()
break
;
case
AV_PLAYER_STATE
.
RELEASED
:
console
.
info
(
'
releaseTimeCallback play state is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
end
=
Date
.
now
();
console
.
info
(
`releaseTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
releaseTimeCallback execution time is :
"
+
execution
)
releaseTotalTime
=
releaseTotalTime
+
execution
;
releaseLoop
++
;
if
(
releaseLoop
==
10
){
let
avg
=
releaseTotalTime
/
10
;
console
.
info
(
"
createTimeCallback avg time is :
"
+
avg
)
releaseTotalTime
=
0
;
releaseLoop
=
0
;
done
();
}
else
{
avPlayer
=
null
;
releaseTimeWithCallback
(
src
,
avPlayer
,
done
)
}
break
;
default
:
break
;
}
});
}
export
function
getTotalTime
(
releaseTotalTime
){
return
releaseTotalTime
;
}
export
async
function
seekTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
seekTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
seekTimeWithoutCallback avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
end
;
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
seekTimeWithoutCallback play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
seekTimeWithoutCallback play filed,error message is :
'
+
err
.
message
)
})
let
start
=
Date
.
now
();
console
.
info
(
`seekTimeWithoutCallback start time is :
${
start
}
`
)
await
avPlayer
.
seek
(
100
)
end
=
Date
.
now
();
console
.
info
(
`seekTimeWithoutCallback end time is :
${
end
}
`
)
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
seekTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
seekTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
seekTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
seekTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
seekTimeCallback
(
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
function
seekTimeCallback
(
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
let
loopTime
=
0
;
let
totalTime
=
0
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
seekTimeCallback play state is INITIALIZED
'
)
avPlayer
.
prepare
((
err
)
=>
{
if
(
err
!=
null
)
{
console
.
error
(
`case prepare error, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
seekTimeCallback play state is prepared
'
)
}
});
await
sleep
(
2000
);
break
;
case
AV_PLAYER_STATE
.
PREPARED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
seekTimeCallback avPlayer state is prepared
'
)
avPlayer
.
play
()
break
;
case
AV_PLAYER_STATE
.
PLAYING
:
console
.
info
(
'
seekTimeCallback play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
start
=
Date
.
now
();
console
.
info
(
`seekTimeCallback start time is :
${
start
}
`
)
loopTime
+=
20
;
if
(
loopTime
==
220
){
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
seekTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
let
avg
=
totalTime
/
10
;
console
.
info
(
"
seekTimeCallback avg time is :
"
+
avg
)
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
avPlayer
.
seek
(
loopTime
)
}
break
;
case
AV_PLAYER_STATE
.
PAUSED
:
console
.
info
(
'
seekTimeCallback play state is PAUSED
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PAUSED
);
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
seekTimeCallback avPlayer from pause to play
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
});
avPlayer
.
on
(
'
seekDone
'
,
async
(
seekDoneTime
)
=>
{
end
=
Date
.
now
();
console
.
info
(
`seekTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
seekTimeCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
console
.
info
(
`case seekDone called seekDoneTime is
${
seekDoneTime
}
`
);
avPlayer
.
pause
()
});
}
export
async
function
getTrackDescriptionTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
getTrackDescriptionTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
getTrackDescriptionTimeWithoutCallback avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
getTrackDescriptionTimeWithoutCallback play success
'
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
},
(
err
)
=>
{
console
.
error
(
'
getTrackDescriptionTimeWithoutCallback play filed,error message is :
'
+
err
.
message
)
})
let
arrayDescription
;
let
start
=
Date
.
now
();
console
.
info
(
`getTrackDescriptionTimeWithoutCallback start time is :
${
start
}
`
)
let
end
;
await
avPlayer
.
getTrackDescription
().
then
((
arrList
)
=>
{
if
(
arrList
!=
null
)
{
arrayDescription
=
arrList
;
}
else
{
console
.
log
(
'
video getTrackDescription fail
'
);
}
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
end
=
Date
.
now
();
console
.
info
(
`getTrackDescriptionTimeWithoutCallback end time is :
${
end
}
`
)
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
getTrackDescriptionTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
getTrackDescriptionTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
getTrackDescriptionTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
getTrackDescriptionTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
getTrackDescriptionTimeCallback
(
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
function
getTrackDescriptionTimeCallback
(
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
let
loopTime
=
0
;
let
totalTime
=
0
;
let
arrayDescription
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
getTrackDescriptionTimeCallback play state is INITIALIZED
'
)
avPlayer
.
prepare
((
err
)
=>
{
if
(
err
!=
null
)
{
console
.
error
(
`case prepare error, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
getTrackDescriptionTimeCallback play state is prepared
'
)
}
});
await
sleep
(
2000
);
break
;
case
AV_PLAYER_STATE
.
PREPARED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
getTrackDescriptionTimeCallback avPlayer state is prepared
'
)
avPlayer
.
play
()
break
;
case
AV_PLAYER_STATE
.
PLAYING
:
console
.
info
(
'
getTrackDescriptionTimeCallback play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
start
=
Date
.
now
();
console
.
info
(
`getTrackDescriptionTimeCallback start time is :
${
start
}
`
)
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
getTrackDescriptionTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
let
avg
=
totalTime
/
10
;
console
.
info
(
"
getTrackDescriptionTimeCallback avg time is :
"
+
avg
)
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
loopTime
++
;
avPlayer
.
getTrackDescription
().
then
((
arrList
)
=>
{
if
(
arrList
!=
null
)
{
arrayDescription
=
arrList
;
end
=
Date
.
now
();
console
.
info
(
`getTrackDescriptionTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
getTrackDescriptionTimeCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
}
else
{
console
.
log
(
'
video getTrackDescription fail
'
);
}
}).
catch
((
error
)
=>
{
console
.
info
(
`video catchCallback, error:
${
error
}
`
);
});
avPlayer
.
pause
()
}
break
;
case
AV_PLAYER_STATE
.
PAUSED
:
console
.
info
(
'
getTrackDescriptionTimeCallback play state is PAUSED
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PAUSED
);
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
getTrackDescriptionTimeCallback avPlayer from pause to play
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
});
}
export
async
function
setSpeedTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
setSpeedTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
setSpeedTimeWithoutCallback avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
start
=
Date
.
now
();
console
.
info
(
`setSpeedTimeWithoutCallback start time is :
${
start
}
`
)
await
avPlayer
.
setSpeed
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_1_00_X
);
let
end
=
Date
.
now
();
console
.
info
(
`setSpeedTimeWithoutCallback end time is :
${
end
}
`
)
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
setSpeedTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
setSpeedTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
setSpeedTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
setSpeedTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
setSpeedTimeCallback
(
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
function
setSpeedTimeCallback
(
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
let
loopTime
=
0
;
let
totalTime
=
0
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
setSpeedTimeCallback play state is INITIALIZED
'
)
// step 1: initialized -> prepared
avPlayer
.
prepare
((
err
)
=>
{
if
(
err
!=
null
)
{
console
.
error
(
`case prepare error, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
setSpeedTimeCallback play state is prepared
'
)
}
});
await
sleep
(
2000
);
break
;
case
AV_PLAYER_STATE
.
PREPARED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
setSpeedTimeCallback avPlayer state is prepared
'
)
avPlayer
.
play
()
break
;
case
AV_PLAYER_STATE
.
PLAYING
:
console
.
info
(
'
setSpeedTimeCallback play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
console
.
info
(
'
setSpeedTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
let
avg
=
totalTime
/
10
;
console
.
info
(
"
setSpeedTimeCallback avg time is :
"
+
avg
)
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
start
=
Date
.
now
();
console
.
info
(
`setSpeedTimeCallback start time is :
${
start
}
`
)
loopTime
++
avPlayer
.
setSpeed
(
media
.
PlaybackSpeed
.
SPEED_FORWARD_1_00_X
);
}
break
;
case
AV_PLAYER_STATE
.
PAUSED
:
console
.
info
(
'
setSpeedTimeCallback play state is PAUSED
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PAUSED
);
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
setSpeedTimeCallback avPlayer from pause to play
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
});
avPlayer
.
on
(
'
speedDone
'
,
(
speed
)
=>
{
end
=
Date
.
now
();
console
.
info
(
`setSpeedTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
setSpeedTimeCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
console
.
info
(
'
speedDone success,and speed value is:
'
+
speed
)
avPlayer
.
pause
()
});
}
export
async
function
setBitrateTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
setBitrateTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
setBitrateTimeWithoutCallback avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
start
=
Date
.
now
();
console
.
info
(
`setBitrateTimeWithoutCallback start time is :
${
start
}
`
)
let
bitrate
=
96000
await
avPlayer
.
setBitrate
(
bitrate
)
let
end
=
Date
.
now
();
console
.
info
(
`setBitrateTimeWithoutCallback end time is :
${
end
}
`
)
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
setBitrateTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
setBitrateTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
setBitrateTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
setBitrateTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
playTimeCallback
(
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
function
setBitrateTimeCallback
(
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
let
loopTime
=
0
;
let
totalTime
=
0
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
setBitrateTimeCallback play state is INITIALIZED
'
)
// step 1: initialized -> prepared
avPlayer
.
prepare
((
err
)
=>
{
if
(
err
!=
null
)
{
console
.
error
(
`case prepare error, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
setBitrateTimeCallback play state is prepared
'
)
}
});
await
sleep
(
2000
);
break
;
case
AV_PLAYER_STATE
.
PREPARED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
setBitrateTimeCallback avPlayer state is prepared
'
)
avPlayer
.
play
()
break
;
case
AV_PLAYER_STATE
.
PLAYING
:
console
.
info
(
'
setBitrateTimeCallback play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
console
.
info
(
'
setBitrateTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
let
avg
=
totalTime
/
10
;
console
.
info
(
"
setBitrateTimeCallback avg time is :
"
+
avg
)
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
start
=
Date
.
now
();
console
.
info
(
`setBitrateTimeCallback start time is :
${
start
}
`
)
loopTime
++
let
bitrate
=
96000
avPlayer
.
setBitrate
(
bitrate
)
}
break
;
case
AV_PLAYER_STATE
.
PAUSED
:
console
.
info
(
'
setBitrateTimeCallback play state is PAUSED
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PAUSED
);
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
setBitrateTimeCallback avPlayer from pause to play
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
});
avPlayer
.
on
(
'
bitrateDone
'
,
(
bitrate
)
=>
{
end
=
Date
.
now
();
console
.
info
(
`setBitrateTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
setBitrateTimeCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
console
.
info
(
'
bitrate success,and speed value is:
'
+
bitrate
)
avPlayer
.
pause
()
});
}
export
async
function
setVolumeTimeWithoutCallback
(
src
,
avPlayer
,
done
)
{
let
totalTime
=
0
;
let
surfaceID
=
globalThis
.
value
;
for
(
var
i
=
0
;
i
<
10
;
i
++
){
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
setVolumeTimeWithoutCallback setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
setVolumeTimeWithoutCallback avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
let
start
=
Date
.
now
();
console
.
info
(
`setVolumeTimeWithoutCallback start time is :
${
start
}
`
)
let
volume
=
1.0
avPlayer
.
setVolume
(
volume
)
let
end
=
Date
.
now
();
console
.
info
(
`setVolumeTimeWithoutCallback end time is :
${
end
}
`
)
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
setVolumeTimeWithoutCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
await
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
setVolumeTimeWithoutCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
let
avg
=
totalTime
/
10
;
console
.
info
(
"
setVolumeTimeWithoutCallback avg time is :
"
+
avg
)
done
();
}
export
async
function
setVolumeTimeWithCallback
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
playTimeCallback
(
avPlayer
,
done
)
await
setSource
(
avPlayer
,
src
);
}
function
setVolumeTimeCallback
(
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
let
end
;
let
execution
;
let
loopTime
=
0
;
let
totalTime
=
0
;
console
.
info
(
`case setCallback in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
setVolumeTimeCallback play state is INITIALIZED
'
)
// step 1: initialized -> prepared
avPlayer
.
prepare
((
err
)
=>
{
if
(
err
!=
null
)
{
console
.
error
(
`case prepare error, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
done
();
}
else
{
console
.
info
(
'
setVolumeTimeCallback play state is prepared
'
)
}
});
await
sleep
(
2000
);
break
;
case
AV_PLAYER_STATE
.
PREPARED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
setVolumeTimeCallback avPlayer state is prepared
'
)
avPlayer
.
play
()
break
;
case
AV_PLAYER_STATE
.
PLAYING
:
console
.
info
(
'
setVolumeTimeCallback play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
if
(
loopTime
==
10
){
avPlayer
.
release
().
then
(()
=>
{
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
console
.
info
(
'
setVolumeTimeCallback avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
let
avg
=
totalTime
/
10
;
console
.
info
(
"
setVolumeTimeCallback avg time is :
"
+
avg
)
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
else
{
start
=
Date
.
now
();
console
.
info
(
`setVolumeTimeCallback start time is :
${
start
}
`
)
loopTime
++
let
volume
=
1.0
avPlayer
.
setVolume
(
volume
)
}
break
;
case
AV_PLAYER_STATE
.
PAUSED
:
console
.
info
(
'
setVolumeTimeCallback play state is PAUSED
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PAUSED
);
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
setVolumeTimeCallback avPlayer from pause to play
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
});
avPlayer
.
on
(
'
volumeChange
'
,
(
vol
)
=>
{
end
=
Date
.
now
();
console
.
info
(
`setVolumeTimeCallback end time is :
${
end
}
`
)
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
setVolumeTimeCallback execution time is :
"
+
execution
)
totalTime
=
totalTime
+
execution
;
console
.
info
(
'
volumeChange success,and new volume is :
'
+
vol
)
avPlayer
.
pause
()
});
}
export
async
function
firstFrameTime
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
let
start
;
avPlayer
=
await
idle
(
src
,
avPlayer
)
await
setSource
(
avPlayer
,
src
);
console
.
info
(
'
firstFrameTime setSource
'
);
await
sleep
(
20
)
avPlayer
.
surfaceId
=
surfaceID
;
await
avPlayer
.
prepare
().
then
(()
=>
{
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PREPARED
);
console
.
info
(
'
firstFrameTime avPlayer state is prepared
'
)
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
await
avPlayer
.
on
(
'
startRenderFrame
'
,
()
=>
{
console
.
info
(
'
startRenderFrame success
'
)
let
end
=
Date
.
now
();
console
.
info
(
`firstFrameTime end time is :
${
end
}
`
)
let
execution
=
parseInt
(
end
-
start
)
console
.
info
(
"
firstFrameTime execution time is :
"
+
execution
)
sleep
(
100
)
avPlayer
.
release
().
then
(()
=>
{
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
startRenderFrame
'
]);
console
.
info
(
'
firstFrameTime avPlayer is release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
avPlayer
=
null
;
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
})
start
=
Date
.
now
();
console
.
info
(
`firstFrameTime start time is :
${
start
}
`
)
await
avPlayer
.
play
().
then
(()
=>
{
console
.
info
(
'
firstFrameTime play success
'
);
},
(
err
)
=>
{
console
.
error
(
'
firstFrameTime play filed,error message is :
'
+
err
.
message
)
})
}
export
async
function
avPlayerWithoutCallBack
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case avPlayerWithoutCallBack Initialized in, surfaceID is
${
surfaceID
}
`
);
avPlayer
=
await
idle
(
src
,
avPlayer
)
setSource
(
avPlayer
,
src
);
console
.
info
(
'
avPlayerWithoutCallBack setSource
'
);
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
INITIALIZED
)
{
avPlayer
.
surfaceId
=
surfaceID
;
preparePromise
(
avPlayer
);
await
sleep
(
2000
);
}
if
(
avPlayer
.
state
==
AV_PLAYER_STATE
.
PREPARED
){
console
.
info
(
'
avPlayerWithoutCallBack avPlayer from PREPARED to play
'
)
// play to pause loop 1000 times
for
(
var
i
=
0
;
i
<
1000
;
i
++
){
await
playToPauseLoop
(
avPlayer
)
console
.
info
(
`case avPlayerWithoutCallBack playToPauseLoop is
${
i
}
`
);
}
}
await
avPlayer
.
stop
().
then
(()
=>
{
console
.
info
(
'
avPlayerWithoutCallBack avPlayer from play to stop
'
)
avPlayer
.
release
().
then
(()
=>
{
console
.
info
(
'
avPlayerWithoutCallBack avPlayer from stop to release
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
done
();
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
function
setAVPlayerPlay
(
src
,
avPlayer
,
done
)
{
let
surfaceID
=
globalThis
.
value
;
console
.
info
(
`case setAVPlayerPlay in, surfaceID is
${
surfaceID
}
`
);
avPlayer
.
on
(
'
stateChange
'
,
async
(
state
,
reason
)
=>
{
console
.
info
(
`case stateChange called, state is
${
state
}
, reason is
${
reason
}
`
);
console
.
info
(
`case state is
${
state
}
`
);
switch
(
state
)
{
case
AV_PLAYER_STATE
.
INITIALIZED
:
avPlayer
.
surfaceId
=
surfaceID
;
console
.
info
(
'
setAVPlayerPlay play state is INITIALIZED
'
)
// step 1: initialized -> prepared -> play
preparePromise
(
avPlayer
)
await
sleep
(
3000
);
avPlayer
.
play
()
break
;
case
AV_PLAYER_STATE
.
PLAYING
:
console
.
info
(
'
setAVPlayerPlay play state is PLAYING
'
)
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
PLAYING
);
break
;
case
AV_PLAYER_STATE
.
COMPLETED
:
expect
(
avPlayer
.
currentTime
).
assertEqual
(
avPlayer
.
duration
);
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
COMPLETED
);
avPlayer
.
release
().
then
(()
=>
{
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
case
AV_PLAYER_STATE
.
RELEASED
:
expect
(
avPlayer
.
state
).
assertEqual
(
AV_PLAYER_STATE
.
RELEASED
);
offCallback
(
avPlayer
,
[
'
stateChange
'
,
'
error
'
]);
avPlayer
=
null
;
done
();
break
;
case
AV_PLAYER_STATE
.
ERROR
:
expect
().
assertFail
();
avPlayer
.
release
().
then
(()
=>
{
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
break
;
default
:
break
;
}
});
avPlayer
.
on
(
'
error
'
,
async
(
err
)
=>
{
console
.
error
(
`case error called, errMessage is
${
err
.
message
}
`
);
expect
().
assertFail
();
await
avPlayer
.
release
().
then
(()
=>
{
avPlayer
=
null
;
done
();
});
});
}
export
async
function
avPlayerPlay
(
src
,
avPlayer
,
done
)
{
avPlayer
=
await
idle
(
src
,
avPlayer
)
setAVPlayerPlay
(
src
,
avPlayer
,
done
);
await
setSource
(
avPlayer
,
src
);
}
export
async
function
testAVPlayerFun
(
src
,
avPlayer
,
playTest
,
playTime
,
done
)
{
...
...
multimedia/media/media_js_standard/avPlayer/Test.json
浏览文件 @
b0dc057d
...
...
@@ -5,8 +5,8 @@
"test-timeout"
:
"180000"
,
"bundle-name"
:
"ohos.acts.multimedia.avplayer"
,
"module-name"
:
"phone"
,
"shell-timeout"
:
"
1
000000"
,
"testcase-timeout"
:
3
00000
"shell-timeout"
:
"
5
000000"
,
"testcase-timeout"
:
8
00000
},
"kits"
:
[
{
...
...
@@ -20,14 +20,59 @@
"type"
:
"ShellKit"
,
"run-command"
:
[
"remount"
,
"mkdir /data/test"
"mkdir /data/test"
,
"mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files"
,
"chmod 777 -R /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone"
]
},
{
"type"
:
"PushKit"
,
"push"
:
[
"ActsAVPlayerTest.hap->/data/ActsAVPlayerTest.hap"
,
"./resource/audio/H264_AAC.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
"ActsAVPlayerTest.hap->/data/test/ActsAVPlayerTest.hap"
,
"./resource/audio/H264_AAC.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/mp4/h264_mp3_128x96_30r.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/h263_aac.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/h263_mp3.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/MPEG2_AAC.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/MPEG2_MP3.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/h264_1280x720_30.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/H263.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/MPEG2.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/mpeg_ts/h264_aac_480p_25r.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/mpeg_ts/h264_mp3_480p_25r.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/H263_AAC.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/H263_MP3.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/mpeg_ts/mpeg2_aac_720p_30r.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/mpeg_ts/mpeg2_mp3_480p_25r.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/mpeg_ts/mpeg4_aac_720p_30r.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/mpeg_ts/mpeg4_mp3_480p_25r.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/h264_320x240_60.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/h263_1408x1152_30.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/MPEG2.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/mpeg4_320x240_60.ts -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/webm/vp8_vorbis_480p_25r.webm -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/vp8_720x480_60.webm -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/H264_AAC.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/H264_MP3.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/mkv/h263_aac_640x480_30r.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/mkv/h263_mp3_176x144_25r.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/MPEG2_AAC.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/MPEG2_MP3.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/videoplayer/mkv/mpeg4_aac_720p_30r.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/MPEG4_MP3.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/h264_320x240_30.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/h263_1408x1152_60.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/MPEG2.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/mpeg4_320x240_60.mkv -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AAC_48000_32_1.aac -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/audio/01.mp3 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/audio/56.m4a -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/OGG_48000_1.ogg -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/vorbis_48000_32_1.wav -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/audioplayer/flac/flac_48ksr_16kbr_1ch.flac -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/hevc_320x240_60.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/H264_MP3_1s.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
,
"./resource/media/AVPlayer/h264_aac_3840_2160.mp4 -> /data/app/el2/100/base/ohos.acts.multimedia.avplayer/haps/phone/files/"
]
},
{
...
...
@@ -35,7 +80,8 @@
"run-command"
:
[
"chmod 644 /data/test/*.hap"
,
"scanner"
,
"param set persist.ace.testmode.enabled 1"
"param set persist.ace.testmode.enabled 1"
,
"setenforce 0"
]
}
]
...
...
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
b0dc057d
...
...
@@ -19,6 +19,7 @@ export default class MainAbility extends Ability {
// Ability is creating, initialize resources for this ability
console
.
log
(
"
[Demo] MainAbility onCreate
"
)
globalThis
.
abilityWant
=
want
;
globalThis
.
context
=
this
.
context
;
}
onDestroy
()
{
...
...
multimedia/media/media_js_standard/avPlayer/entry/src/main/ets/test/AVPlayerStabilityTest.test.js
浏览文件 @
b0dc057d
...
...
@@ -14,52 +14,102 @@
*/
import
media
from
'
@ohos.multimedia.media
'
import
fileio
from
'
@ohos.fileio
'
import
*
as
mediaTestBase
from
'
../../../../../../MediaTestBase
'
;
import
*
as
AVPlayerTestBase
from
'
../../../../../../AVPlayerTestBase.js
'
;
import
{
testAVPlayerFun
,
AV_PLAYER_STATE
,
setSource
,
avPlayerWithCallBack
,
avPlayerWithoutCallBack
,
sleep
}
from
'
../../../../../../AVPlayerTestBase.js
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
;
export
default
function
AVPlayerStabilityTest
()
{
describe
(
'
AVPlayerStabilityTest
'
,
function
()
{
const
VIDEO_SOURCE
=
'
H264_AAC.mp4
'
;
const
AUDIO_SOURCE
=
'
01.mp3
'
;
const
VIDEO_NOAUDIO
=
'
H264_NONE.mp4
'
const
VIDEO_SOURCES
=
[
'
H264_AAC.mp4
'
,
'
h264_mp3_128x96_30r.mp4
'
,
'
h263_aac.mp4
'
,
'
h263_mp3.mp4
'
,
'
MPEG2_AAC.mp4
'
,
'
MPEG2_MP3.mp4
'
,
'
h264_1280x720_30.mp4
'
,
'
H263.mp4
'
,
'
MPEG2.mp4
'
,
'
h264_aac_480p_25r.ts
'
,
'
h264_mp3_480p_25r.ts
'
,
'
H263_AAC.ts
'
,
'
H263_MP3.ts
'
,
'
mpeg2_aac_720p_30r.ts
'
,
'
mpeg2_mp3_480p_25r.ts
'
,
'
mpeg4_aac_720p_30r.ts
'
,
'
mpeg4_mp3_480p_25r.ts
'
,
'
h264_320x240_60.ts
'
,
'
h263_1408x1152_30.ts
'
,
'
MPEG2.ts
'
,
'
mpeg4_320x240_60.ts
'
,
'
vp8_vorbis_480p_25r.webm
'
,
'
vp8_720x480_60.webm
'
,
'
H264_AAC.mkv
'
,
'
H264_MP3.mkv
'
,
'
h263_aac_640x480_30r.mkv
'
,
'
h263_mp3_176x144_25r.mkv
'
,
'
MPEG2_AAC.mkv
'
,
'
MPEG2_MP3.mkv
'
,
'
mpeg4_aac_720p_30r.mkv
'
,
'
MPEG4_MP3.mkv
'
,
'
h264_320x240_30.mkv
'
,
'
h263_1408x1152_60.mkv
'
,
'
MPEG2.mkv
'
,
'
mpeg4_320x240_60.mkv
'
,
'
AAC_48000_32_1.aac
'
,
'
01.mp3
'
,
'
56.m4a
'
,
'
OGG_48000_1.ogg
'
,
'
vorbis_48000_32_1.wav
'
,
'
flac_48ksr_16kbr_1ch.flac
'
,
'
hevc_320x240_60.mp4
'
,
'
H264_MP3_1s.mp4
'
,
'
h264_aac_3840_2160.mp4
'
]
let
videos
=
[];
let
TAG
=
"
[AVPlayerStabilityTest]
"
;
let
callBackSet
=
0
;
const
PLAY_TIME
=
2
;
let
avPlayer
=
null
;
let
fileDescriptor
=
null
;
let
fileDescriptor2
=
null
;
let
fileDescriptor3
=
null
;
let
avPlayTest1
=
{
width
:
0
,
height
:
0
,
duration
:
-
1
,
};
let
avPlayTest2
=
{
width
:
0
,
height
:
0
,
duration
:
-
1
,
};
beforeAll
(
async
function
()
{
let
fdHead
=
'
fd://
'
;
let
fdPath
=
''
;
let
fdNumber
=
0
;
let
fdNumbers
=
[]
const
PLAY_TIME
=
2
;
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll case
'
);
await
mediaTestBase
.
getStageFileDescriptor
(
VIDEO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor
=
res
;
});
await
mediaTestBase
.
getStageFileDescriptor
(
AUDIO_SOURCE
).
then
((
res
)
=>
{
fileDescriptor2
=
res
;
});
await
mediaTestBase
.
getStageFileDescriptor
(
VIDEO_NOAUDIO
).
then
((
res
)
=>
{
fileDescriptor3
=
res
;
});
for
(
var
i
=
0
;
i
<
VIDEO_SOURCES
.
length
;
i
++
){
await
getStageFdRead
(
VIDEO_SOURCES
[
i
]).
then
((
testNumber
)
=>
{
fdNumber
=
testNumber
;
console
.
info
(
TAG
+
'
this fdNumber is :
'
+
fdNumber
)
fdPath
=
fdHead
+
''
+
fdNumber
;
fdNumbers
.
push
(
fdNumber
)
videos
.
push
(
fdPath
)
})
}
})
async
function
getStageFdRead
(
pathName
)
{
let
fdReturn
;
let
contextStage
=
globalThis
.
context
;
let
fileDir
=
contextStage
.
filesDir
console
.
info
(
"
case file dir is
"
+
JSON
.
stringify
(
fileDir
));
pathName
=
fileDir
+
'
/
'
+
pathName
;
console
.
info
(
"
case pathName is
"
+
pathName
);
await
fileio
.
open
(
pathName
).
then
((
fdNumber
)
=>
{
fdReturn
=
fdNumber
;
console
.
info
(
'
[fileio]case open fd success, fd is
'
+
fdReturn
);
})
return
fdReturn
;
}
beforeEach
(
async
function
()
{
console
.
info
(
'
beforeEach case
'
);
await
sleep
(
3
000
);
await
AVPlayerTestBase
.
sleep
(
1
000
);
})
afterEach
(
async
function
()
{
...
...
@@ -69,14 +119,14 @@ export default function AVPlayerStabilityTest() {
},
mediaTestBase
.
failureCallback
).
catch
(
mediaTestBase
.
catchCallback
);
}
console
.
info
(
'
afterEach case
'
);
await
sleep
(
3
000
);
await
AVPlayerTestBase
.
sleep
(
1
000
);
})
afterAll
(
async
function
()
{
console
.
info
(
'
afterAll case
'
);
await
mediaTestBase
.
closeFileDescriptor
(
VIDEO_SOURCE
);
await
mediaTestBase
.
closeFileDescriptor
(
AUDIO_SOURCE
);
await
mediaTestBase
.
closeFileDescriptor
(
VIDEO_NOAUDIO
);
for
(
var
i
=
0
;
i
<
fdNumbers
.
length
;
i
++
){
await
mediaTestBase
.
closeFdNumber
(
fdNumbers
[
i
]
);
}
})
/* *
...
...
@@ -89,8 +139,7 @@ export default function AVPlayerStabilityTest() {
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0100 start
'
)
avPlayTest1
=
{
width
:
720
,
height
:
480
,
duration
:
10034
};
avPlayerWithCallBack
(
fileDescriptor
,
avPlayer
,
avPlayTest1
,
PLAY_TIME
,
done
);
AVPlayerTestBase
.
avPlayerWithCallBack
(
videos
[
0
],
avPlayer
,
PLAY_TIME
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0100 end
'
)
})
...
...
@@ -104,9 +153,1089 @@ export default function AVPlayerStabilityTest() {
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0200 start
'
)
avPlayTest2
=
{
width
:
720
,
height
:
480
,
duration
:
10034
};
avPlayerWithoutCallBack
(
fileDescriptor
,
avPlayer
,
avPlayTest2
,
done
);
AVPlayerTestBase
.
avPlayerWithoutCallBack
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_0200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0100
* @tc.name : 001.test play source mp4(H264_AAC)
* @tc.desc : Local Video play source (H264_AAC)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0200
* @tc.name : 001.test play source (H264_MP3)
* @tc.desc : Local Video play source (H264_MP3)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0200 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
1
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0300
* @tc.name : 001.test play source mp4 (H263_AAC)
* @tc.desc : Local Video play source (H263_AAC)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0300 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
2
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0300 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0400
* @tc.name : 001.test play source (H263_MP3)
* @tc.desc : Local Video play source (H263_MP3)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0400 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
3
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0400 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0500
* @tc.name : 001.test play source (MPEG2_AAC)
* @tc.desc : Local Video play source (MPEG2_AAC)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0500 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
4
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0500 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0600
* @tc.name : 001.test play source (MPEG2_MP3)
* @tc.desc : Local Video play source (MPEG2_MP3)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0600 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
5
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0600 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0700
* @tc.name : 001.test play source (MPEG2_MP3)
* @tc.desc : Local Video play source (MPEG2_MP3)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0700 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
6
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0700 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0800
* @tc.name : 001.test play source (h263.mov)
* @tc.desc : Local Video play source (h263.mov)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0800 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
7
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0800 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0900
* @tc.name : 001.test play source (mpeg2.mkv)
* @tc.desc : Local Video play source (mpeg2.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0900 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
8
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP4_0900 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0100
* @tc.name : 001.test play source (h264_aac.ts)
* @tc.desc : Local Video play source (h264_aac.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
9
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0200
* @tc.name : 001.test play source (h264_mp3.ts)
* @tc.desc : Local Video play source (h264_mp3.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0200 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
10
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0300
* @tc.name : 001.test play source (h263_aac.ts)
* @tc.desc : Local Video play source (h263_aac.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0300 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
11
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0300 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0400
* @tc.name : 001.test play source (h263_mp3.ts)
* @tc.desc : Local Video play source (h263_mp3.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0400 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
12
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0400 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0500
* @tc.name : 001.test play source (mpeg2_aac.ts)
* @tc.desc : Local Video play source (mpeg2_aac.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0500 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
13
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0500 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0600
* @tc.name : 001.test play source (mpeg2_mp3.ts)
* @tc.desc : Local Video play source (mpeg2_mp3.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0600 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
14
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0600 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0700
* @tc.name : 001.test play source (mpeg4_aac.ts)
* @tc.desc : Local Video play source (mpeg4_aac.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0700 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
15
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0700 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0800
* @tc.name : 001.test play source (mpeg4_mp3.ts)
* @tc.desc : Local Video play source (mpeg4_mp3.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0800 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
16
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0800 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0900
* @tc.name : 001.test play source (h264.ts)
* @tc.desc : Local Video play source (h264.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0900 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
17
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_0900 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1000
* @tc.name : 001.test play source (h263.ts)
* @tc.desc : Local Video play source (h263.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1000 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
18
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1000 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1100
* @tc.name : 001.test play source (mpeg2.ts)
* @tc.desc : Local Video play source (mpeg2.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
19
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1200
* @tc.name : 001.test play source (mpeg4.ts)
* @tc.desc : Local Video play source (mpeg4.ts)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1200 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
20
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_TS_1200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WEBM_0100
* @tc.name : 001.test play source (vp8_vorbis.webm)
* @tc.desc : Local Video play source (vp8_vorbis.webm)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WEBM_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WEBM_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
21
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WEBM_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WEBM_0200
* @tc.name : 001.test play source (vp8.webm)
* @tc.desc : Local Video play source (vp8.webm)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WEBM_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WEBM_0200 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
22
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WEBM_0200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0100
* @tc.name : 001.test play source (H264_AAC.mkv)
* @tc.desc : Local Video play source (H264_AAC.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
23
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0200
* @tc.name : 001.test play source (H264_MP3.mkv)
* @tc.desc : Local Video play source (H264_MP3.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0200 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
24
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0300
* @tc.name : 001.test play source (H263_AAC.mkv)
* @tc.desc : Local Video play source (H263_AAC.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0300 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
25
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0300 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0400
* @tc.name : 001.test play source (H263_MP3.mkv)
* @tc.desc : Local Video play source (H263_MP3.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0400 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
26
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0400 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0500
* @tc.name : 001.test play source (MPEG2_AAC.mkv)
* @tc.desc : Local Video play source (MPEG2_AAC.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0500 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
27
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0500 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0600
* @tc.name : 001.test play source (mpeg2_mp3.mkv)
* @tc.desc : Local Video play source (mpeg2_mp3.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0600 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
28
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0600 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0700
* @tc.name : 001.test play source (mpeg4_aac.mkv)
* @tc.desc : Local Video play source (mpeg4_aac.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0700 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
29
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0700 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0800
* @tc.name : 001.test play source (MPEG4_MP3.mkv)
* @tc.desc : Local Video play source (MPEG4_MP3.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0800 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
30
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0800 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0900
* @tc.name : 001.test play source (h264.mkv)
* @tc.desc : Local Video play source (h264.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0900 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
31
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_0900 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1000
* @tc.name : 001.test play source (h263.mkv)
* @tc.desc : Local Video play source (h263.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1000 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
32
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1000 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1100
* @tc.name : 001.test play source (MPEG2.mkv)
* @tc.desc : Local Video play source (MPEG2.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
33
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1200
* @tc.name : 001.test play source (mpeg4.mkv)
* @tc.desc : Local Video play source (mpeg4.mkv)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1200 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
34
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MKV_1200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_AAC_0100
* @tc.name : 001.test play source (aac_audio.aac)
* @tc.desc : Local Video play source (aac_audio.aac)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_AAC_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_AAC_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
35
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_AAC_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP3_0100
* @tc.name : 001.test play source (MP3_AUDIO.mp3)
* @tc.desc : Local Video play source (MP3_AUDIO.mp3)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP3_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP3_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
36
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_MP3_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_M4A_0100
* @tc.name : 001.test play source (m4a_audio.m4a)
* @tc.desc : Local Video play source (m4a_audio.m4a)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_M4A_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_M4A_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
37
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_M4A_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_OGG_0100
* @tc.name : 001.test play source (ogg_audio.ogg)
* @tc.desc : Local Video play source (ogg_audio.ogg)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_OGG_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_OGG_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
38
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_OGG_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WAV_0100
* @tc.name : 001.test play source (wav_audio.wav)
* @tc.desc : Local Video play source (wav_audio.wav)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WAV_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WAV_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
39
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_WAV_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_FLAC_0100
* @tc.name : 001.test play source (flac_audio.flac)
* @tc.desc : Local Video play source (flac_audio.flac)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_FLAC_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_FLAC_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
40
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_FLAC_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0100
* @tc.name : 001.test play source 60fps
* @tc.desc : Local Video play source
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0100 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
41
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0200
* @tc.name : 001.test play short source 1s
* @tc.desc : Local Video play short source
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0200 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
42
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0300
* @tc.name : 001.test play source 4k
* @tc.desc : Local Video play source
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level2
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0300 start
'
)
AVPlayerTestBase
.
avPlayerPlay
(
videos
[
43
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_FORMAT_SOURCE_0300 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0100
* @tc.name : 001.test create->release (1000 times)
* @tc.desc : Local Video play create->release (1000 times)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0100 start
'
)
AVPlayerTestBase
.
createToRelease
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0200
* @tc.name : 001.test play pause loop 1000
* @tc.desc : Local Video play to pause 1000 times
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0200 start
'
)
AVPlayerTestBase
.
avPlayerWithCallBack
(
videos
[
0
],
avPlayer
,
PLAY_TIME
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300
* @tc.name : 001.test complete->play->seek duration (1000 times)
* @tc.desc : Local Video complete->play->seek duration (1000 times)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300 start
'
)
AVPlayerTestBase
.
playToCompleted
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0300 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0400
* @tc.name : 001.test play->seek (1000 times wait callBack)
* @tc.desc : Local Video play->seek (1000 times)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0400 start
'
)
AVPlayerTestBase
.
seekLoop
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0400 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0500
* @tc.name : 001.test play->seek (1000 times do not wait callBack)
* @tc.desc : Local Video play->seek (1000 times)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0500 start
'
)
AVPlayerTestBase
.
seekLoopWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0500 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0600
* @tc.name : 001.test stop -> prepare (1000 times)
* @tc.desc : Local Video test stop -> prepare (1000 times)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0600 start
'
)
AVPlayerTestBase
.
prepareToStopLoop
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0600 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0700
* @tc.name : 001.test reset -> url -> preapre -> play -> reset (1000 times)
* @tc.desc : Local Video test reset -> url -> preapre -> play -> reset (1000 times)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0700 start
'
)
AVPlayerTestBase
.
prepareToResetLoop
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0700 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0800
* @tc.name : 001.test release -> create-> url -> prepare -> play -> release (1000 times)
* @tc.desc : Local Video test release -> create-> url -> prepare -> play -> release (1000 times)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0800 start
'
)
AVPlayerTestBase
.
createToReleaseLoop
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_STABILITY_01_0800 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0100
* @tc.name : 001.test create time (wait callback)
* @tc.desc : Local Video test create time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
// it('SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0100', 0, async function (done) {
// console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0100 start')
// AVPlayerTestBase.createTimeWithCallback(videos[0], avPlayer, done);
// console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0100 end')
// })
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0110
* @tc.name : 001.test create time (not wait callback)
* @tc.desc : Local Video test create time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0110
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0110 start
'
)
AVPlayerTestBase
.
createTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0110 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0200
* @tc.name : 001.test prepare time (not wait callback)
* @tc.desc : Local Video test prepare time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0200 start
'
)
AVPlayerTestBase
.
prepareTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0210
* @tc.name : 001.test prepare time (not wait callback)
* @tc.desc : Local Video test prepare time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0210
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0210 start
'
)
AVPlayerTestBase
.
prepareTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0210 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0300
* @tc.name : 001.test play time (wait callback)
* @tc.desc : Local Video test play time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0300 start
'
)
AVPlayerTestBase
.
playTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0300 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0310
* @tc.name : 001.test play time (not wait callback)
* @tc.desc : Local Video play prepare time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0310
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0310 start
'
)
AVPlayerTestBase
.
playTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0310 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0300
* @tc.name : 001.test pause time (wait callback)
* @tc.desc : Local Video test pause time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0400 start
'
)
AVPlayerTestBase
.
pauseTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0400 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0410
* @tc.name : 001.test pause time (not wait callback)
* @tc.desc : Local Video pause prepare time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0410
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0410 start
'
)
AVPlayerTestBase
.
pauseTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0410 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0500
* @tc.name : 001.test stop time (wait callback)
* @tc.desc : Local Video test stop time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0500 start
'
)
AVPlayerTestBase
.
stopTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0500 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0510
* @tc.name : 001.test stop time (not wait callback)
* @tc.desc : Local Video stop prepare time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0510
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0510 start
'
)
AVPlayerTestBase
.
stopTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0510 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0600
* @tc.name : 001.test reset time (wait callback)
* @tc.desc : Local Video test reset time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0600
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0600 start
'
)
AVPlayerTestBase
.
resetTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0600 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0610
* @tc.name : 001.test reset time (not wait callback)
* @tc.desc : Local Video reset prepare time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0610
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0610 start
'
)
AVPlayerTestBase
.
resetTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0610 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0700
* @tc.name : 001.test release time (wait callback)
* @tc.desc : Local Video test release time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0700
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0700 start
'
)
AVPlayerTestBase
.
releaseTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0700 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0710
* @tc.name : 001.test release time (not wait callback)
* @tc.desc : Local Video release prepare time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0710
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0710 start
'
)
AVPlayerTestBase
.
releaseTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0710 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0800
* @tc.name : 001.test seek time (wait callback)
* @tc.desc : Local Video test seek time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0800
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0800 start
'
)
AVPlayerTestBase
.
seekTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0800 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0810
* @tc.name : 001.test seek time (not wait callback)
* @tc.desc : Local Video seek prepare time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0810
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0810 start
'
)
AVPlayerTestBase
.
seekTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0810 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0900
* @tc.name : 001.test getTrackDescription time (wait callback)
* @tc.desc : Local Video test getTrackDescription time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0900
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0900 start
'
)
AVPlayerTestBase
.
getTrackDescriptionTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0900 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0910
* @tc.name : 001.test getTrackDescription time (not wait callback)
* @tc.desc : Local Video test getTrackDescription time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0910
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0910 start
'
)
AVPlayerTestBase
.
getTrackDescriptionTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_0910 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1000
* @tc.name : 001.test setSpeed time (wait callback)
* @tc.desc : Local Video test setSpeed time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1000
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1000 start
'
)
AVPlayerTestBase
.
setSpeedTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1000 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1010
* @tc.name : 001.test setSpeed time (not wait callback)
* @tc.desc : Local Video test setSpeed time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1010
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1010 start
'
)
AVPlayerTestBase
.
setSpeedTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1010 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1100
* @tc.name : 001.test setBitrate time (wait callback)
* @tc.desc : Local Video test setBitrate time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1100 start
'
)
AVPlayerTestBase
.
setBitrateTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1100 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1110
* @tc.name : 001.test setBitrate time (not wait callback)
* @tc.desc : Local Video test setBitrate time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1110
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1110 start
'
)
AVPlayerTestBase
.
setBitrateTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1110 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1200
* @tc.name : 001.test setVolume time (wait callback)
* @tc.desc : Local Video test setVolume time (wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1200 start
'
)
AVPlayerTestBase
.
setVolumeTimeWithCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1200 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1210
* @tc.name : 001.test setVolume time (not wait callback)
* @tc.desc : Local Video test setVolume time (not wait callback)
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1210
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1210 start
'
)
AVPlayerTestBase
.
setVolumeTimeWithoutCallback
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_01_1210 end
'
)
})
/* *
* @tc.number : SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_02_0100
* @tc.name : 001.test firstFrame time
* @tc.desc : Local Video test firstFrame time
* @tc.size : MediumTest
* @tc.type : Function test
* @tc.level : Level3
*/
it
(
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_02_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_02_0100 start
'
)
AVPlayerTestBase
.
firstFrameTime
(
videos
[
0
],
avPlayer
,
done
);
console
.
info
(
TAG
+
'
SUB_MULTIMEDIA_MEDIA_AVPLAYER_PERFORMANCE_02_0100 end
'
)
})
})
}
\ No newline at end of file
time/timeTest/entry/src/main/ets/test/List.test.ets
浏览文件 @
b0dc057d
...
...
@@ -13,7 +13,9 @@
* limitations under the License.
*/
import systemTimeJsunit from './systemTimeTest';
import systemTimeCommonEventTest from './systemTimeCommonEvent.test'
export default function testsuite() {
systemTimeJsunit();
systemTimeCommonEventTest();
}
\ No newline at end of file
time/timeTest/entry/src/main/ets/test/systemTimeCommonEvent.test.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import systemTime from "@ohos.systemTime";
import commonEvent from '@ohos.commonEvent'
export default function systemTimeCommonEventTest() {
describe('systemTimeCommonEventTest', function () {
console.info('====>---------------systemTimeCommonEventTest start-----------------------');
/**
* @tc.number SUB_systemTime_commonEnevt_timeChanged_0010
* @tc.name
* @tc.desc
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it('SUB_systemTime_commonEvent_timeChanged_0010', 0, async function (done) {
function unSubscriberCallback (err){
console.debug("====>SUB_systemTime_commonEvent_timeChanged_0010 unSubscriberCallback start");
if (err){
console.debug("====>SUB_systemTime_commonEvent_timeChanged_0010 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.debug("====>SUB_systemTime_commonEvent_timeChanged_0010 unSubscriberCallback finish")
}
}
function subscriberCallback (err, data){
console.debug("====>SUB_systemTime_commonEvent_timeChanged_0010 subscriberCallback data:"
+ JSON.stringify(data));
commonEvent.unsubscribe(subscriber, unSubscriberCallback);
expect(data.event).assertEqual('usual.event.TIME_CHANGED');
console.debug("====>SUB_systemTime_commonEvent_timeChanged_0010 end")
done();
}
var commonEventSubscribeInfo = {
events: ['usual.event.TIME_CHANGED']
}
var subscriber;
commonEvent.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.debug("====>SUB_systemTime_commonEvent_timeChanged_0010 subscriber data:" + JSON.stringify(data))
commonEvent.subscribe(subscriber, subscriberCallback);
console.debug("====>SUB_systemTime_commonEvent_timeChanged_0010 subscriber finish")
let t = setTimeout(async ()=>{
let currentTime= new Date().getTime() + 1500
await systemTime.setTime(currentTime)
clearTimeout(t)
}, 500)
})
});
/**
* @tc.number SUB_systemTime_commonEvent_timeTick_0010
* @tc.name
* @tc.desc
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it('SUB_systemTime_commonEvent_timeTick_0010', 0, async function (done) {
function unSubscriberCallback (err){
console.debug("====>SUB_systemTime_commonEvent_timeTick_0010 unSubscriberCallback start");
if (err){
console.debug("====>SUB_systemTime_commonEvent_timeTick_0010 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.debug("====>SUB_systemTime_commonEvent_timeTick_0010 unSubscriberCallback finish")
}
}
function subscriberCallback (err, data){
console.debug("====>SUB_systemTime_commonEvent_timeTick_0010 subscriberCallback data:"
+ JSON.stringify(data));
commonEvent.unsubscribe(subscriber, unSubscriberCallback);
expect(data.event).assertEqual('usual.event.TIME_TICK');
console.debug("====>SUB_systemTime_commonEnevt_timeTick_0010 end")
done();
}
var commonEventSubscribeInfo = {
events: ['usual.event.TIME_TICK']
}
var subscriber;
commonEvent.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.debug("====>SUB_systemTime_commonEvent_timeTick_0010 subscriber data:" + JSON.stringify(data))
commonEvent.subscribe(subscriber, subscriberCallback);
console.debug("====>SUB_systemTime_commonEvent_timeTick_0010 subscriber finish")
let t = setTimeout(async ()=>{
let currentTime= new Date().getTime()
currentTime = currentTime + (58000- (currentTime % 60000))
await systemTime.setTime(currentTime)
clearTimeout(t)
}, 500)
})
});
/**
* @tc.number SUB_systemTime_commonEvent_timezoneChanged_0010
* @tc.name
* @tc.desc
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it('SUB_systemTime_commonEvent_timezoneChanged_0010', 0, async function (done) {
function unSubscriberCallback (err){
console.debug("====>SUB_systemTime_commonEvent_timezoneChanged_0010 unSubscriberCallback start");
if (err){
console.debug("====>SUB_systemTime_commonEvent_timezoneChanged_0010 unSubscriberCallback failed:" +
JSON.stringify(err));
} else {
console.debug("====>SUB_systemTime_commonEvent_timezoneChanged_0010 unSubscriberCallback finish")
}
}
function subscriberCallback (err, data){
console.debug("====>SUB_systemTime_commonEvent_timezoneChanged_0010 subscriberCallback data:"
+ JSON.stringify(data));
commonEvent.unsubscribe(subscriber, unSubscriberCallback);
expect(data.event).assertEqual('usual.event.TIMEZONE_CHANGED');
console.debug("====>SUB_systemTime_commonEvent_timezoneChanged_0010 end")
done();
}
var commonEventSubscribeInfo = {
events: ['usual.event.TIMEZONE_CHANGED']
}
var subscriber;
commonEvent.createSubscriber(commonEventSubscribeInfo).then((data)=>{
subscriber = data;
console.debug("====>SUB_systemTime_commonEvent_timezoneChanged_0010 subscriber data:" + JSON.stringify(data))
commonEvent.subscribe(subscriber, subscriberCallback);
console.debug("====>SUB_systemTime_commonEvent_timezoneChanged_0010 subscriber finish")
let t = setTimeout(async ()=>{
await systemTime.setTimezone('Europe/Moscow')
clearTimeout(t)
}, 500)
})
});
});
};
validator/acts_validator/src/main/ets/pages/ArkUI/ArkUI_index.ets
浏览文件 @
b0dc057d
...
...
@@ -51,9 +51,9 @@ struct IndexPage {
{title:'CanvasStrokeStyle',uri:'pages/ArkUI/CanvasStrokeStyle'},
{title:'CanvasLineCap',uri:'pages/ArkUI/CanvasLineCap'},
{title:'CanvasLineJoin',uri:'pages/ArkUI/CanvasLineJoin'},
{title:'CanvasMiterLimit',uri:'pages/ArkUI/CanvasMiterLimit'},
{title:'CanvasFont',uri:'pages/ArkUI/CanvasFont'},
{title:'CanvasTextAlign',uri:'pages/ArkUI/CanvasTextAlign'},
{title:'CanvasTextBaseline',uri:'pages/ArkUI/CanvasTextBaseline'},
{title:'CanvasGlobalAlpha',uri:'pages/ArkUI/CanvasGlobalAlpha'},
{title:'CanvasLineDashOffset',uri:'pages/ArkUI/CanvasLineDashOffset'},
{title:'CanvasGlobalCompositeOperation',uri:'pages/ArkUI/CanvasGlobalCompositeOperation'},
...
...
@@ -291,30 +291,29 @@ struct IndexPage {
}
let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString();
let ignoreNum = (24-TestNum).toString();
let arrayBuffer = new ArrayBuffer(40960);
let bufView = new DataView(arrayBuffer);
let serializer = new xml.XmlSerializer(bufView);
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name","ActsArkUITest");
serializer.setAttributes("time", "");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", testNum);
serializer.setAttributes("message", "");
serializer.setAttributes("message", "
*
");
serializer.setAttributes("modulename", "ActsArkUITest");
for (let i = 0; i < title.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title[i]));
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("status", "
*
");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("classname", "
*
");
serializer.setAttributes("result", String(result[i]));
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.setAttributes("level", "
*
");
serializer.setAttributes("message", "
*
");
serializer.endElement();
}
serializer.endElement();
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasFillStyle.ets
浏览文件 @
b0dc057d
...
...
@@ -23,6 +23,9 @@ struct SetCircle {
@State name: string = 'CanvasFillStyle';
@State StepTips: string = '操作步骤:点击不同的颜色控件'+'\n'+'预期结果:原本默认黑色的填色区域会随点击变化';
@State Vue: boolean = false;
@State num1: number = 0;
@State num2: number = 0;
@State num3: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
...
...
@@ -36,7 +39,10 @@ struct SetCircle {
this.FillColor = '#FFFF0000';
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
...
...
@@ -44,7 +50,10 @@ struct SetCircle {
this.FillColor = '#fffffc3c';
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
...
...
@@ -52,7 +61,10 @@ struct SetCircle {
this.FillColor = '#ff19fa00';
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasFont.ets
浏览文件 @
b0dc057d
...
...
@@ -23,6 +23,28 @@ struct SetCircle {
@State name: string = 'CanvasFont';
@State StepTips: string = '操作步骤:点击不同的字体控件'+'\n'+'预期结果:原本默认字体会改变';
@State Vue: boolean = false;
@State num1: number = 0;
@State num2: number = 0;
@State num3: number = 0;
@State num4: number = 0;
@State num5: number = 0;
@State num6: number = 0;
@State num7: number = 0;
@State num8: number = 0;
@State num9: number = 0;
@State num10: number = 0;
@State num11: number = 0;
@State num12: number = 0;
@State num13: number = 0;
@State num14: number = 0;
@State num15: number = 0;
@State num16: number = 0;
@State num17: number = 0;
@State num18: number = 0;
@State num19: number = 0;
@State num20: number = 0;
@State num21: number = 0;
@State num22: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
...
...
@@ -36,168 +58,322 @@ struct SetCircle {
Text('font-style').fontSize(13).border({width:0}).size({width:'24%',height:'18%'})
Text('normal').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal normal 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num1 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('italic').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'italic normal 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num2 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
}
Row({space:8}) {
Text('font-weight').fontSize(13).border({ width: 0 }).size({ width: '24%', height: '18%' })
Text('normal').fontSize(13).border({ width: 2 }).size({ width: '16%', height: '18%' })
.onClick(() => {
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal normal 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num3 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('bold').fontSize(13).border({width:2}).size({width:'16%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal bold 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num4 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('bolder').fontSize(13).border({width:2}).size({width:'16%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal bolder 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num5 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('lighter').fontSize(13).border({width:2}).size({width:'16%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal lighter 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num6 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
}
Row({space:5}) {
Text('100').fontSize(13).border({ width: 2 }).size({ width: '10%', height: '18%' })
.onClick(() => {
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal 100 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num7 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('200').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal 200 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num8 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('300').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal 300 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num9 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('400').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal 400 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num10 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('500').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal 500 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num11 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('600').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal 600 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num12 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('700').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal 700 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num13 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('800').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal 800 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num14 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('900').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal 900 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num15 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
}
Row({space:10}){
Text('font-family').fontSize(13).border({width:0}).size({width:'24%',height:'18%'})
Text('sans-serif').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal normal 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num16 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('serif').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal normal 120px serif';
this.context.fillText("Hello World", 80, 120);
this.num17 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('monospace').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal normal 120px monospace';
this.context.fillText("Hello World", 80, 120);
this.num18 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
}
Row({space:10}) {
Text('font-size').fontSize(13).border({ width: 0 }).size({ width: '18%', height: '18%' })
Text('small').fontSize(13).border({ width: 2 }).size({ width: '18%', height: '18%' })
.onClick(() => {
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal normal 10px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num19 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('medium').fontSize(13).border({width:2}).size({width:'18%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal normal 50px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num20 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('large').fontSize(13).border({width:2}).size({width:'18%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal normal 80px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num21 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
Text('extra').fontSize(13).border({width:2}).size({width:'18%',height:'18%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
600, 6
00);
this.context.font = 'normal normal 120px sans-serif';
this.context.fillText("Hello World", 80, 120);
this.num22 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 && this.num12 == 1 && this.num13 == 1 && this.num14 == 1 && this.num15 == 1
&& this.num16 == 1 && this.num17 == 1 && this.num18 == 1 && this.num19 == 1 && this.num20 == 1
&& this.num21 == 1 && this.num22 == 1 ){
this.Vue = true;
}
})
}
}.width('90%').height('30%')
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasGlobalAlpha.ets
浏览文件 @
b0dc057d
...
...
@@ -47,8 +47,11 @@ struct SetCircle {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }){
Text('透明度: ' + (this.X)*0.005 )
}.width('
70%').height('3
0%')
}.width('
100%').height('2
0%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
...
...
@@ -61,7 +64,7 @@ struct SetCircle {
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(200, 200, 50, 50);
})
}.width('100%').height('
70
%')
}.width('100%').height('
55
%')
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasGlobalCompositeOperation.ets
浏览文件 @
b0dc057d
...
...
@@ -23,6 +23,17 @@ struct SetCircle {
@State name: string = 'CanvasGlobalCompositeOperation';
@State StepTips: string = '操作步骤:点击不同的合成操作的方式'+'\n'+'预期结果:原本默认合成方式会随点击变化';
@State Vue: boolean = false;
@State num1: number = 0;
@State num2: number = 0;
@State num3: number = 0;
@State num4: number = 0;
@State num5: number = 0;
@State num6: number = 0;
@State num7: number = 0;
@State num8: number = 0;
@State num9: number = 0;
@State num10: number = 0;
@State num11: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
...
...
@@ -41,7 +52,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num1 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
Text('s-atop').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
...
...
@@ -51,7 +67,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'source-atop';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num2 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
Text('s-in').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
...
...
@@ -61,7 +82,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'source-in';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num3 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
Text('s-out').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
...
...
@@ -71,7 +97,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'source-out';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num4 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
}
Row({space:10}){
...
...
@@ -83,7 +114,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'destination-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num5 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
Text('d-atop').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
...
...
@@ -93,7 +129,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'destination-atop';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num6 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
Text('d-in').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
...
...
@@ -103,7 +144,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'destination-in';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num7 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
Text('d-out').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
...
...
@@ -113,7 +159,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'destination-out';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num8 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
}
Row({space:10}){
...
...
@@ -125,7 +176,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'lighter';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num9 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
Text('copy').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
...
...
@@ -135,7 +191,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'copy';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num10 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
Text('xor').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
...
...
@@ -145,7 +206,12 @@ struct SetCircle {
this.context.globalCompositeOperation = 'xor';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.num11 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
&& this.num11 == 1 ){
this.Vue = true;
}
})
Text('').fontSize(0).border({width:0}).size({width:'18%',height:'20%'})
}
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineCap.ets
浏览文件 @
b0dc057d
...
...
@@ -23,6 +23,9 @@ struct SetCircle {
@State name: string = 'CanvasLineCap';
@State StepTips: string = '操作步骤:点击不同的端点样式控件'+'\n'+'预期结果:原本默认端点样式会随点击变化';
@State Vue: boolean = false;
@State num1: number = 0;
@State num2: number = 0;
@State num3: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
...
...
@@ -38,7 +41,10 @@ struct SetCircle {
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('round').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
...
...
@@ -49,7 +55,10 @@ struct SetCircle {
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('square').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
...
...
@@ -60,7 +69,10 @@ struct SetCircle {
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineDashOffset.ets
浏览文件 @
b0dc057d
...
...
@@ -46,8 +46,10 @@ struct SetCircle {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('虚线偏移量: ' + (this.X)*0.1 )
}.width('
70%').height('3
0%')
}.width('
100%').height('2
0%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
...
...
@@ -59,7 +61,7 @@ struct SetCircle {
this.context.lineDashOffset = (this.X)*0.1;
this.context.stroke();
})
}.width('100%').height('
70
%')
}.width('100%').height('
55
%')
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineJoin.ets
浏览文件 @
b0dc057d
...
...
@@ -23,6 +23,9 @@ struct SetCircle {
@State name: string = 'CanvasLineJoin';
@State StepTips: string = '操作步骤:点击不同的交点样式控件'+'\n'+'预期结果:原本默认交点样式会随点击变化';
@State Vue: boolean = false;
@State num1: number = 0;
@State num2: number = 0;
@State num3: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
...
...
@@ -39,7 +42,10 @@ struct SetCircle {
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('bevel').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
...
...
@@ -51,7 +57,10 @@ struct SetCircle {
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('miter').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
...
...
@@ -63,7 +72,10 @@ struct SetCircle {
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineWidth.ets
浏览文件 @
b0dc057d
...
...
@@ -46,8 +46,11 @@ struct SetCircle {
console.info('Pan end');
})
)
Text('边框粗细: ' + (this.X)*0.05 )
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('边框粗细: ' + (this.X)*0.05 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
...
...
@@ -57,7 +60,7 @@ struct SetCircle {
this.context.lineWidth = (this.X)*0.05;
this.context.strokeRect(120, 120, 120, 120);
})
}.width('100%').height('
7
0%')
}.width('100%').height('
5
0%')
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasMiterLimit.ets
已删除
100644 → 0
浏览文件 @
a56dd44f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {CustomContainer} from '../common/CanvasCustomContainer2';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
@State FillColor: string = '#FF000000';
@State X: number = 0;
@State name: string = 'CanvasMiterLimit';
@State StepTips: string = '操作步骤:向右拖动MiterLimit按键'+'\n'+'预期结果:斜接面限制值会随拖动距离变化,并显示限制值大小';
@State Vue: boolean = false;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('MiterLimit').fontSize(18).border({width:2}).size({width:'40%',height:'30%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
this.context.clearRect(100, 100, 250, 200);
console.info('Pan start');
this.Vue = true;
})
.onActionUpdate((event: GestureEvent) => {
this.X = event.offsetX;
})
.onActionEnd(() => {
console.info('Pan end');
})
)
Text('边框粗细: ' + (this.X)*0.05 )
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.lineWidth = 8;
this.context.lineJoin = 'miter';
this.context.miterLimit = (this.X)*0.05;
this.context.moveTo(160, 100);
this.context.lineTo(190, 105);
this.context.lineTo(160, 107);
this.context.stroke();
})
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url: 'pages/ArkUI/ArkUI_index',
StepTips: this.StepTips,
content: this.specificNoParam,
FillColor: $FillColor,
X: $X,
name: $name,
Vue: $Vue,
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowBlur.ets
浏览文件 @
b0dc057d
...
...
@@ -35,7 +35,7 @@ struct SetCircle {
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
this.context.clearRect(
10, 50, 400, 3
00);
this.context.clearRect(
0, 0, 600, 5
00);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
console.info('Pan start');
...
...
@@ -48,8 +48,10 @@ struct SetCircle {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('阴影模糊: ' + this.X )
}.width('
70%').height('3
0%')
}.width('
100%').height('2
0%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
...
...
@@ -61,7 +63,7 @@ struct SetCircle {
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('
70
%')
}.width('100%').height('
55
%')
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowColor.ets
浏览文件 @
b0dc057d
...
...
@@ -24,6 +24,9 @@ struct SetCircle {
@State name: string = 'CanvasShadowColor';
@State StepTips: string = '操作步骤:点击不同的颜色控件'+'\n'+'预期结果:原本默认蓝色的阴影会随点击变化';
@State Vue: boolean = false;
@State num1: number = 0;
@State num2: number = 0;
@State num3: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
...
...
@@ -37,7 +40,10 @@ struct SetCircle {
this.context.shadowColor = 'rgb(0,0,255)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
this.num1 = 1;
if ( this.num1 == 1 && this.num3 == 1 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
...
...
@@ -46,7 +52,10 @@ struct SetCircle {
this.context.shadowColor = '#fffffc3c';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == 1 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
...
...
@@ -55,7 +64,10 @@ struct SetCircle {
this.context.shadowColor = '#ff19fa00';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == 1 && this.num2 == 1 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowOffsetX.ets
浏览文件 @
b0dc057d
...
...
@@ -49,8 +49,11 @@ struct SetCircle {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }){
Text('阴影偏移: ' + (this.X)*0.05 )
}.width('
70%').height('3
0%')
}.width('
100%').height('2
0%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
...
...
@@ -63,7 +66,7 @@ struct SetCircle {
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('
70
%')
}.width('100%').height('
55
%')
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowOffsetY.ets
浏览文件 @
b0dc057d
...
...
@@ -49,8 +49,10 @@ struct SetCircle {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }){
Text('阴影偏移: ' + (this.X)*0.05 )
}.width('
70%').height('3
0%')
}.width('
100%').height('2
0%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
...
...
@@ -63,7 +65,7 @@ struct SetCircle {
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('
70
%')
}.width('100%').height('
55
%')
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasStrokeStyle.ets
浏览文件 @
b0dc057d
...
...
@@ -23,6 +23,9 @@ struct SetCircle {
@State name: string = 'CanvasStrokeStyle';
@State StepTips: string = '操作步骤:点击不同的颜色控件'+'\n'+'预期结果:原本默认黑色的边框会随点击变化';
@State Vue: boolean = false;
@State num1: number = 0;
@State num2: number = 0;
@State num3: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
...
...
@@ -36,7 +39,10 @@ struct SetCircle {
this.context.lineWidth = 10;
this.context.strokeStyle = '#FFFF0000';
this.context.strokeRect(100, 160, 150, 100);
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
...
...
@@ -45,7 +51,10 @@ struct SetCircle {
this.context.lineWidth = 10;
this.context.strokeStyle = '#fffffc3c';
this.context.strokeRect(100, 160, 150, 100);
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
...
...
@@ -54,7 +63,10 @@ struct SetCircle {
this.context.lineWidth = 10;
this.context.strokeStyle = '#ff19fa00';
this.context.strokeRect(100, 160, 150, 100);
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasTextAlign.ets
浏览文件 @
b0dc057d
...
...
@@ -23,6 +23,11 @@ struct SetCircle {
@State name: string = 'CanvasTextAlign';
@State StepTips: string = '操作步骤:点击不同的文本对齐方式控件'+'\n'+'预期结果:原本默认的对齐方式会随点击变化';
@State Vue: boolean = false;
@State num1: number = 0;
@State num2: number = 0;
@State num3: number = 0;
@State num4: number = 0;
@State num5: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
...
...
@@ -31,58 +36,73 @@ struct SetCircle {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('start').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
500, 5
00);
this.context.lineWidth = 2;
this.context.moveTo(180, 10);
this.context.lineTo(180, 310);
this.context.stroke();
this.context.textAlign = 'start';
this.context.fillText('textAlign=start', 180, 160);
this.num1 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('end').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
500, 5
00);
this.context.lineWidth = 2;
this.context.moveTo(180, 10);
this.context.lineTo(180, 310);
this.context.stroke();
this.context.textAlign = 'end';
this.context.fillText('textAlign=end', 180, 160);
this.num2 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('left').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
500, 5
00);
this.context.lineWidth = 2;
this.context.moveTo(180, 10);
this.context.lineTo(180, 310);
this.context.stroke();
this.context.textAlign = 'left';
this.context.fillText('textAlign=left', 180, 160);
this.num3 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('center').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
500, 5
00);
this.context.lineWidth = 2;
this.context.moveTo(180, 10);
this.context.lineTo(180, 310);
this.context.stroke();
this.context.textAlign = 'center';
this.context.fillText('textAlign=center', 180, 160);
this.num4 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('right').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
500, 5
00);
this.context.lineWidth = 2;
this.context.moveTo(180, 10);
this.context.lineTo(180, 310);
this.context.stroke();
this.context.textAlign = 'right';
this.context.fillText('textAlign=right', 180, 160);
this.num5 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
}.width('90%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasTextBaseline.ets
浏览文件 @
b0dc057d
...
...
@@ -23,6 +23,11 @@ struct SetCircle {
@State name: string = 'CanvasTextBaseline';
@State StepTips: string = '操作步骤:点击不同的水平对齐方式'+'\n'+'预期结果:原本默认水平对齐方式会随点击变化';
@State Vue: boolean = false;
@State num1: number = 0;
@State num2: number = 0;
@State num3: number = 0;
@State num4: number = 0;
@State num5: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
...
...
@@ -31,7 +36,7 @@ struct SetCircle {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Top').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
500, 5
00);
this.context.strokeStyle = '#0000ff';
this.context.lineWidth = 2;
this.context.moveTo(0, 120);
...
...
@@ -39,11 +44,14 @@ struct SetCircle {
this.context.stroke();
this.context.textBaseline = 'top';
this.context.fillText('Top', 160, 120);
this.num1 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('Bottom').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
500, 5
00);
this.context.strokeStyle = '#0000ff';
this.context.lineWidth = 2;
this.context.moveTo(0, 120);
...
...
@@ -51,11 +59,14 @@ struct SetCircle {
this.context.stroke();
this.context.textBaseline = 'bottom';
this.context.fillText('Bottom', 160, 120);
this.num2 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('Middle').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
500, 5
00);
this.context.strokeStyle = '#0000ff';
this.context.lineWidth = 2;
this.context.moveTo(0, 120);
...
...
@@ -63,11 +74,14 @@ struct SetCircle {
this.context.stroke();
this.context.textBaseline = 'middle';
this.context.fillText('Middle', 160, 120);
this.num3 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('Alphabetic').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
500, 5
00);
this.context.strokeStyle = '#0000ff';
this.context.lineWidth = 2;
this.context.moveTo(0, 120);
...
...
@@ -75,11 +89,14 @@ struct SetCircle {
this.context.stroke();
this.context.textBaseline = 'alphabetic';
this.context.fillText('Alphabetic', 160, 120);
this.num4 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('Hanging').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
this.context.clearRect(0, 10,
350, 3
00);
this.context.clearRect(0, 10,
500, 5
00);
this.context.strokeStyle = '#0000ff';
this.context.lineWidth = 2;
this.context.moveTo(0, 120);
...
...
@@ -87,7 +104,10 @@ struct SetCircle {
this.context.stroke();
this.context.textBaseline = 'hanging';
this.context.fillText('Hanging', 160, 120);
this.num5 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
}.width('90%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
...
validator/acts_validator/src/main/ets/pages/Audio/Audio_index.ets
浏览文件 @
b0dc057d
...
...
@@ -270,30 +270,29 @@ struct IndexPage {
}
let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString();
let ignoreNum = (24-TestNum).toString();
let arrayBuffer = new ArrayBuffer(40960);
let bufView = new DataView(arrayBuffer);
let serializer = new xml.XmlSerializer(bufView);
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name","ActsAudioTest");
serializer.setAttributes("time", "");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", testNum);
serializer.setAttributes("message", "");
serializer.setAttributes("message", "
*
");
serializer.setAttributes("modulename", "ActsAudioTest");
for (let i = 0; i < title.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title[i]));
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("status", "
*
");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("classname", "
*
");
serializer.setAttributes("result", String(result[i]));
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.setAttributes("level", "
*
");
serializer.setAttributes("message", "
*
");
serializer.endElement();
}
serializer.endElement();
...
...
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation0.ets
已删除
100644 → 0
浏览文件 @
a56dd44f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import camera from '@ohos.multimedia.camera'
import Logger from '../model/Logger'
import CameraService from '../model/CameraService'
import {CustomContainer} from '../common/CameraOrientation';
import FirstDialog from '../model/FirstDialog';
const CameraMode = {
MODE_PHOTO: 0, // 拍照模式
MODE_VIDEO: 1 // 录像模式
}
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'CameraOrientation0';
@State StepTips: string = '测试目的:用于测试相机预览和拍照旋转能力\n-左侧显示给定旋转角度后的预览窗口\n-右侧显示拍照后的图片\n-对于前置摄像头会有镜像效果'+'\n'+'预期结果:拍照图片与预览窗口的画面一致';
private tag: string = 'qlw'
private mXComponentController: XComponentController = new XComponentController()
@State surfaceId: number = 0;
@State curModel: number = CameraMode.MODE_PHOTO
@State cameraDeviceIndex: number = 0
@State imageRotationValue: number = camera.ImageRotation.ROTATION_90
@State qualityLevelValue: number = camera.QualityLevel.QUALITY_LEVEL_LOW
@State assetUri: string = undefined
@State Vue: boolean = false
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
handleTakePicture = (assetUri: string) => {
this.assetUri = assetUri
Logger.info(this.tag, `takePicture end, assetUri: ${this.assetUri}`)
}
@Builder specificNoParam() {
Column() {
}
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Camera/Camera_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name: $name,
Vue: $Vue
}).height('30%').width('100%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 10, surfaceHeight: 10 })
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.curModel = CameraMode.MODE_PHOTO
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
})
.height('40%')
.width('40%')
Text('Camera Preview').fontSize('20fp')
Image(this.assetUri || $r('app.media.img'))
.width('40%').height('40%').border({ width: 1 }).objectFit(ImageFit.Contain)
Text('Oriented Photo').fontSize('20fp')
Button('拍照', {
type: ButtonType.Normal,
stateEffect: true
}).borderRadius(8).backgroundColor(0x317aff).width('20%').onClick(() => {
CameraService.takePicture(this.imageRotationValue, this.qualityLevelValue)
CameraService.setTakePictureCallback(this.handleTakePicture.bind(this))
this.Vue = true
})
}.width('100%').height('70%').backgroundColor(Color.White)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation180.ets
已删除
100644 → 0
浏览文件 @
a56dd44f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import camera from '@ohos.multimedia.camera'
import Logger from '../model/Logger'
import CameraService from '../model/CameraService'
import {CustomContainer} from '../common/CameraOrientation';
import FirstDialog from '../model/FirstDialog';
const CameraMode = {
MODE_PHOTO: 0, // 拍照模式
MODE_VIDEO: 1 // 录像模式
}
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'CameraOrientation180';
@State StepTips: string = '测试目的:用于测试相机预览和拍照旋转能力\n-左侧显示给定旋转角度后的预览窗口\n-右侧显示拍照后的图片\n-对于前置摄像头会有镜像效果'+'\n'+'预期结果:拍照图片与预览窗口的画面一致';
private tag: string = 'qlw'
private mXComponentController: XComponentController = new XComponentController()
@State surfaceId: number = 0;
@State curModel: number = CameraMode.MODE_PHOTO
@State cameraDeviceIndex: number = 0
@State imageRotationValue: number = camera.ImageRotation.ROTATION_180
@State qualityLevelValue: number = camera.QualityLevel.QUALITY_LEVEL_LOW
@State assetUri: string = undefined
@State Vue: boolean = false
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
handleTakePicture = (assetUri: string) => {
this.assetUri = assetUri
Logger.info(this.tag, `takePicture end, assetUri: ${this.assetUri}`)
}
@Builder specificNoParam() {
Column() {
}
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Camera/Camera_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name,
Vue: $Vue,
}).height('30%').width('100%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 10, surfaceHeight: 10 })
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.curModel = CameraMode.MODE_PHOTO
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
})
.height('40%')
.width('40%')
Text('Camera Preview').fontSize('20fp')
Image(this.assetUri || $r('app.media.img'))
.width('40%').height('40%').border({ width: 1 }).objectFit(ImageFit.Contain)
Text('Oriented Photo').fontSize('20fp')
Button('拍照', {
type: ButtonType.Normal,
stateEffect: true
}).borderRadius(8).backgroundColor(0x317aff).width('20%').onClick(() => {
CameraService.takePicture(this.imageRotationValue, this.qualityLevelValue)
CameraService.setTakePictureCallback(this.handleTakePicture.bind(this))
this.Vue = true
})
}.width('100%').height('70%').backgroundColor(Color.White)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation270.ets
已删除
100644 → 0
浏览文件 @
a56dd44f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import camera from '@ohos.multimedia.camera'
import Logger from '../model/Logger'
import CameraService from '../model/CameraService'
import {CustomContainer} from '../common/CameraOrientation';
import FirstDialog from '../model/FirstDialog';
const CameraMode = {
MODE_PHOTO: 0, // 拍照模式
MODE_VIDEO: 1 // 录像模式
}
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'CameraOrientation270';
@State StepTips: string = '测试目的:用于测试相机预览和拍照旋转能力\n-左侧显示给定旋转角度后的预览窗口\n-右侧显示拍照后的图片\n-对于前置摄像头会有镜像效果'+'\n'+'预期结果:拍照图片与预览窗口的画面一致';
private tag: string = 'qlw'
private mXComponentController: XComponentController = new XComponentController()
@State surfaceId: number = 0;
@State curModel: number = CameraMode.MODE_PHOTO
@State cameraDeviceIndex: number = 0
@State imageRotationValue: number = camera.ImageRotation.ROTATION_270
@State qualityLevelValue: number = camera.QualityLevel.QUALITY_LEVEL_LOW
@State assetUri: string = undefined
@State Vue: boolean = false
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
handleTakePicture = (assetUri: string) => {
this.assetUri = assetUri
Logger.info(this.tag, `takePicture end, assetUri: ${this.assetUri}`)
}
@Builder specificNoParam() {
Column() {
}
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Camera/Camera_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name,
Vue: $Vue
}).height('30%').width('100%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 10, surfaceHeight: 10 })
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.curModel = CameraMode.MODE_PHOTO
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
})
.height('40%')
.width('40%')
Text('Camera Preview').fontSize('20fp')
Image(this.assetUri || $r('app.media.img'))
.width('40%').height('40%').border({ width: 1 }).objectFit(ImageFit.Contain)
Text('Oriented Photo').fontSize('20fp')
Button('拍照', {
type: ButtonType.Normal,
stateEffect: true
}).borderRadius(8).backgroundColor(0x317aff).width('20%').onClick(() => {
CameraService.takePicture(this.imageRotationValue, this.qualityLevelValue)
CameraService.setTakePictureCallback(this.handleTakePicture.bind(this))
this.Vue = true
})
}.width('100%').height('70%').backgroundColor(Color.White)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation90.ets
已删除
100644 → 0
浏览文件 @
a56dd44f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import camera from '@ohos.multimedia.camera'
import Logger from '../model/Logger'
import CameraService from '../model/CameraService'
import {CustomContainer} from '../common/CameraOrientation';
import FirstDialog from '../model/FirstDialog';
const CameraMode = {
MODE_PHOTO: 0, // 拍照模式
MODE_VIDEO: 1 // 录像模式
}
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'CameraOrientation90';
@State StepTips: string = '测试目的:用于测试相机预览和拍照旋转能力\n-左侧显示给定旋转角度后的预览窗口\n-右侧显示拍照后的图片\n-对于前置摄像头会有镜像效果'+'\n'+'预期结果:拍照图片与预览窗口的画面一致';
private tag: string = 'qlw'
private mXComponentController: XComponentController = new XComponentController()
@State surfaceId: number = 0;
@State curModel: number = CameraMode.MODE_PHOTO
@State cameraDeviceIndex: number = 0
@State imageRotationValue: number = camera.ImageRotation.ROTATION_0
@State qualityLevelValue: number = camera.QualityLevel.QUALITY_LEVEL_LOW
@State assetUri: string = undefined
@State Vue: boolean = false
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
handleTakePicture = (assetUri: string) => {
this.assetUri = assetUri
Logger.info(this.tag, `takePicture end, assetUri: ${this.assetUri}`)
}
@Builder specificNoParam() {
Column() {
}
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Camera/Camera_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name,
Vue: $Vue
}).height('30%').width('100%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 10, surfaceHeight: 10 })
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.curModel = CameraMode.MODE_PHOTO
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
})
.height('40%')
.width('40%')
Text('Camera Preview').fontSize('20fp')
Image(this.assetUri || $r('app.media.img'))
.width('40%').height('40%').border({ width: 1 }).objectFit(ImageFit.Contain)
Text('Oriented Photo').fontSize('20fp')
Button('拍照', {
type: ButtonType.Normal,
stateEffect: true
}).borderRadius(8).backgroundColor(0x317aff).width('20%').onClick(() => {
CameraService.takePicture(this.imageRotationValue, this.qualityLevelValue)
CameraService.setTakePictureCallback(this.handleTakePicture.bind(this))
this.Vue = true
})
}.width('100%').height('70%').backgroundColor(Color.White)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Camera/Camera_index.ets
浏览文件 @
b0dc057d
...
...
@@ -39,12 +39,9 @@ struct IndexPage {
@State result : string = '';
@State TEST : number = 0;
private TestCaseList = [
{title:'CameraOrientation0',uri:'pages/Camera/CameraOrientation0'},
{title:'CameraOrientation90',uri:'pages/Camera/CameraOrientation90'},
{title:'CameraOrientation180',uri:'pages/Camera/CameraOrientation180'},
{title:'CameraOrientation270',uri:'pages/Camera/CameraOrientation270'},
{title:'CameraFormat',uri:'pages/Camera/CameraFormat'},
{title:'CameraVideo',uri:'pages/Camera/CameraVideo'},
{title:'Camera Orientation',uri:'pages/Camera/CameraOrientation'},
{title:'Camera Format',uri:'pages/Camera/CameraFormat'},
{title:'Camera Video',uri:'pages/Camera/CameraVideo'},
]
@State ColorObject : string[] = VarColor;
async onPageShow(){
...
...
@@ -275,30 +272,29 @@ struct IndexPage {
}
let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString();
let ignoreNum = (4-TestNum).toString();
let arrayBuffer = new ArrayBuffer(40960);
let bufView = new DataView(arrayBuffer);
let serializer = new xml.XmlSerializer(bufView);
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsCameraTest");
serializer.setAttributes("time", "");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", testNum);
serializer.setAttributes("message", "");
serializer.setAttributes("message", "
*
");
serializer.setAttributes("modulename", "ActsCameraTest");
for (let i = 0; i < title.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title[i]));
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("status", "
*
");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("classname", "
*
");
serializer.setAttributes("result", String(result[i]));
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.setAttributes("level", "
*
");
serializer.setAttributes("message", "
*
");
serializer.endElement();
}
serializer.endElement();
...
...
validator/acts_validator/src/main/ets/pages/Experience/ColdStartTest.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let SettingsColdPath = path + '/ColdStartSetting.log';
let PhotosColdPath = path + '/ColdStartPhotos.log';
let MmsColdPath = path + '/ColdStartMms.log';
let CameraColdPath = path + '/ColdStartCamera.log';
let ContactsColdPath = path + '/ColdStartContacts.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'ColdStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延低于2000ms则测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State num: number = 0;
@State setNum: number = 0;
@State photosNum: number = 0;
@State mmsNum: number = 0;
@State cameraNum: number = 0;
@State contactsNum: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' )
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用`+ '\n' + '\n'
+ `3.双击执行.bat选择冷启动测试输入待测应用编号`+ '\n' + '\n' +`4.依次测试完所有应用冷启动返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若所有冷启动测试均在规定时延内完成则通过测试`
+ '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.num = 0;
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
}
abilityContext.startAbility(str).then((data) => {
}).catch((error) => {
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
/*
settings
*/
let setFd = fileio.openSync(SettingsColdPath, 0o100 | 0o2002, 0o664);
let setBuf = new ArrayBuffer(4096);
fileio.readSync(setFd,setBuf);
let setReport = String.fromCharCode.apply(null,new Uint8Array(setBuf));
let setHead = setReport.indexOf(':');
let setTime = setReport.substring(setHead+1);
this.setNum = parseFloat(setTime);
if( this.setNum < 2000 ) {
this.num++
}
/*
photos
*/
let photosFd = fileio.openSync(PhotosColdPath, 0o100 | 0o2002, 0o664);
let photosBuf = new ArrayBuffer(4096);
fileio.readSync(photosFd,photosBuf);
let photosReport = String.fromCharCode.apply(null,new Uint8Array(photosBuf));
let photosHead = photosReport.indexOf(':');
let photosTime = photosReport.substring(photosHead+1);
this.photosNum = parseFloat(photosTime);
if( this.photosNum < 2000 ) {
this.num++
}
/*
mms
*/
let MmsFd = fileio.openSync(MmsColdPath, 0o100 | 0o2002, 0o664);
let MmsBuf = new ArrayBuffer(4096);
fileio.readSync(MmsFd,MmsBuf);
let MmsReport = String.fromCharCode.apply(null,new Uint8Array(MmsBuf));
let MmsHead = MmsReport.indexOf(':');
let MmsTime = MmsReport.substring(MmsHead+1);
this.mmsNum = parseFloat(MmsTime);
if( this.mmsNum < 2000 ) {
this.num++
}
/*
camera
*/
let CameraFd = fileio.openSync(CameraColdPath, 0o100 | 0o2002, 0o664);
let CameraBuf = new ArrayBuffer(4096);
fileio.readSync(CameraFd,CameraBuf);
let CameraReport = String.fromCharCode.apply(null,new Uint8Array(CameraBuf));
let CameraHead = CameraReport.indexOf(':');
let CameraTime = CameraReport.substring(CameraHead+1);
this.cameraNum = parseFloat(CameraTime);
if( this.cameraNum < 2000 ) {
this.num++
}
/*
mms
*/
let ContactsFd = fileio.openSync(ContactsColdPath, 0o100 | 0o2002, 0o664);
let ContactsBuf = new ArrayBuffer(4096);
fileio.readSync(ContactsFd,ContactsBuf);
let ContactsReport = String.fromCharCode.apply(null,new Uint8Array(ContactsBuf));
let ContactsHead = ContactsReport.indexOf(':');
let ContactsTime = ContactsReport.substring(ContactsHead+1);
this.contactsNum = parseFloat(ContactsTime);
if( this.contactsNum < 2000 ) {
this.num++
}
if( this.num === 5 ) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + `测试结果:` + '\n' + '设置冷启动时延' + this.setNum + 'ms' + '\n' + '图库冷启动时延' + this.photosNum
+ 'ms' + '\n'+ '信息冷启动时延' + this.mmsNum + 'ms' + '\n' + '相机冷启动时延' + this.cameraNum + 'ms' + '\n'
+ '联系人冷启动时延' + this.contactsNum + 'ms' + '\n' + '通过冷启动测试项' + this.num + '个')
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
num: $num,
setNum: $setNum,
photosNum: $photosNum,
mmsNum: $mmsNum,
cameraNum: $cameraNum,
contactsNum: $contactsNum,
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
validator/acts_validator/src/main/ets/pages/Experience/DeskFps.ets
浏览文件 @
b0dc057d
...
...
@@ -44,7 +44,7 @@ struct CustomContainerUser {
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n'
+ `2.双击执行
DeskFps.bat
`+ '\n' + '\n' +`3.左右滑动系统桌面连续10s以上` + '\n' + '\n'
+ `2.双击执行
.bat选择帧率>桌面
`+ '\n' + '\n' +`3.左右滑动系统桌面连续10s以上` + '\n' + '\n'
+ '4.回到DeskFps测试项点击停止键' + '\n' + '\n' + `5.若测试最高帧率大于54帧则通过测试`
+ '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
...
...
@@ -83,11 +83,26 @@ struct CustomContainerUser {
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(':');
let headList = new Array();
let endList = new Array();
let head = report.indexOf(":");
let end = report.indexOf('|');
this.Fps = report.substring(head+1,end);
let num = Number(this.Fps)
if(num >= 54 ) {
let Fps = new Array();
while(head > -1){
headList.push(head);
head = report.indexOf(":",head + 1);
}
while(end > -1){
endList.push(end);
end = report.indexOf("|",end + 1);
}
for(let i = 0; i < headList.length; i++) {
Fps[i] = Number(report.substring(headList[i]+1,endList[i]));
}
let maxFps = Math.max(...Fps);
this.Fps = maxFps.toString();
if(maxFps >= 54) {
this.Vue = true;
}
})
...
...
validator/acts_validator/src/main/ets/pages/Experience/Experience_index.ets
浏览文件 @
b0dc057d
...
...
@@ -41,6 +41,15 @@ struct IndexPage {
private TestCaseList = [
{title:'DeskFps',uri:'pages/Experience/DeskFps'},
{title:'PhotoFps',uri:'pages/Experience/PhotoFps'},
{title:'ColdStart',uri:'pages/Experience/ColdStartTest'},
{title:'HotStart',uri:'pages/Experience/HotStartTest'},
{title:'ViewPhoto',uri:'pages/Experience/ViewPhotoTest'},
{title:'KeyboardDisplay',uri:'pages/Experience/KeyboardDisplayTest'},
{title:'StartTaskManager',uri:'pages/Experience/StartTaskManager'},
{title:'StartBackgroundTask',uri:'pages/Experience/StartBackgroundTask'},
{title:'StartNotification',uri:'pages/Experience/StartNotification'},
{title:'ScrollPhotosList',uri:'pages/Experience/ScrollPhotosList'},
{title:'KeyboardInput',uri:'pages/Experience/KeyboardInputTest'},
]
@State ColorObject : string[] = VarColor;
async onPageShow(){
...
...
@@ -271,30 +280,29 @@ struct IndexPage {
}
let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString();
let ignoreNum = (24-TestNum).toString();
let arrayBuffer = new ArrayBuffer(40960);
let bufView = new DataView(arrayBuffer);
let serializer = new xml.XmlSerializer(bufView);
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name","ActsExperienceTest");
serializer.setAttributes("time", "");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", testNum);
serializer.setAttributes("message", "");
serializer.setAttributes("message", "
*
");
serializer.setAttributes("modulename", "ActsExperienceTest");
for (let i = 0; i < title.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title[i]));
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("status", "
*
");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("classname", "
*
");
serializer.setAttributes("result", String(result[i]));
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.setAttributes("level", "
*
");
serializer.setAttributes("message", "
*
");
serializer.endElement();
}
serializer.endElement();
...
...
validator/acts_validator/src/main/ets/pages/Experience/HotStartTest.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let SettingsColdPath = path + '/HotStartSetting.log';
let PhotosColdPath = path + '/HotStartPhotos.log';
let MmsColdPath = path + '/HotStartMms.log';
let ContactsColdPath = path + '/HotStartContacts.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'HotStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延低于1000ms则测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State num: number = 0;
@State setNum: number = 0;
@State photosNum: number = 0;
@State mmsNum: number = 0;
@State cameraNum: number = 0;
@State contactsNum: number = 0;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' )
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在`+ '\n' + '\n'
+ `3.双击执行.bat选择热启动测试输入待测应用编号`+ '\n' + '\n' +`4.依次测试完所有应用热启动返回validator界面`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若所有热启动测试均在规定时延内完成则通过测试`
+ '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.num = 0;
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
}
abilityContext.startAbility(str).then((data) => {
}).catch((error) => {
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
/*
settings
*/
let setFd = fileio.openSync(SettingsColdPath, 0o100 | 0o2002, 0o664);
let setBuf = new ArrayBuffer(4096);
fileio.readSync(setFd,setBuf);
let setReport = String.fromCharCode.apply(null,new Uint8Array(setBuf));
let setHead = setReport.indexOf(':');
let setTime = setReport.substring(setHead+1);
this.setNum = parseFloat(setTime);
if( this.setNum < 1000 ) {
this.num++
}
/*
photos
*/
let photosFd = fileio.openSync(PhotosColdPath, 0o100 | 0o2002, 0o664);
let photosBuf = new ArrayBuffer(4096);
fileio.readSync(photosFd,photosBuf);
let photosReport = String.fromCharCode.apply(null,new Uint8Array(photosBuf));
let photosHead = photosReport.indexOf(':');
let photosTime = photosReport.substring(photosHead+1);
this.photosNum = parseFloat(photosTime);
if( this.photosNum < 1000 ) {
this.num++
}
/*
mms
*/
let MmsFd = fileio.openSync(MmsColdPath, 0o100 | 0o2002, 0o664);
let MmsBuf = new ArrayBuffer(4096);
fileio.readSync(MmsFd,MmsBuf);
let MmsReport = String.fromCharCode.apply(null,new Uint8Array(MmsBuf));
let MmsHead = MmsReport.indexOf(':');
let MmsTime = MmsReport.substring(MmsHead+1);
this.mmsNum = parseFloat(MmsTime);
if( this.mmsNum < 1000 ) {
this.num++
}
/*
mms
*/
let ContactsFd = fileio.openSync(ContactsColdPath, 0o100 | 0o2002, 0o664);
let ContactsBuf = new ArrayBuffer(4096);
fileio.readSync(ContactsFd,ContactsBuf);
let ContactsReport = String.fromCharCode.apply(null,new Uint8Array(ContactsBuf));
let ContactsHead = ContactsReport.indexOf(':');
let ContactsTime = ContactsReport.substring(ContactsHead+1);
this.contactsNum = parseFloat(ContactsTime);
if( this.contactsNum < 1000 ) {
this.num++
}
if( this.num === 4 ) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + '\n' + '\n' + `测试结果:` + '\n' + '设置热启动时延' + this.setNum + 'ms'
+ '\n' + '图库热启动时延' + this.photosNum + 'ms' + '\n'+ '信息热启动时延' + this.mmsNum + 'ms' + '\n'
+ '联系人热启动时延' + this.contactsNum + 'ms' + '\n' + '通过热启动测试项' + this.num + '个' )
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
num: $num,
setNum: $setNum,
photosNum: $photosNum,
mmsNum: $mmsNum,
cameraNum: $cameraNum,
contactsNum: $contactsNum,
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
validator/acts_validator/src/main/ets/pages/Experience/KeyboardDisplayTest.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir;
let Xpath = path + '/CompleteTimeKeyboard.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'KeyboardDisplay';
@State StepTips: string = '操作步骤:根据操作提示点击输入框等待键盘加载'+'\n'+'预期结果:输入键盘弹出时延低于1000ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State time: string = '0';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n')
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入信息` + '\n' + '\n' +'2.新建一条信息显示输入框'+ '\n' + '\n'
+ `3.双击执行.bat选择完成时延>键盘按键弹出`+ '\n' + '\n' +`4.点击输入框等待键盘弹出` + '\n' + '\n'
+ '5.待脚本执行结束回到Validator点击停止键' + '\n' + '\n' + `6.若弹出键盘时延小于或等于1000ms则通过测试`
+ '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.StartEnable = !this.StartEnable;
let bundleName=new String("com.ohos.mms").toString();
let abilityName=new String("com.ohos.mms.MainAbility").toString();
let str = {
"bundleName": bundleName,
"abilityName": abilityName,
}
globalThis.abilityContext.startAbility(str, (err, data) => {
if(err) {
return;
}
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( time < 1000 ) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n' + `输入键盘弹出时延:` + this.time + 'ms' )
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
time: $time
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Experience/KeyboardInputTest.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir;
let Xpath = path + '/ResponseTimeKeyboard.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'KeyboardInput';
@State StepTips: string = '操作步骤:根据操作提示点击键盘按键'+'\n'+'预期结果:键盘输入响应时延低于150ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State time: string = '0';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n')
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入信息` + '\n' + '\n' +'2.新建一条信息点击输入框打开键盘'+ '\n' + '\n'
+ `3.双击执行.bat选择响应时延>键盘按键输入`+ '\n' + '\n' +`4.随意点击按键等待响应` + '\n' + '\n'
+ '5.待脚本执行结束回到Validator点击停止键' + '\n' + '\n' + `6.若按键响应时延小于或等于150ms则通过测试`
+ '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.StartEnable = !this.StartEnable;
let bundleName=new String("com.ohos.mms").toString();
let abilityName=new String("com.ohos.mms.MainAbility").toString();
let str = {
"bundleName": bundleName,
"abilityName": abilityName,
}
globalThis.abilityContext.startAbility(str, (err, data) => {
if(err) {
return;
}
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( time < 150 ) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n' + `按键响应时延:` + this.time + 'ms' )
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
time: $time
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Experience/PhotoFps.ets
浏览文件 @
b0dc057d
...
...
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/ExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
...
...
@@ -43,7 +42,7 @@ struct CustomContainerUser {
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.在图库中预置500张图片`+ '\n' + '\n' +`2.点击开始键进入图库`+ '\n' + '\n'
+ `3.双击执行
PhotoFps.bat
`+ '\n' + '\n' +`4.滑动图库缩略图界面连续10s以上` + '\n' + '\n'
+ `3.双击执行
.bat选择帧率>图库
`+ '\n' + '\n' +`4.滑动图库缩略图界面连续10s以上` + '\n' + '\n'
+ '5.回到PhotoFps测试项点击停止键' + '\n' + '\n' + `6.若测试最高帧率大于或等于54帧则通过测试`
+ '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
...
...
@@ -63,7 +62,6 @@ struct CustomContainerUser {
let str = {
"bundleName": bundleName,
"abilityName": abilityName,
"parameters": ""
}
globalThis.abilityContext.startAbility(str, (err, data) => {
...
...
@@ -86,11 +84,26 @@ struct CustomContainerUser {
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(':');
let headList = new Array();
let endList = new Array();
let head = report.indexOf(":");
let end = report.indexOf('|');
this.Fps = report.substring(head+1,end);
let num = Number(this.Fps)
if(num >= 54) {
let Fps = new Array();
while(head > -1){
headList.push(head);
head = report.indexOf(":",head + 1);
}
while(end > -1){
endList.push(end);
end = report.indexOf("|",end + 1);
}
for(let i = 0; i < headList.length; i++) {
Fps[i] = Number(report.substring(headList[i]+1,endList[i]));
}
let maxFps = Math.max(...Fps);
this.Fps = maxFps.toString();
if(maxFps >= 54) {
this.Vue = true;
}
})
...
...
validator/acts_validator/src/main/ets/pages/Experience/ScrollListTest.ets
已删除
100644 → 0
浏览文件 @
a56dd44f
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {CustomContainer} from '../common/CustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct CustomContainerUser {
private listArr: number[] = Array.from(new Array(50).keys());
@State name: string = 'ScrollingList';
@State StepTips: string = '操作步骤:滑动列表观察是否能正常滑动'+'\n'+'预期结果:列表滑动正常';
@State Vue: boolean = false;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = true;
}
@Builder specificNoParam() {
Column() {
List() {
ForEach(this.listArr,(item:any,index:number) => {
ListItem() {
Text('Item #' + (index + 1)).width('100%').height(50).fontSize(16).fontColor(Color.White).margin({left:'10vp'})
}
},index => index)
}.height('100%').width('100%').divider({strokeWidth:1,color:Color.Grey})
}.height('83%').width('100%')
}
build() {
Column() {
CustomContainer({
title: this.name,
Url: 'pages/Experience/Experience_index',
StepTips: this.StepTips,
content: this.specificNoParam.bind(this),
name: $name,
Vue: $Vue,
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
validator/acts_validator/src/main/ets/pages/Experience/ScrollPhotosList.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir;
let Xpath = path + '/ResponseTimePhotos.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'ScrollPhotosList';
@State StepTips: string = '操作步骤:根据操作提示滑动图库缩略表'+'\n'+'预期结果:滑动响应时延低于150ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State time: string = '0';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n')
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.在图库中预置500张图片`+ '\n' + '\n' +`2.点击开始键进入图库`+ '\n' + '\n'
+ `3.双击执行.bat选择响应时延>图库缩略列表滑动`+ '\n' + '\n' +`4.滑动图库缩略列表等待响应` + '\n' + '\n'
+ '5.待脚本执行结束回到Validator点击停止键' + '\n' + '\n' + `6.若滑动响应时延小于或等于150ms则通过测试`
+ '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.StartEnable = !this.StartEnable;
let bundleName=new String("com.ohos.photos").toString();
let abilityName=new String("com.ohos.photos.MainAbility").toString();
let str = {
"bundleName": bundleName,
"abilityName": abilityName,
}
globalThis.abilityContext.startAbility(str, (err, data) => {
if(err) {
return;
}
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( time < 150 ) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n' + `滑动响应时延:` + this.time + 'ms' )
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
time: $time
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Experience/StartBackgroundTask.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let Xpath = path + '/CompleteTimeLauncher.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'StartBackgroundTask';
@State StepTips: string = '操作步骤:根据操作提示打开后台任务'+'\n'+'预期结果:打开后台任务时延低于600ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State time: string = '0';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n')
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.点击开始键进入桌面开启任务管理器` + '\n' + '\n' + `2.双击执行.bat选择完成时延>后台任务切换`+
'\n' + '\n' +`3.随意点开一个后台任务` + '\n' + '\n' + '4.待脚本执行结束回到Validator点击停止键'
+ '\n' + '\n' + `5.若打开后台任务时延小于或等于600ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
}
abilityContext.startAbility(str).then((data) => {
}).catch((error) => {
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( time < 600 ) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n' + `打开后台任务时延:` + this.time + 'ms' )
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
time: $time
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Experience/StartNotification.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let Xpath = path + '/ResponseTimeLauncher.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'StartNotification';
@State StepTips: string = '操作步骤:根据操作提示下拉通知栏'+'\n'+'预期结果:下拉通知栏时延低于150ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State time: string = '0';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n')
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.点击开始键进入桌面` + '\n' + '\n' + `2.双击执行.bat选择响应时延>下拉状态栏`+
'\n' + '\n' +`3.从屏幕顶部滑动下拉通知栏` + '\n' + '\n' + '4.待脚本执行结束回到Validator点击停止键'
+ '\n' + '\n' + `5.若下拉通知栏时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
}
abilityContext.startAbility(str).then((data) => {
}).catch((error) => {
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( time < 150 ) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n' + `下拉通知栏时延:` + this.time + 'ms' )
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
time: $time
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Experience/StartTaskManager.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let Xpath = path + '/CompleteTimeLauncher.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'StartTaskManager';
@State StepTips: string = '操作步骤:根据操作提示打开任务管理器'+'\n'+'预期结果:打开任务管理器时延低于1000ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State time: string = '0';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n')
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.点击开始键进入桌面` + '\n' + '\n' + `2.双击执行.bat选择完成时延>启动任务管理器`+
'\n' + '\n' +`3.点击右下角方框开启任务管理器` + '\n' + '\n' + '4.待脚本执行结束回到Validator点击停止键'
+ '\n' + '\n' + `5.若启动任务管理器时延小于或等于1000ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
}
abilityContext.startAbility(str).then((data) => {
}).catch((error) => {
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( time < 1000 ) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n' + `启动任务管理器时延:` + this.time + 'ms' )
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
time: $time
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Experience/ViewPhotoTest.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir;
let Xpath = path + '/ResponseTimePhotos.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'ViewPhoto';
@State StepTips: string = '操作步骤:根据操作提示点击图片等待加载'+'\n'+'预期结果:图片响应时延低于150ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State time: string = '0';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n')
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.在图库中预置500张图片`+ '\n' + '\n' +`2.点击开始键进入图库`+ '\n' + '\n'
+ `3.双击执行.bat选择响应时延>查看图片`+ '\n' + '\n' +`4.点击一张图库缩略图等待响应` + '\n' + '\n'
+ '5.待脚本执行结束回到Validator点击停止键' + '\n' + '\n' + `6.若图片响应时延小于或等于150ms则通过测试`
+ '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.StartEnable = !this.StartEnable;
let bundleName=new String("com.ohos.photos").toString();
let abilityName=new String("com.ohos.photos.MainAbility").toString();
let str = {
"bundleName": bundleName,
"abilityName": abilityName,
}
globalThis.abilityContext.startAbility(str, (err, data) => {
if(err) {
return;
}
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( time < 150 ) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n' + `图片响应时延:` + this.time + 'ms' )
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
time: $time
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Player/Player_index.ets
浏览文件 @
b0dc057d
...
...
@@ -270,30 +270,29 @@ struct IndexPage {
}
let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString();
let ignoreNum = (24-TestNum).toString();
let arrayBuffer = new ArrayBuffer(40960);
let bufView = new DataView(arrayBuffer);
let serializer = new xml.XmlSerializer(bufView);
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name","ActsPlayerTest");
serializer.setAttributes("time", "");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", testNum);
serializer.setAttributes("message", "");
serializer.setAttributes("message", "
*
");
serializer.setAttributes("modulename", "ActsPlayerTest");
for (let i = 0; i < title.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title[i]));
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("status", "
*
");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("classname", "
*
");
serializer.setAttributes("result", String(result[i]));
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.setAttributes("level", "
*
");
serializer.setAttributes("message", "
*
");
serializer.endElement();
}
serializer.endElement();
...
...
validator/acts_validator/src/main/ets/pages/common/CameraOrientation.ets
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022
-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
...
...
validator/acts_validator/src/main/ets/pages/common/ExperienceCustomContainer.ets
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022
-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
...
...
validator/acts_validator/src/main/ets/pages/common/StartExperienceCustomContainer.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 prompt from '@ohos.prompt';
import fileio from '@ohos.fileio';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
let path = globalThis.dir;
const TAG = '[Screenshot]';
@Component
export struct CustomContainer {
@Link name : string;
title : string = '';
StepTips: string = '';
Url : string = '';
@Link StartEnable : boolean
@Link Vue : boolean;
@Link num : number;
@Link setNum : number;
@Link photosNum : number;
@Link mmsNum : number;
@Link cameraNum : number;
@Link contactsNum : number;
@BuilderParam content: () => void;
@Builder
PassBtn(text: Resource, isFullScreen: boolean) {
if(this.Vue == false){
Button({stateEffect:this.Vue}) {
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey).opacity(0.4)
.onClick(()=>{
})
}
else{
Button({stateEffect:this.Vue}) {
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'Pass', title : this.name,
}
})
this.getScreen(isFullScreen);
prompt.showToast({
message: '通过', duration: 1000
});
})
}
}
@Builder
FailBtn(text: Resource, isFullScreen: boolean) {
Button(){
Image($r('app.media.ic_public_fail')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'Fail',title : this.name,
}
})
this.getScreen(isFullScreen);
prompt.showToast({
message: '失败', duration: 1000
});
})
}
build() {
Column() {
Row() {
Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'None',}
})
})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content();
Blank()
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true);
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(() =>{
AlertDialog.show({
title:'操作提示',
message: this.StepTips,
confirm:{
value:'OK',
action:()=>{
}
}
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true);
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`);
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
};
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release();
try {
await fileio.write(fd, arrayBuffer);
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`);
}
await fileio.close(fd);
Logger.info(TAG, `write done`);
}
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
screenRect: { left: 0, top: 0, width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
displayId: 0
};
if (isFullScreen) {
screenshotOptions = {
rotation: 0
}
}
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`);
}
Logger.info(TAG, 'save callback');
this.savePicture(data, getContext(this) as any);
})
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`);
}
}
}
validator/acts_validator/src/main/ets/pages/common/TimeExperienceCustomContainer.ets
0 → 100644
浏览文件 @
b0dc057d
/*
* Copyright (c) 2022-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 prompt from '@ohos.prompt';
import fileio from '@ohos.fileio';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
let path = globalThis.dir;
const TAG = '[Screenshot]';
@Component
export struct CustomContainer {
@Link name : string;
title : string = '';
StepTips: string = '';
Url : string = '';
@Link StartEnable : boolean
@Link Vue : boolean;
@Link time : string;
@BuilderParam content: () => void;
@Builder
PassBtn(text: Resource, isFullScreen: boolean) {
if(this.Vue == false){
Button({stateEffect:this.Vue}) {
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey).opacity(0.4)
.onClick(()=>{
})
}
else{
Button({stateEffect:this.Vue}) {
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'Pass', title : this.name,
}
})
this.getScreen(isFullScreen);
prompt.showToast({
message: '通过', duration: 1000
});
})
}
}
@Builder
FailBtn(text: Resource, isFullScreen: boolean) {
Button(){
Image($r('app.media.ic_public_fail')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'Fail',title : this.name,
}
})
this.getScreen(isFullScreen);
prompt.showToast({
message: '失败', duration: 1000
});
})
}
build() {
Column() {
Row() {
Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'None',}
})
})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content();
Blank()
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true);
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(() =>{
AlertDialog.show({
title:'操作提示',
message: this.StepTips,
confirm:{
value:'OK',
action:()=>{
}
}
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true);
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`);
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
};
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release();
try {
await fileio.write(fd, arrayBuffer);
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`);
}
await fileio.close(fd);
Logger.info(TAG, `write done`);
}
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
screenRect: { left: 0, top: 0, width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
displayId: 0
};
if (isFullScreen) {
screenshotOptions = {
rotation: 0
}
}
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`);
}
Logger.info(TAG, 'save callback');
this.savePicture(data, getContext(this) as any);
})
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`);
}
}
}
validator/acts_validator/src/main/ets/pages/index.ets
浏览文件 @
b0dc057d
...
...
@@ -323,7 +323,6 @@ struct IndexPage {
}
let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString();
let ignoreNum = (54-TestNum).toString();
/*
* ArkUI
*/
...
...
@@ -343,8 +342,7 @@ struct IndexPage {
ArkUIPassIndex = ArkUIReport.indexOf('Pass',ArkUIPassIndex + 1);
}
let ArkUITestNum = ArkUIFailNum + ArkUIPassNum;
let ArkuiTestNum = (ArkUIPassNum).toString();
let ArkUIIgnoreNum = (23-ArkUITestNum).toString();
let ArkuiTestNum = (ArkUITestNum).toString();
/*
* Audio
*/
...
...
@@ -364,8 +362,7 @@ struct IndexPage {
AudioPassIndex = AudioReport.indexOf('Pass',AudioPassIndex + 1);
}
let AudioTestNum = AudioFailNum + AudioPassNum;
let audioTestNum = (AudioPassNum).toString();
let AudioIgnoreNum = (28-AudioTestNum).toString();
let audioTestNum = (AudioTestNum).toString();
/*
* Camera
*/
...
...
@@ -385,8 +382,7 @@ struct IndexPage {
CameraPassIndex = CameraReport.indexOf('Pass',CameraPassIndex + 1);
}
let CameraTestNum = CameraFailNum + CameraPassNum;
let cameraTestNum = (CameraPassNum).toString();
let CameraIgnoreNum = (28-CameraTestNum).toString();
let cameraTestNum = (CameraTestNum).toString();
/*
* Player
*/
...
...
@@ -406,8 +402,7 @@ struct IndexPage {
PlayerPassIndex = PlayerReport.indexOf('Pass',PlayerPassIndex + 1);
}
let PlayerTestNum = PlayerFailNum + PlayerPassNum;
let playerTestNum = (PlayerPassNum).toString();
let PlayerIgnoreNum = (28-PlayerTestNum).toString();
let playerTestNum = (PlayerTestNum).toString();
/*
* Experience
*/
...
...
@@ -427,8 +422,7 @@ struct IndexPage {
ExperiencePassIndex = ExperienceReport.indexOf('Pass',ExperiencePassIndex + 1);
}
let ExperienceTestNum = ExperienceFailNum + ExperiencePassNum;
let experienceTestNum = (ExperiencePassNum).toString();
let ExperienceIgnoreNum = (28-ExperienceTestNum).toString();
let experienceTestNum = (ExperienceTestNum).toString();
let arrayBuffer = new ArrayBuffer(40960);
let bufView = new DataView(arrayBuffer);
...
...
@@ -445,30 +439,30 @@ struct IndexPage {
serializer.setAttributes("ignored", "0");
serializer.setAttributes("unavailable", "0");
serializer.setAttributes("productinfo", "{ }");
serializer.setAttributes("modules", "");
serializer.setAttributes("runmodules", "");
serializer.setAttributes("modules", "
*
");
serializer.setAttributes("runmodules", "
*
");
/*
* ArkUI
*/
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsArkUITest");
serializer.setAttributes("time", "");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", ArkuiFailNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", ArkuiTestNum);
serializer.setAttributes("message", "");
serializer.setAttributes("message", "
*
");
serializer.setAttributes("modulename", "ActsArkUITest");
for (let i = 0; i < title1.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title1[i]));
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("status", "
*
");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("classname", "
*
");
serializer.setAttributes("result", String(result1[i]));
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.setAttributes("level", "
*
");
serializer.setAttributes("message", "
*
");
serializer.endElement();
}
serializer.endElement();
...
...
@@ -477,23 +471,23 @@ struct IndexPage {
*/
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsAudioTest");
serializer.setAttributes("time", "");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", audioFailNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", audioTestNum);
serializer.setAttributes("message", "");
serializer.setAttributes("message", "
*
");
serializer.setAttributes("modulename", "ActsAudioTest");
for (let i = 0; i < title2.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title2[i]));
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("status", "
*
");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("classname", "
*
");
serializer.setAttributes("result", String(result2[i]));
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.setAttributes("level", "
*
");
serializer.setAttributes("message", "
*
");
serializer.endElement();
}
serializer.endElement();
...
...
@@ -502,23 +496,23 @@ struct IndexPage {
*/
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsCameraTest");
serializer.setAttributes("time", "");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", cameraFailNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", cameraTestNum);
serializer.setAttributes("message", "");
serializer.setAttributes("message", "
*
");
serializer.setAttributes("modulename", "ActsCameraTest");
for (let i = 0; i < title2.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title3[i]));
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("status", "
*
");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("classname", "
*
");
serializer.setAttributes("result", String(result3[i]));
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.setAttributes("level", "
*
");
serializer.setAttributes("message", "
*
");
serializer.endElement();
}
serializer.endElement();
...
...
@@ -527,23 +521,23 @@ struct IndexPage {
*/
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsPlayerTest");
serializer.setAttributes("time", "");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", playerFailNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", playerTestNum);
serializer.setAttributes("message", "");
serializer.setAttributes("message", "
*
");
serializer.setAttributes("modulename", "ActsPlayerTest");
for (let i = 0; i < title2.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title4[i]));
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("status", "
*
");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("classname", "
*
");
serializer.setAttributes("result", String(result4[i]));
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.setAttributes("level", "
*
");
serializer.setAttributes("message", "
*
");
serializer.endElement();
}
serializer.endElement();
...
...
@@ -552,23 +546,23 @@ struct IndexPage {
*/
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsExperienceTest");
serializer.setAttributes("time", "");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", experienceFailNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", experienceTestNum);
serializer.setAttributes("message", "");
serializer.setAttributes("message", "
*
");
serializer.setAttributes("modulename", "ActsExperienceTest");
for (let i = 0; i < title2.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title5[i]));
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("status", "
*
");
serializer.setAttributes("time", "
*
");
serializer.setAttributes("classname", "
*
");
serializer.setAttributes("result", String(result5[i]));
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.setAttributes("level", "
*
");
serializer.setAttributes("message", "
*
");
serializer.endElement();
}
serializer.endElement();
...
...
validator/acts_validator/src/main/resources/base/profile/main_pages.json
浏览文件 @
b0dc057d
...
...
@@ -15,7 +15,6 @@
"pages/ArkUI/CanvasStrokeStyle"
,
"pages/ArkUI/CanvasLineCap"
,
"pages/ArkUI/CanvasLineJoin"
,
"pages/ArkUI/CanvasMiterLimit"
,
"pages/ArkUI/CanvasFont"
,
"pages/ArkUI/CanvasTextAlign"
,
"pages/ArkUI/CanvasTextBaseline"
,
...
...
@@ -27,10 +26,6 @@
"pages/ArkUI/CanvasLineDashOffset"
,
"pages/ArkUI/CanvasShadowOffsetY"
,
"pages/Camera/Camera_index"
,
"pages/Camera/CameraOrientation0"
,
"pages/Camera/CameraOrientation90"
,
"pages/Camera/CameraOrientation180"
,
"pages/Camera/CameraOrientation270"
,
"pages/Camera/CameraFormat"
,
"pages/Camera/CameraVideo"
,
"pages/Audio/Audio_index"
,
...
...
@@ -39,6 +34,15 @@
"pages/Player/ScrollListTest"
,
"pages/Experience/Experience_index"
,
"pages/Experience/PhotoFps"
,
"pages/Experience/DeskFps"
"pages/Experience/DeskFps"
,
"pages/Experience/ColdStartTest"
,
"pages/Experience/HotStartTest"
,
"pages/Experience/ViewPhotoTest"
,
"pages/Experience/KeyboardDisplayTest"
,
"pages/Experience/StartTaskManager"
,
"pages/Experience/StartBackgroundTask"
,
"pages/Experience/StartNotification"
,
"pages/Experience/ScrollPhotosList"
,
"pages/Experience/KeyboardInputTest"
]
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录