diff --git a/arkui/ace_standard_video/BUILD.gn b/arkui/ace_standard_video/BUILD.gn
index 15647634299b0e0443e5f557c53b0d65501bedac..08344f104adf8fbc11bc4a7297adba71e2c3e2e7 100644
--- a/arkui/ace_standard_video/BUILD.gn
+++ b/arkui/ace_standard_video/BUILD.gn
@@ -23,7 +23,9 @@ ohos_js_hap_suite("ActsAceStandardVideoTest") {
hap_name = "ActsAceStandardVideoTest"
}
ohos_js_assets("ace_js_assets") {
- source_dir = "./src/main/js/default"
+ js2abc = true
+ hap_profile = "./src/main/config.json"
+ source_dir = "./src/main/js"
}
ohos_resources("ace_resources") {
sources = [ "./src/main/resources" ]
diff --git a/arkui/ace_standard_video/Test.json b/arkui/ace_standard_video/Test.json
index 753369bc1908dad46741d5189a748064f2e76970..4a81904557a3a3b2acbdc4401ef223bf3c1f8638 100644
--- a/arkui/ace_standard_video/Test.json
+++ b/arkui/ace_standard_video/Test.json
@@ -1,18 +1,19 @@
-{
- "description": "Configuration for acevideo Tests",
- "driver": {
- "type": "JSUnitTest",
- "test-timeout": "1000000",
- "package": "com.example.acevideo",
- "shell-timeout": "30000"
- },
- "kits": [
- {
- "test-file-name": [
- "ActsAceStandardVideoTest.hap"
- ],
- "type": "AppInstallKit",
- "cleanup-apps": true
- }
- ]
-}
+{
+ "description": "Configuration for acevideo Tests",
+ "driver": {
+ "type": "OHJSUnitTest",
+ "test-timeout": "1000000",
+ "shell-timeout": "1000000",
+ "bundle-name": "com.example.acevideo",
+ "package-name": "com.example.acevideo"
+ },
+ "kits": [
+ {
+ "test-file-name": [
+ "ActsAceStandardVideoTest.hap"
+ ],
+ "type": "AppInstallKit",
+ "cleanup-apps": true
+ }
+ ]
+}
\ No newline at end of file
diff --git a/arkui/ace_standard_video/src/main/config.json b/arkui/ace_standard_video/src/main/config.json
index f23be60dcc2c0864a6efbf9b355b8d10cd8ecd4b..01b6944c017ae7e49df8857eac1280d7141efc9c 100644
--- a/arkui/ace_standard_video/src/main/config.json
+++ b/arkui/ace_standard_video/src/main/config.json
@@ -1,66 +1,97 @@
-{
- "app": {
- "bundleName": "com.example.acevideo",
- "vendor": "example",
- "version": {
- "code": 1000000,
- "name": "1.0.0"
- },
- "apiVersion": {
- "compatible": 4,
- "target": 8
- }
- },
- "deviceConfig": {},
- "module": {
- "package": "com.example.acevideo",
- "name": ".MyApplication",
- "mainAbility": "com.example.acevideo.MainAbility",
- "deviceType": [
- "phone"
- ],
- "distro": {
- "deliveryWithInstall": true,
- "moduleName": "entry",
- "moduleType": "entry",
- "installationFree": false
- },
- "abilities": [
- {
- "skills": [
- {
- "entities": [
- "entity.system.home"
- ],
- "actions": [
- "action.system.home"
- ]
- }
- ],
- "name": "com.example.acevideo.MainAbility",
- "icon": "$media:icon",
- "description": "$string:mainability_description",
- "label": "$string:entry_MainAbility",
- "type": "page",
- "launchType": "standard",
- "visible": true,
- "configChanges": ["orientation"]
- }
- ],
- "js": [
- {
- "pages": [
- "pages/index/index",
- "pages/routerPush/index",
- "pages/routerReplace/index",
- "pages/video/router/index"
- ],
- "name": "default",
- "window": {
- "designWidth": 720,
- "autoDesignWidth": true
- }
- }
- ]
- }
+{
+ "app": {
+ "bundleName": "com.example.acevideo",
+ "vendor": "example",
+ "version": {
+ "code": 1000000,
+ "name": "1.0.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 8
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.example.acevideo",
+ "name": ".entry",
+ "mainAbility": ".MainAbility",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry",
+ "moduleType": "entry",
+ "installationFree": false
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".MainAbility",
+ "srcLanguage": "js",
+ "srcPath": "MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:MainAbility_desc",
+ "label": "$string:MainAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ },
+ {
+ "orientation": "unspecified",
+ "formsEnabled": false,
+ "name": ".TestAbility",
+ "srcLanguage": "js",
+ "srcPath": "TestAbility",
+ "icon": "$media:icon",
+ "description": "$string:TestAbility_desc",
+ "label": "$string:TestAbility_label",
+ "type": "page",
+ "visible": true,
+ "launchType": "standard"
+ }
+ ],
+ "js": [
+ {
+ "pages": [
+ "pages/index/index",
+ "pages/routerPush/index",
+ "pages/routerReplace/index",
+ "pages/video/router/index"
+ ],
+ "name": "default",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": true
+ }
+ },
+ {
+ "pages": [
+ "pages/index/index"
+ ],
+ "name": ".TestAbility",
+ "window": {
+ "designWidth": 720,
+ "autoDesignWidth": false
+ }
+ }
+ ],
+ "testRunner": {
+ "name": "OpenHarmonyTestRunner",
+ "srcPath": "TestRunner"
+ },
+ "srcPath": ""
+ }
}
\ No newline at end of file
diff --git a/arkui/ace_standard_video/src/main/js/MainAbility/app.js b/arkui/ace_standard_video/src/main/js/MainAbility/app.js
new file mode 100644
index 0000000000000000000000000000000000000000..d31b70c1edc2455c5f5cef023f72cfe10146335e
--- /dev/null
+++ b/arkui/ace_standard_video/src/main/js/MainAbility/app.js
@@ -0,0 +1,32 @@
+/*
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+import { Hypium } from '@ohos/hypium'
+import testsuite from '../test/List.test'
+
+export default {
+ onCreate() {
+ console.info('TestApplication onCreate')
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ console.info('start run testcase!!!')
+ Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
+ },
+ onDestroy() {
+ console.info("TestApplication onDestroy");
+ }
+};
+
diff --git a/arkui/ace_standard_video/src/main/js/default/common/images/icon.png b/arkui/ace_standard_video/src/main/js/MainAbility/common/images/icon.png
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/common/images/icon.png
rename to arkui/ace_standard_video/src/main/js/MainAbility/common/images/icon.png
diff --git a/arkui/ace_standard_video/src/main/js/default/common/images/video.mp4 b/arkui/ace_standard_video/src/main/js/MainAbility/common/images/video.mp4
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/common/images/video.mp4
rename to arkui/ace_standard_video/src/main/js/MainAbility/common/images/video.mp4
diff --git a/arkui/ace_standard_video/src/main/js/default/i18n/en-US.json b/arkui/ace_standard_video/src/main/js/MainAbility/i18n/en-US.json
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/i18n/en-US.json
rename to arkui/ace_standard_video/src/main/js/MainAbility/i18n/en-US.json
diff --git a/arkui/ace_standard_video/src/main/js/default/i18n/zh-CN.json b/arkui/ace_standard_video/src/main/js/MainAbility/i18n/zh-CN.json
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/i18n/zh-CN.json
rename to arkui/ace_standard_video/src/main/js/MainAbility/i18n/zh-CN.json
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/index/index.css b/arkui/ace_standard_video/src/main/js/MainAbility/pages/index/index.css
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/pages/index/index.css
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/index/index.css
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/index/index.hml b/arkui/ace_standard_video/src/main/js/MainAbility/pages/index/index.hml
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/pages/index/index.hml
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/index/index.hml
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/index/index.js b/arkui/ace_standard_video/src/main/js/MainAbility/pages/index/index.js
similarity index 77%
rename from arkui/ace_standard_video/src/main/js/default/pages/index/index.js
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/index/index.js
index 85e6f5c11ac3579452bf2fba708d6db155cbe3da..02d763c7d3de561e3ea5a2429f9e7b6065b6ef01 100644
--- a/arkui/ace_standard_video/src/main/js/default/pages/index/index.js
+++ b/arkui/ace_standard_video/src/main/js/MainAbility/pages/index/index.js
@@ -1,43 +1,34 @@
-/**
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 {Core, ExpectExtend} from 'deccjsunit/index'
-
-const injectRef = Object.getPrototypeOf(global) || global
-injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
-
-export default {
- data: {
- title: ""
- },
- onInit() {
- console.info('[test page log] index onInit')
- this.title = this.$t('strings.world');
- const core = Core.getInstance()
- const expectExtend = new ExpectExtend({
- 'id': 'extend'
- })
- core.addService('expect', expectExtend)
- core.init()
- require('../../test/List.test')
- core.execute()
- },
- onShow() {
- console.info('[test page log] index onShow')
- },
- onHide() {
- console.info('[test page log] index onHide')
- },
-}
+/**
+ * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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.
+ */
+
+
+const injectRef = Object.getPrototypeOf(global) || global
+injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ console.info('[test page log] index onInit')
+ this.title = this.$t('strings.world');
+ },
+ onShow() {
+ console.info('[test page log] index onShow')
+ },
+ onHide() {
+ console.info('[test page log] index onHide')
+ },
+}
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/routerPush/index.css b/arkui/ace_standard_video/src/main/js/MainAbility/pages/routerPush/index.css
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/pages/routerPush/index.css
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/routerPush/index.css
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/routerPush/index.hml b/arkui/ace_standard_video/src/main/js/MainAbility/pages/routerPush/index.hml
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/pages/routerPush/index.hml
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/routerPush/index.hml
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/routerPush/index.js b/arkui/ace_standard_video/src/main/js/MainAbility/pages/routerPush/index.js
similarity index 97%
rename from arkui/ace_standard_video/src/main/js/default/pages/routerPush/index.js
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/routerPush/index.js
index 66890b58fcd042af32a95e0456fe13ded19a5150..0d4563c158314fa216f40b201cbfb4873c728178 100644
--- a/arkui/ace_standard_video/src/main/js/default/pages/routerPush/index.js
+++ b/arkui/ace_standard_video/src/main/js/MainAbility/pages/routerPush/index.js
@@ -1,26 +1,26 @@
-/**
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 {
- data: {
- title: "router push test"
- },
- onShow() {
- console.info('[test page log] routerPush onShow');
- },
- onHide() {
- console.info('[test page log] routerPush ohHide');
- },
-}
+/**
+ * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 {
+ data: {
+ title: "router push test"
+ },
+ onShow() {
+ console.info('[test page log] routerPush onShow');
+ },
+ onHide() {
+ console.info('[test page log] routerPush ohHide');
+ },
+}
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/routerReplace/index.css b/arkui/ace_standard_video/src/main/js/MainAbility/pages/routerReplace/index.css
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/pages/routerReplace/index.css
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/routerReplace/index.css
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/routerReplace/index.hml b/arkui/ace_standard_video/src/main/js/MainAbility/pages/routerReplace/index.hml
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/pages/routerReplace/index.hml
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/routerReplace/index.hml
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/routerReplace/index.js b/arkui/ace_standard_video/src/main/js/MainAbility/pages/routerReplace/index.js
similarity index 97%
rename from arkui/ace_standard_video/src/main/js/default/pages/routerReplace/index.js
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/routerReplace/index.js
index f1e5072e0a09d7efd6efbdb828ddbb936e69e58e..036c2a5198f6525971970c6b004e16cdbf67a869 100644
--- a/arkui/ace_standard_video/src/main/js/default/pages/routerReplace/index.js
+++ b/arkui/ace_standard_video/src/main/js/MainAbility/pages/routerReplace/index.js
@@ -1,26 +1,26 @@
-/**
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 {
- data: {
- title: "router replace test"
- },
- onShow() {
- console.info('[test page log] routerReplace onShow');
- },
- onHide() {
- console.info('[test page log] routerReplace ohHide');
- },
-}
+/**
+ * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 {
+ data: {
+ title: "router replace test"
+ },
+ onShow() {
+ console.info('[test page log] routerReplace onShow');
+ },
+ onHide() {
+ console.info('[test page log] routerReplace ohHide');
+ },
+}
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/video/router/index.css b/arkui/ace_standard_video/src/main/js/MainAbility/pages/video/router/index.css
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/pages/video/router/index.css
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/video/router/index.css
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/video/router/index.hml b/arkui/ace_standard_video/src/main/js/MainAbility/pages/video/router/index.hml
similarity index 100%
rename from arkui/ace_standard_video/src/main/js/default/pages/video/router/index.hml
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/video/router/index.hml
diff --git a/arkui/ace_standard_video/src/main/js/default/pages/video/router/index.js b/arkui/ace_standard_video/src/main/js/MainAbility/pages/video/router/index.js
similarity index 97%
rename from arkui/ace_standard_video/src/main/js/default/pages/video/router/index.js
rename to arkui/ace_standard_video/src/main/js/MainAbility/pages/video/router/index.js
index b162d0f9977a9da3b4712ae64adbecf7f82af64f..e8f760c5b7c1fe0976aa9dd6db85f823cca83bbd 100644
--- a/arkui/ace_standard_video/src/main/js/default/pages/video/router/index.js
+++ b/arkui/ace_standard_video/src/main/js/MainAbility/pages/video/router/index.js
@@ -1,51 +1,51 @@
-/**
- * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 {
- data: {
- event:'',
- seekingtime:'',
- timeupdatetime:'',
- seekedtime:'',
- isStart: true,
- isfullscreenchange: false,
- duration: '',
- },
- preparedCallback:function(e){this.event = '视频连接成功'; this.duration = e.duration;},
- startCallback:function(){this.event = '视频开始播放';},
- pauseCallback:function(){this.event = '视频暂停播放';},
- finishCallback:function(){this.event = '视频播放结束';},
- errorCallback:function(){this.event = '视频播放错误';},
- seekingCallback:function(e){this.seekingtime = e.currenttime;},
- timeupdateCallback:function(e){this.timeupdatetime = e.currenttime;},
- changeStartPause: function() {
- if(this.isStart) {
- this.$element('videoId').pause();
- this.isStart = false;
- } else {
- this.$element('videoId').start();
- this.isStart = true;
- }
- },
- changeFullScreenChange: function() {//全屏
- if(!this.isfullscreenchange) {
- this.$element('videoId').requestFullscreen({ screenOrientation : 'default' });
- this.isfullscreenchange = true;
- } else {
- this.$element('videoId').exitFullscreen();
- this.isfullscreenchange = false;
- }
- }
-}
+/**
+ * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 {
+ data: {
+ event:'',
+ seekingtime:'',
+ timeupdatetime:'',
+ seekedtime:'',
+ isStart: true,
+ isfullscreenchange: false,
+ duration: '',
+ },
+ preparedCallback:function(e){this.event = '视频连接成功'; this.duration = e.duration;},
+ startCallback:function(){this.event = '视频开始播放';},
+ pauseCallback:function(){this.event = '视频暂停播放';},
+ finishCallback:function(){this.event = '视频播放结束';},
+ errorCallback:function(){this.event = '视频播放错误';},
+ seekingCallback:function(e){this.seekingtime = e.currenttime;},
+ timeupdateCallback:function(e){this.timeupdatetime = e.currenttime;},
+ changeStartPause: function() {
+ if(this.isStart) {
+ this.$element('videoId').pause();
+ this.isStart = false;
+ } else {
+ this.$element('videoId').start();
+ this.isStart = true;
+ }
+ },
+ changeFullScreenChange: function() {//全屏
+ if(!this.isfullscreenchange) {
+ this.$element('videoId').requestFullscreen({ screenOrientation : 'default' });
+ this.isfullscreenchange = true;
+ } else {
+ this.$element('videoId').exitFullscreen();
+ this.isfullscreenchange = false;
+ }
+ }
+}
diff --git a/arkui/ace_standard_video/src/main/js/default/app.js b/arkui/ace_standard_video/src/main/js/TestAbility/app.js
similarity index 91%
rename from arkui/ace_standard_video/src/main/js/default/app.js
rename to arkui/ace_standard_video/src/main/js/TestAbility/app.js
index e423f4bce4698ec1d7dc86c3eea3990a5e7b1085..6abda63f0e61d4a957e4320291c42647eb231991 100644
--- a/arkui/ace_standard_video/src/main/js/default/app.js
+++ b/arkui/ace_standard_video/src/main/js/TestAbility/app.js
@@ -1,23 +1,22 @@
-/*
- * 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.
- */
-
-export default {
- onCreate() {
- console.info('AceApplication onCreate');
- },
- onDestroy() {
- console.info('AceApplication onDestroy');
- }
-};
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+export default {
+ onCreate() {
+ console.info('AceApplication onCreate');
+ },
+ onDestroy() {
+ console.info('AceApplication onDestroy');
+ }
+};
diff --git a/arkui/ace_standard_video/src/main/js/TestAbility/i18n/en-US.json b/arkui/ace_standard_video/src/main/js/TestAbility/i18n/en-US.json
new file mode 100644
index 0000000000000000000000000000000000000000..3cb24b374b1d919ca8eac0638f361692b603a900
--- /dev/null
+++ b/arkui/ace_standard_video/src/main/js/TestAbility/i18n/en-US.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "Hello",
+ "world": "World"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_standard_video/src/main/js/TestAbility/i18n/zh-CN.json b/arkui/ace_standard_video/src/main/js/TestAbility/i18n/zh-CN.json
new file mode 100644
index 0000000000000000000000000000000000000000..c804e32c0c3103929baca5617cdac70be11fdba1
--- /dev/null
+++ b/arkui/ace_standard_video/src/main/js/TestAbility/i18n/zh-CN.json
@@ -0,0 +1,8 @@
+{
+ "strings": {
+ "hello": "您好",
+ "world": "世界"
+ },
+ "Files": {
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_standard_video/src/main/js/TestAbility/pages/index/index.css b/arkui/ace_standard_video/src/main/js/TestAbility/pages/index/index.css
new file mode 100644
index 0000000000000000000000000000000000000000..b1bcd43387ba131cc1d30975ff7508a6f8084a4b
--- /dev/null
+++ b/arkui/ace_standard_video/src/main/js/TestAbility/pages/index/index.css
@@ -0,0 +1,30 @@
+.container {
+ display: flex;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ left: 0px;
+ top: 0px;
+ width: 100%;
+ height: 100%;
+}
+
+.title {
+ font-size: 60px;
+ text-align: center;
+ width: 100%;
+ height: 40%;
+ margin: 10px;
+}
+
+@media screen and (device-type: phone) and (orientation: landscape) {
+ .title {
+ font-size: 60px;
+ }
+}
+
+@media screen and (device-type: tablet) and (orientation: landscape) {
+ .title {
+ font-size: 100px;
+ }
+}
\ No newline at end of file
diff --git a/arkui/ace_standard_video/src/main/js/TestAbility/pages/index/index.hml b/arkui/ace_standard_video/src/main/js/TestAbility/pages/index/index.hml
new file mode 100644
index 0000000000000000000000000000000000000000..f629c71a9be857db6cdf94149652a191b9b272ea
--- /dev/null
+++ b/arkui/ace_standard_video/src/main/js/TestAbility/pages/index/index.hml
@@ -0,0 +1,5 @@
+
+
+ {{ $t('strings.hello') }} {{ title }}
+
+
diff --git a/arkui/ace_standard_video/src/main/js/default/test/List.test.js b/arkui/ace_standard_video/src/main/js/TestAbility/pages/index/index.js
similarity index 73%
rename from arkui/ace_standard_video/src/main/js/default/test/List.test.js
rename to arkui/ace_standard_video/src/main/js/TestAbility/pages/index/index.js
index b3774da2120261f69606b407dea933037536cfd3..88b083a7f6b979019d6a2c5ad20b19c5fd43286b 100644
--- a/arkui/ace_standard_video/src/main/js/default/test/List.test.js
+++ b/arkui/ace_standard_video/src/main/js/TestAbility/pages/index/index.js
@@ -1,18 +1,26 @@
-/*
- * 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.
- */
-
-require('./basicabilityapi.test.js')
-require('./mediaquery.test.js')
-require('./commonComponentJsApi.test.js')
+/*
+ * Copyright (c) 2022 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export default {
+ data: {
+ title: ""
+ },
+ onInit() {
+ this.title = this.$t('strings.world');
+ }
+}
+
+
+
diff --git a/arkui/ace_standard_video/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/arkui/ace_standard_video/src/main/js/TestRunner/OpenHarmonyTestRunner.js
new file mode 100644
index 0000000000000000000000000000000000000000..05ba5782592890d16fe15add4421c6187bae9511
--- /dev/null
+++ b/arkui/ace_standard_video/src/main/js/TestRunner/OpenHarmonyTestRunner.js
@@ -0,0 +1,59 @@
+/*
+ * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+function translateParamsToString(parameters) {
+ const keySet = new Set([
+ '-s class', '-s notClass', '-s suite', '-s itName',
+ '-s level', '-s testType', '-s size', '-s timeout',
+ '-s package', '-s dryRun'
+ ])
+ let targetParams = '';
+ for (const key in parameters) {
+ if (keySet.has(key)) {
+ targetParams += ' ' + key + ' ' + parameters[key]
+ }
+ }
+ return targetParams.trim()
+}
+
+ export default {
+ onPrepare() {
+ console.info('OpenHarmonyTestRunner OnPrepare')
+ },
+ onRun() {
+ console.log('OpenHarmonyTestRunner onRun run')
+ var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
+ var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
+
+ var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility'
+
+ var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
+ cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
+ var debug = abilityDelegatorArguments.parameters["-D"]
+ console.info('debug value : '+debug)
+ if (debug == 'true')
+ {
+ cmd += ' -D'
+ }
+ console.info('cmd : '+cmd)
+ abilityDelegator.executeShellCommand(cmd, (err, data) => {
+ console.info('executeShellCommand : err : ' + JSON.stringify(err));
+ console.info('executeShellCommand : data : ' + data.stdResult);
+ console.info('executeShellCommand : data : ' + data.exitCode);
+ })
+ }
+};
diff --git a/arkui/ace_standard_video/src/main/js/test/List.test.js b/arkui/ace_standard_video/src/main/js/test/List.test.js
new file mode 100644
index 0000000000000000000000000000000000000000..ffbd9f09b20a2d65525c79732c0262be84a3427c
--- /dev/null
+++ b/arkui/ace_standard_video/src/main/js/test/List.test.js
@@ -0,0 +1,23 @@
+/*
+ * 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 basicabilityapi from './basicabilityapi.test.js'
+import mediaquery_vioTest from './mediaquery.test.js'
+import aceJsTest from './commonComponentJsApi.test.js'
+export default function testsuite() {
+basicabilityapi()
+mediaquery_vioTest()
+aceJsTest()
+}
diff --git a/arkui/ace_standard_video/src/main/js/default/test/basicabilityapi.test.js b/arkui/ace_standard_video/src/main/js/test/basicabilityapi.test.js
similarity index 96%
rename from arkui/ace_standard_video/src/main/js/default/test/basicabilityapi.test.js
rename to arkui/ace_standard_video/src/main/js/test/basicabilityapi.test.js
index b901a960c2b967cfaad168a88815f28bd66c51fb..9508519de7348da7415517a954c26912c1a5e5b8 100644
--- a/arkui/ace_standard_video/src/main/js/default/test/basicabilityapi.test.js
+++ b/arkui/ace_standard_video/src/main/js/test/basicabilityapi.test.js
@@ -1,478 +1,480 @@
-/*
- * 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 configuration from '@system.configuration';
-import prompt from '@system.prompt';
-import router from '@system.router';
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
-
-describe('basicabilityapi', function () {
- let testResult;
- let testResultFail;
- let test;
- beforeAll(function () {
- testResult = true;
- testResultFail = false;
- test = "success"
- });
- beforeEach(function () {
- });
- afterEach(function () {
- });
- afterAll(function () {
- });
-
- async function backToIndex(){
- let backToIndexPromise = new Promise((resolve, reject) => {
- setTimeout(() => {
- router.back({
- uri: 'pages/index/index'
- });
- resolve();
- }, 500);
- });
- let clearPromise = new Promise((resolve, reject) => {
- setTimeout(() => {
- router.clear();
- resolve();
- }, 500);
- });
- await backToIndexPromise.then(() => {
- return clearPromise;
- });
- }
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0100
- * @tc.name testClearInterval
- * @tc.desc Cancel the repetitive timing tasks previously set by setInterval.
- */
- it('testClearInterval', 0, async function(done) {
- console.info('testClearInterval START');
- let res = 0;
- let intervalID = -1;
- let promise1 = new Promise((resolve, reject) => {
- intervalID = setInterval(function () {
- res++;
- console.info('testClearInterval res = ' + res);
- resolve();
- }, 100);
- });
- let promise2 = new Promise((resolve, reject) => {
- setTimeout(function () {
- console.info('[clearInterval] start');
- clearInterval(intervalID);
- console.info('[clearInterval] end');
- resolve();
- }, 600);
- });
- Promise.all([promise1, promise2]).then(() => {
- console.info('testClearInterval finally');
- expect(5).assertEqual(res);
- console.info('testClearInterval END');
- done();
- });
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0200
- * @tc.name testConsole
- * @tc.desc Print a text message.
- */
- it('testConsole', 0, function () {
- console.info('testConsole START');
- const versionCode = 1.1;
- console.info('[console.info] versionCode: ' + versionCode);
- console.debug('[console.debug] versionCode: ' + versionCode);
- console.log('[console.log] versionCode: ' + versionCode);
- console.warn('[console.warn] versionCode: ' + versionCode);
- console.error('[console.error] versionCode: ' + versionCode);
- expect(test).assertEqual('success');
- console.info('testConsole END');
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0300
- * @tc.name testRouterPush
- * @tc.desc Go to the specified page of the application.
- */
- it('testRouterPush', 0, async function (done) {
- console.info('testRouterPush START');
- let options = {
- uri : 'pages/routerPush/index'
- }
- let promise1 = new Promise((resolve, reject) => {
- router.push(options);
- resolve();
- });
- let promise2 = new Promise((resolve, reject) => {
- setTimeout(() => {
- let pages = router.getState();
- console.info("[router.push] getState" + JSON.stringify(pages));
- expect("pages/routerPush/").assertEqual(pages.path);
- console.info("[router.push] getLength:" + router.getLength());
- expect("2").assertEqual(router.getLength());
- console.info('testRouterPush SUCCESS');
- resolve();
- }, 500);
- });
- await promise1.then(() => {
- return promise2;
- });
- await backToIndex();
- console.info('testRouterPush END');
- done();
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0310
- * @tc.name testRouterPushNotExist
- * @tc.desc Test push not exist page.
- */
- it('testRouterPushNotExist', 0, async function (done) {
- console.info('testRouterPushNotExist START');
- let promise1 = new Promise((resolve, reject) => {
- router.push({
- uri: 'pages/routerNotExist/index'
- });
- resolve();
- });
- let promise2 = new Promise((resolve, reject) => {
- setTimeout(() => {
- let pages = router.getState();
- console.info("testRouterPushNotExist getState" + JSON.stringify(pages));
- expect("pages/index/").assertEqual(pages.path);
- console.info("testRouterPushNotExist getLength:" + router.getLength());
- expect("1").assertEqual(router.getLength());
- console.info('testRouterPushNotExist success');
- resolve();
- }, 500);
- });
- await promise1.then(() => {
- return promise2;
- });
- console.info('testRouterPushNotExist END');
- done();
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0400
- * @tc.name testRouterReplace
- * @tc.desc Replace the current page with a page in the application, and destroy the replaced page.
- */
- it('testRouterReplace', 0, async function (done) {
- //测试框架不允许index页面直接替换,需要先跳转到其他页面再替换
- console.info('testRouterReplace START');
- let options = {
- uri : 'pages/routerPush/index'
- }
- let promise1 = new Promise((resolve, reject) => {
- router.push(options);
- resolve();
- });
- let repleasePage = {
- uri : 'pages/routerReplace/index'
- }
- let promise2 = new Promise((resolve, reject) => {
- setTimeout(() => {
- router.replace(repleasePage);
- resolve();
- }, 500);
- });
- //替换堆栈数量不会变
- let promise3 = new Promise((resolve, reject) => {
- setTimeout(() => {
- let pages = router.getState();
- console.info("[router.replace] getState" + JSON.stringify(pages));
- expect("pages/routerReplace/").assertEqual(pages.path);
- console.info("[router.replace] getLength:" + router.getLength());
- expect("2").assertEqual(router.getLength());
- console.info('testRouterReplace SUCCESS');
- resolve();
- }, 1000);
- });
- await promise1.then(() => {
- return promise2;
- }).then(() => {
- return promise3;
- });
- await backToIndex();
- console.info('testRouterReplace END');
- done();
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0410
- * @tc.name testRouterReplaceNotExist
- * @tc.desc Test replace not exist page.
- */
- it('testRouterReplaceNotExist', 0, async function (done) {
- console.info('testRouterReplaceNotExist START');
- await setTimeout(() => {
- router.replace({
- uri: 'pages/routerNotExist/index'
- });
- }, 500);
- await setTimeout(() => {
- let pages = router.getState();
- console.info("testRouterReplaceNotExist getState" + JSON.stringify(pages));
- expect("pages/index/").assertEqual(pages.path);
- console.info("testRouterReplaceNotExist getLength:" + router.getLength());
- expect("1").assertEqual(router.getLength());
- console.info('testRouterReplaceNotExist END');
- done();
- }, 1000);
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0500
- * @tc.name testRouterBack
- * @tc.desc Return to the previous page or the specified page.
- */
- it('testRouterBack', 0, async function (done) {
- console.info('testRouterBack START');
- let promise1 = new Promise((resolve, reject) => {
- router.push({
- uri: 'pages/routerPush/index'
- });
- resolve();
- });
- let promise2 = new Promise((resolve, reject) => {
- setTimeout(() => {
- router.back({
- uri: 'pages/index/index'
- });
- resolve();
- }, 500);
- });
- let promise3 = new Promise((resolve, reject) => {
- setTimeout(() => {
- let pages = router.getState();
- console.info("[router.back] getState" + JSON.stringify(pages));
- expect("pages/index/").assertEqual(pages.path);
- console.info("[router.back] getLength:" + router.getLength());
- expect("1").assertEqual(router.getLength());
- console.info('testRouterBack SUCCESS');
- resolve();
- }, 1000);
- });
- await promise1.then(() => {
- return promise2;
- }).then(() => {
- return promise3;
- });
- console.info('testRouterBack END');
- done();
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0600
- * @tc.name testRouterClear
- * @tc.desc Clear all historical pages in the page stack, and only keep the current page as the top page.
- */
- it('testRouterClear', 0, function () {
- console.info('testRouterClear START');
- router.clear();
- console.info("[router.clear] router.getLength:" + router.getLength());
- expect("1").assertEqual(router.getLength());
- console.info('testRouterClear END');
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0700
- * @tc.name testRouterLength
- * @tc.desc Get the number of pages currently in the page stack.
- */
- it('testRouterLength', 0, async function (done) {
- console.info('testRouterLength START');
- let size = router.getLength();
- console.info('[router.getLength] pages stack size = ' + size);
- expect(size).assertEqual('1');
- let options = {
- uri : 'pages/routerPush/index'
- }
- let promise1 = new Promise((resolve, reject) => {
- router.push(options);
- resolve();
- });
- let promise2 = new Promise((resolve, reject) => {
- setTimeout(() => {
- console.info("testRouterLength getLength:" + router.getLength());
- expect("2").assertEqual(router.getLength());
- console.info('testRouterLength SUCCESS');
- resolve();
- }, 500);
- });
- await promise1.then(() => {
- return promise2;
- });
- await backToIndex();
- console.info('testRouterLength END');
- done();
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0800
- * @tc.name testRouterGetState
- * @tc.desc Get the status information of the current page.
- */
- it('testRouterGetState', 0, async function (done) {
- console.info('testRouterGetState START');
- await setTimeout(() => {
- let page = router.getState();
- console.info('[router.getState] index: ' + page.index);
- console.info('[router.getState] name: ' + page.name);
- console.info('[router.getState] path: ' + page.path);
- expect(page.index).assertEqual(1);
- expect(page.name).assertEqual('index');
- expect(page.path).assertEqual('pages/index/');
- console.info('testRouterGetState END');
- done();
- }, 500);
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_0900
- * @tc.name testPromptShowToast
- * @tc.desc Show text pop-up window.
- */
- it('testPromptShowToast', 0, function () {
- console.info('testPromptShowToast START');
- const delay = 5000;
- prompt.showToast({
- message: 'message',
- duration: delay,
- });
- expect(test).assertEqual('success');
- console.info('[prompt.showToast] success');
- console.info('testPromptShowToast END');
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_1000
- * @tc.name testPromptDialog
- * @tc.desc Display the dialog box in the page.
- */
- it('testPromptDialog', 0, function () {
- console.info('testPromptDialog START')
- prompt.showDialog({
- title: 'dialog showDialog test',
- message: 'message of dialog',
- buttons: [
- {
- text: 'OK',
- color: '#0000ff',
- index: 0
- }
- ],
- success: function (ret) {
- console.info("[prompt.showDialog] ret.index " + ret.index);
- expect(testResult).toBeTrue();
- },
- cancel: function () {
- console.log('[prompt.showDialog] dialog cancel callback');
- expect(testResultFail).toBeTrue();
- },
- complete: function () {
- console.log('[prompt.showDialog] complete');
- }
- });
- console.info('testPromptDialog END');
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_1100
- * @tc.name testConfigurationGetLocale
- * @tc.desc Get the current language and region of the app. Synchronize with the language and region.
- */
- it('testConfigurationGetLocale', 0, function () {
- console.info('testConfigurationGetLocale START');
- const localeInfo = configuration.getLocale();
- console.info("[configuration.getLocale] localeInfo: " + JSON.stringify(localeInfo));
- console.info("[configuration.getLocale] language: " + localeInfo.language);
- console.info("[configuration.getLocale] countryOrRegion: " + localeInfo.countryOrRegion);
- console.info("[configuration.getLocale] dir: " + localeInfo.dir);
- expect(localeInfo.language).assertEqual('zh');
- expect(localeInfo.dir).assertEqual('ltr');
- console.info('testConfigurationGetLocale END');
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_1200
- * @tc.name testSetTimeout
- * @tc.desc Set up a timer that executes a function or a specified piece of code after the timer expires.
- */
- it('testSetTimeout', 0, async function (done) {
- console.info('testSetTimeout START');
- let startTime = new Date().getTime();
- const delay = 200;
- await setTimeout(function (v1, v2) {
- let endTime = new Date().getTime();
- console.info("[setTimeout] startTime: " + startTime);
- console.info("[setTimeout] endTime: " + endTime);
- console.info('[setTimeout] delay: ' + (endTime - startTime));
- console.info('[setTimeout] v1: ' + v1);
- console.info('[setTimeout] v2: ' + v2);
- expect('test').assertEqual(v1);
- expect('message').assertEqual(v2);
- expect(endTime - startTime >= delay).assertTrue();
- console.info('testSetTimeout END');
- done();
- }, delay, 'test', 'message');
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_1300
- * @tc.name testClearTimeout
- * @tc.desc The timer previously established by calling setTimeout() is cancelled.
- */
- it('testClearTimeout', 0, async function (done) {
- console.info('testClearTimeout START');
- let res = 0;
- let timeoutID = setTimeout(function () {
- res++;
- }, 700);
- await setTimeout(function () {
- console.info('testClearTimeout delay 0.5s')
- clearTimeout(timeoutID);
- console.info("[clearTimeout] success");
- }, 500);
- await setTimeout(function () {
- expect(0).assertEqual(res);
- console.info('testClearTimeout END');
- done();
- }, 1000);
- });
-
- /**
- * @tc.number SUB_ACE_BASICABILITY_JS_API_1400
- * @tc.name testSetInterval
- * @tc.desc Call a function or execute a code segment repeatedly, with a fixed time delay between each call.
- */
- it('testSetInterval', 0, async function (done) {
- console.info('testSetInterval START');
- let res = 0;
- let intervalID = setInterval(function () {
- res++;
- }, 100);
- await setTimeout(function () {
- expect(9).assertEqual(res);
- console.info('testSetInterval SUCCESS');
- clearInterval(intervalID);
- console.info('testSetInterval END');
- done();
- }, 1000);
- });
-});
+/*
+ * 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 configuration from '@system.configuration';
+import prompt from '@system.prompt';
+import router from '@system.router';
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium';
+
+export default function basicabilityapi() {
+describe('basicabilityapi', function () {
+ let testResult;
+ let testResultFail;
+ let test;
+ beforeAll(function () {
+ testResult = true;
+ testResultFail = false;
+ test = "success"
+ });
+ beforeEach(function () {
+ });
+ afterEach(function () {
+ });
+ afterAll(function () {
+ });
+
+ async function backToIndex(){
+ let backToIndexPromise = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ router.back({
+ uri: 'pages/index/index'
+ });
+ resolve();
+ }, 500);
+ });
+ let clearPromise = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ router.clear();
+ resolve();
+ }, 500);
+ });
+ await backToIndexPromise.then(() => {
+ return clearPromise;
+ });
+ }
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0100
+ * @tc.name testClearInterval
+ * @tc.desc Cancel the repetitive timing tasks previously set by setInterval.
+ */
+ it('testClearInterval', 0, async function(done) {
+ console.info('testClearInterval START');
+ let res = 0;
+ let intervalID = -1;
+ let promise1 = new Promise((resolve, reject) => {
+ intervalID = setInterval(function () {
+ res++;
+ console.info('testClearInterval res = ' + res);
+ resolve();
+ }, 100);
+ });
+ let promise2 = new Promise((resolve, reject) => {
+ setTimeout(function () {
+ console.info('[clearInterval] start');
+ clearInterval(intervalID);
+ console.info('[clearInterval] end');
+ resolve();
+ }, 600);
+ });
+ Promise.all([promise1, promise2]).then(() => {
+ console.info('testClearInterval finally');
+ expect(5).assertEqual(res);
+ console.info('testClearInterval END');
+ done();
+ });
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0200
+ * @tc.name testConsole
+ * @tc.desc Print a text message.
+ */
+ it('testConsole', 0, function () {
+ console.info('testConsole START');
+ const versionCode = 1.1;
+ console.info('[console.info] versionCode: ' + versionCode);
+ console.debug('[console.debug] versionCode: ' + versionCode);
+ console.log('[console.log] versionCode: ' + versionCode);
+ console.warn('[console.warn] versionCode: ' + versionCode);
+ console.error('[console.error] versionCode: ' + versionCode);
+ expect(test).assertEqual('success');
+ console.info('testConsole END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0300
+ * @tc.name testRouterPush
+ * @tc.desc Go to the specified page of the application.
+ */
+ it('testRouterPush', 0, async function (done) {
+ console.info('testRouterPush START');
+ let options = {
+ uri : 'pages/routerPush/index'
+ }
+ let promise1 = new Promise((resolve, reject) => {
+ router.push(options);
+ resolve();
+ });
+ let promise2 = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let pages = router.getState();
+ console.info("[router.push] getState" + JSON.stringify(pages));
+ expect("pages/routerPush/").assertEqual(pages.path);
+ console.info("[router.push] getLength:" + router.getLength());
+ expect("2").assertEqual(router.getLength());
+ console.info('testRouterPush SUCCESS');
+ resolve();
+ }, 500);
+ });
+ await promise1.then(() => {
+ return promise2;
+ });
+ await backToIndex();
+ console.info('testRouterPush END');
+ done();
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0310
+ * @tc.name testRouterPushNotExist
+ * @tc.desc Test push not exist page.
+ */
+ it('testRouterPushNotExist', 0, async function (done) {
+ console.info('testRouterPushNotExist START');
+ let promise1 = new Promise((resolve, reject) => {
+ router.push({
+ uri: 'pages/routerNotExist/index'
+ });
+ resolve();
+ });
+ let promise2 = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let pages = router.getState();
+ console.info("testRouterPushNotExist getState" + JSON.stringify(pages));
+ expect("pages/index/").assertEqual(pages.path);
+ console.info("testRouterPushNotExist getLength:" + router.getLength());
+ expect("1").assertEqual(router.getLength());
+ console.info('testRouterPushNotExist success');
+ resolve();
+ }, 500);
+ });
+ await promise1.then(() => {
+ return promise2;
+ });
+ console.info('testRouterPushNotExist END');
+ done();
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0400
+ * @tc.name testRouterReplace
+ * @tc.desc Replace the current page with a page in the application, and destroy the replaced page.
+ */
+ it('testRouterReplace', 0, async function (done) {
+ //测试框架不允许index页面直接替换,需要先跳转到其他页面再替换
+ console.info('testRouterReplace START');
+ let options = {
+ uri : 'pages/routerPush/index'
+ }
+ let promise1 = new Promise((resolve, reject) => {
+ router.push(options);
+ resolve();
+ });
+ let repleasePage = {
+ uri : 'pages/routerReplace/index'
+ }
+ let promise2 = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ router.replace(repleasePage);
+ resolve();
+ }, 500);
+ });
+ //替换堆栈数量不会变
+ let promise3 = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let pages = router.getState();
+ console.info("[router.replace] getState" + JSON.stringify(pages));
+ expect("pages/routerReplace/").assertEqual(pages.path);
+ console.info("[router.replace] getLength:" + router.getLength());
+ expect("2").assertEqual(router.getLength());
+ console.info('testRouterReplace SUCCESS');
+ resolve();
+ }, 1000);
+ });
+ await promise1.then(() => {
+ return promise2;
+ }).then(() => {
+ return promise3;
+ });
+ await backToIndex();
+ console.info('testRouterReplace END');
+ done();
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0410
+ * @tc.name testRouterReplaceNotExist
+ * @tc.desc Test replace not exist page.
+ */
+ it('testRouterReplaceNotExist', 0, async function (done) {
+ console.info('testRouterReplaceNotExist START');
+ await setTimeout(() => {
+ router.replace({
+ uri: 'pages/routerNotExist/index'
+ });
+ }, 500);
+ await setTimeout(() => {
+ let pages = router.getState();
+ console.info("testRouterReplaceNotExist getState" + JSON.stringify(pages));
+ expect("pages/index/").assertEqual(pages.path);
+ console.info("testRouterReplaceNotExist getLength:" + router.getLength());
+ expect("1").assertEqual(router.getLength());
+ console.info('testRouterReplaceNotExist END');
+ done();
+ }, 1000);
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0500
+ * @tc.name testRouterBack
+ * @tc.desc Return to the previous page or the specified page.
+ */
+ it('testRouterBack', 0, async function (done) {
+ console.info('testRouterBack START');
+ let promise1 = new Promise((resolve, reject) => {
+ router.push({
+ uri: 'pages/routerPush/index'
+ });
+ resolve();
+ });
+ let promise2 = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ router.back({
+ uri: 'pages/index/index'
+ });
+ resolve();
+ }, 500);
+ });
+ let promise3 = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ let pages = router.getState();
+ console.info("[router.back] getState" + JSON.stringify(pages));
+ expect("pages/index/").assertEqual(pages.path);
+ console.info("[router.back] getLength:" + router.getLength());
+ expect("1").assertEqual(router.getLength());
+ console.info('testRouterBack SUCCESS');
+ resolve();
+ }, 1000);
+ });
+ await promise1.then(() => {
+ return promise2;
+ }).then(() => {
+ return promise3;
+ });
+ console.info('testRouterBack END');
+ done();
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0600
+ * @tc.name testRouterClear
+ * @tc.desc Clear all historical pages in the page stack, and only keep the current page as the top page.
+ */
+ it('testRouterClear', 0, function () {
+ console.info('testRouterClear START');
+ router.clear();
+ console.info("[router.clear] router.getLength:" + router.getLength());
+ expect("1").assertEqual(router.getLength());
+ console.info('testRouterClear END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0700
+ * @tc.name testRouterLength
+ * @tc.desc Get the number of pages currently in the page stack.
+ */
+ it('testRouterLength', 0, async function (done) {
+ console.info('testRouterLength START');
+ let size = router.getLength();
+ console.info('[router.getLength] pages stack size = ' + size);
+ expect(size).assertEqual('1');
+ let options = {
+ uri : 'pages/routerPush/index'
+ }
+ let promise1 = new Promise((resolve, reject) => {
+ router.push(options);
+ resolve();
+ });
+ let promise2 = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ console.info("testRouterLength getLength:" + router.getLength());
+ expect("2").assertEqual(router.getLength());
+ console.info('testRouterLength SUCCESS');
+ resolve();
+ }, 500);
+ });
+ await promise1.then(() => {
+ return promise2;
+ });
+ await backToIndex();
+ console.info('testRouterLength END');
+ done();
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0800
+ * @tc.name testRouterGetState
+ * @tc.desc Get the status information of the current page.
+ */
+ it('testRouterGetState', 0, async function (done) {
+ console.info('testRouterGetState START');
+ await setTimeout(() => {
+ let page = router.getState();
+ console.info('[router.getState] index: ' + page.index);
+ console.info('[router.getState] name: ' + page.name);
+ console.info('[router.getState] path: ' + page.path);
+ expect(page.index).assertEqual(1);
+ expect(page.name).assertEqual('index');
+ expect(page.path).assertEqual('pages/index/');
+ console.info('testRouterGetState END');
+ done();
+ }, 500);
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_0900
+ * @tc.name testPromptShowToast
+ * @tc.desc Show text pop-up window.
+ */
+ it('testPromptShowToast', 0, function () {
+ console.info('testPromptShowToast START');
+ const delay = 5000;
+ prompt.showToast({
+ message: 'message',
+ duration: delay,
+ });
+ expect(test).assertEqual('success');
+ console.info('[prompt.showToast] success');
+ console.info('testPromptShowToast END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_1000
+ * @tc.name testPromptDialog
+ * @tc.desc Display the dialog box in the page.
+ */
+ it('testPromptDialog', 0, function () {
+ console.info('testPromptDialog START')
+ prompt.showDialog({
+ title: 'dialog showDialog test',
+ message: 'message of dialog',
+ buttons: [
+ {
+ text: 'OK',
+ color: '#0000ff',
+ index: 0
+ }
+ ],
+ success: function (ret) {
+ console.info("[prompt.showDialog] ret.index " + ret.index);
+ expect(testResult).toBeTrue();
+ },
+ cancel: function () {
+ console.log('[prompt.showDialog] dialog cancel callback');
+ expect(testResultFail).toBeTrue();
+ },
+ complete: function () {
+ console.log('[prompt.showDialog] complete');
+ }
+ });
+ console.info('testPromptDialog END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_1100
+ * @tc.name testConfigurationGetLocale
+ * @tc.desc Get the current language and region of the app. Synchronize with the language and region.
+ */
+ it('testConfigurationGetLocale', 0, function () {
+ console.info('testConfigurationGetLocale START');
+ const localeInfo = configuration.getLocale();
+ console.info("[configuration.getLocale] localeInfo: " + JSON.stringify(localeInfo));
+ console.info("[configuration.getLocale] language: " + localeInfo.language);
+ console.info("[configuration.getLocale] countryOrRegion: " + localeInfo.countryOrRegion);
+ console.info("[configuration.getLocale] dir: " + localeInfo.dir);
+ expect(localeInfo.language).assertEqual('zh');
+ expect(localeInfo.dir).assertEqual('ltr');
+ console.info('testConfigurationGetLocale END');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_1200
+ * @tc.name testSetTimeout
+ * @tc.desc Set up a timer that executes a function or a specified piece of code after the timer expires.
+ */
+ it('testSetTimeout', 0, async function (done) {
+ console.info('testSetTimeout START');
+ let startTime = new Date().getTime();
+ const delay = 200;
+ await setTimeout(function (v1, v2) {
+ let endTime = new Date().getTime();
+ console.info("[setTimeout] startTime: " + startTime);
+ console.info("[setTimeout] endTime: " + endTime);
+ console.info('[setTimeout] delay: ' + (endTime - startTime));
+ console.info('[setTimeout] v1: ' + v1);
+ console.info('[setTimeout] v2: ' + v2);
+ expect('test').assertEqual(v1);
+ expect('message').assertEqual(v2);
+ expect(endTime - startTime >= delay).assertTrue();
+ console.info('testSetTimeout END');
+ done();
+ }, delay, 'test', 'message');
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_1300
+ * @tc.name testClearTimeout
+ * @tc.desc The timer previously established by calling setTimeout() is cancelled.
+ */
+ it('testClearTimeout', 0, async function (done) {
+ console.info('testClearTimeout START');
+ let res = 0;
+ let timeoutID = setTimeout(function () {
+ res++;
+ }, 700);
+ await setTimeout(function () {
+ console.info('testClearTimeout delay 0.5s')
+ clearTimeout(timeoutID);
+ console.info("[clearTimeout] success");
+ }, 500);
+ await setTimeout(function () {
+ expect(0).assertEqual(res);
+ console.info('testClearTimeout END');
+ done();
+ }, 1000);
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASICABILITY_JS_API_1400
+ * @tc.name testSetInterval
+ * @tc.desc Call a function or execute a code segment repeatedly, with a fixed time delay between each call.
+ */
+ it('testSetInterval', 0, async function (done) {
+ console.info('testSetInterval START');
+ let res = 0;
+ let intervalID = setInterval(function () {
+ res++;
+ }, 100);
+ await setTimeout(function () {
+ expect(9).assertEqual(res);
+ console.info('testSetInterval SUCCESS');
+ clearInterval(intervalID);
+ console.info('testSetInterval END');
+ done();
+ }, 1000);
+ });
+});
+}
diff --git a/arkui/ace_standard_video/src/main/js/default/test/commonComponentJsApi.test.js b/arkui/ace_standard_video/src/main/js/test/commonComponentJsApi.test.js
similarity index 94%
rename from arkui/ace_standard_video/src/main/js/default/test/commonComponentJsApi.test.js
rename to arkui/ace_standard_video/src/main/js/test/commonComponentJsApi.test.js
index 0f929e21abdee7d96b2f9d61cce3d6c8f6b1859a..c505956400f5168693cb4d127d791d0d6c383420 100644
--- a/arkui/ace_standard_video/src/main/js/default/test/commonComponentJsApi.test.js
+++ b/arkui/ace_standard_video/src/main/js/test/commonComponentJsApi.test.js
@@ -1,82 +1,84 @@
-/*
- * 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 router from '@system.router';
-import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
-
-
-describe('aceJsTest', function () {
-
- async function sleep(time) {
- return new Promise((resolve, reject) => {
- setTimeout(() => {
- resolve()
- }, time)
- }).then(() => {
- console.info(`sleep ${time} over...`)
- })
- }
- async function backToIndex() {
- let backToIndexPromise = new Promise((resolve, reject) => {
- setTimeout(() => {
- router.back({
- uri: 'pages/index/index'
- });
- resolve();
- }, 500);
- });
- let clearPromise = new Promise((resolve, reject) => {
- setTimeout(() => {
- router.clear();
- resolve();
- }, 500);
- });
- await backToIndexPromise.then(() => {
- return clearPromise;
- });
- }
-
- /**
- * run after testcase
- */
- afterEach(async function () {
- console.info('[aceJsTest] after each called')
- await backToIndex();
- await sleep(5000)
- });
-
- /**
- * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100
- * @tc.name testVideoComponent
- * @tc.desc ACE
- */
- it('testVideoComponent', 0, async function (done) {
- let result;
- let options = {
- uri: 'pages/video/router/index'
- }
- try {
- result = router.push(options)
- console.info("push video page success " + JSON.stringify(result));
- } catch (err) {
- console.error("push video page error " + JSON.stringify(result));
- }
- await sleep(5000)
- let pages = router.getState();
- console.info("[router.video] getState" + JSON.stringify(pages));
- expect("pages/video/router/").assertEqual(pages.path);
- done();
- });
-});
+/*
+ * 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 router from '@system.router';
+import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium';
+
+
+export default function aceJsTest() {
+describe('aceJsTest', function () {
+
+ async function sleep(time) {
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ resolve()
+ }, time)
+ }).then(() => {
+ console.info(`sleep ${time} over...`)
+ })
+ }
+ async function backToIndex() {
+ let backToIndexPromise = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ router.back({
+ uri: 'pages/index/index'
+ });
+ resolve();
+ }, 500);
+ });
+ let clearPromise = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ router.clear();
+ resolve();
+ }, 500);
+ });
+ await backToIndexPromise.then(() => {
+ return clearPromise;
+ });
+ }
+
+ /**
+ * run after testcase
+ */
+ afterEach(async function () {
+ console.info('[aceJsTest] after each called')
+ await backToIndex();
+ await sleep(5000)
+ });
+
+ /**
+ * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100
+ * @tc.name testVideoComponent
+ * @tc.desc ACE
+ */
+ it('testVideoComponent', 0, async function (done) {
+ let result;
+ let options = {
+ uri: 'pages/video/router/index'
+ }
+ try {
+ result = router.push(options)
+ console.info("push video page success " + JSON.stringify(result));
+ } catch (err) {
+ console.error("push video page error " + JSON.stringify(result));
+ }
+ await sleep(5000)
+ let pages = router.getState();
+ console.info("[router.video] getState" + JSON.stringify(pages));
+ expect("pages/video/router/").assertEqual(pages.path);
+ done();
+ });
+});
+}
diff --git a/arkui/ace_standard_video/src/main/js/default/test/mediaquery.test.js b/arkui/ace_standard_video/src/main/js/test/mediaquery.test.js
similarity index 96%
rename from arkui/ace_standard_video/src/main/js/default/test/mediaquery.test.js
rename to arkui/ace_standard_video/src/main/js/test/mediaquery.test.js
index 86e03f26ad23583e433dafc41b838f8f72aa28c0..ae46e27cf8978f35f1131a1bf79f4096cf7e7887 100644
--- a/arkui/ace_standard_video/src/main/js/default/test/mediaquery.test.js
+++ b/arkui/ace_standard_video/src/main/js/test/mediaquery.test.js
@@ -1,272 +1,273 @@
-/*
- * 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 {describe,beforeAll,beforeEach,afterEach,afterAll,it,expect}from 'deccjsunit/index'
-import mediaquery from '@system.mediaquery';
-
-describe('mediaquery', function() {
- let testResult;
- let test;
- beforeAll(function() {
- testResult = false;
- test="success"
- });
-
- it('addListener', 0, function() {
- console.info('MediaQuery addListener start');
- var mMediaQueryList = mediaquery.matchMedia('(min-height:0)');
-// mMediaQueryList.onreadystatechange = function(){
- function minWidthMatch(e){
- if(e.matches){
- //do something
- expect(e.matches).assertEqual(true);
- console.info('MediaQuery addListener success');
- expect(test).assertEqual('success');
- }
- else{
- expect(e.matches).assertEqual(true);
- console.info('MediaQuery addListener fail');
- expect(test).assertEqual('fail');
- }
- }
-
- mMediaQueryList.addListener(minWidthMatch)
- console.info('MediaQuery addListener end');
- // }
- });
-
- it('matchMedia', 0, function() {
- console.info('matchMedia start');
- var mMediaQueryList = mediaquery.matchMedia('(min-height:0)');
- var med = mMediaQueryList.media
- console.info("media:"+med)
- mMediaQueryList.onchange = function(){
- console.info('MediaQuery detonate onchange')
- }
- function minWidthMatch(e){
- if(e.matches){
- console.info("MediaQuery matches:"+e.matches)
- console.info("MediaQuery onchangeMessage:"+e.onchange)
- console.info('MediaQuery matchMedia success');
- expect(test).assertEqual('success');
- }
- else{
- console.info('MediaQuery matchMedia fail');
- expect(test).assertEqual('fail');
- }
- console.info('MediaQuery matchMedia end');
- }
- mMediaQueryList.addListener(minWidthMatch);
- });
-
- it('orientation', 0, function() {
- console.info('orientation test start');
- var mMediaQueryList = mediaquery.matchMedia('(orientation:landscape)');
- var med = mMediaQueryList.media
- console.info("orientation onchangeMessage:"+mMediaQueryList.onchange)
- function orientationMatch(e){
- if(e.matches){
- //do something
- console.info("MediaQuery orientation matches:"+e.matches)
- console.info('MediaQuery orientation success');
- expect(test).assertEqual('success');
- }
- else{
- console.info('MediaQuery orientation fail');
- expect(test).assertEqual('fail');
- }
- }
- mMediaQueryList.addListener(orientationMatch)
- console.info('MediaQuery orientation test end')
- });
-
- it('rmeoveListener', 0, function() {
- console.info('rmeoveListener start');
- var mMediaQueryList = mediaquery.matchMedia('(max-width:466)');
- function maxWidthMatch(e){
- if(e.matches){
- //do something
- console.info('MediaQuery rmeoveListener success');
- expect(test).assertEqual('success');
- }
- else{
- console.info('MediaQuery rmeoveListener fail');
- expect(test).assertEqual('fail');
- }
- }
- mMediaQueryList.addListener(maxWidthMatch)
- mMediaQueryList.removeListener(maxWidthMatch)
- console.info('MediaQuery removeListener end')
- });
-
- it('maxHeight', 0, function() {
- console.info('maxHeight start');
- var mMediaQueryList = mediaquery.matchMedia('(max-width:10000)');
-// mMediaQueryList.onreadystatechange = function(){
- function maxHeightMatch(e){
- if(e.matches){
- //do something
- console.info('MediaQuery maxHeight success');
- expect(test).assertEqual('success');
- }
- else{
- console.info('MediaQuery maxHeight fail');
- expect(test).assertEqual('fail');
- }
- }
- // }
-
- mMediaQueryList.addListener(maxHeightMatch)
- console.info('MediaQuery maxHeight end')
- });
-
- it('deviceType', 0, function() {
- console.info('deviceType start');
- var mMediaQueryList = mediaquery.matchMedia('(deviceType:phone)');
- function deviceTypeMatch(e){
- if(e.matches){
- //do something
- console.info('MediaQuery deviceType success');
- expect(test).assertEqual('success');
- }
- else{
- console.info('MediaQuery deviceType fail');
- expect(test).assertEqual('fail');
- }
- }
- mMediaQueryList.addListener(deviceTypeMatch)
- console.info('MediaQuery deviceType end')
- });
-
- it('logicOnly', 0, function() {
- console.info('MediaQuery logicOnly start');
- var mMediaQueryList = mediaquery.matchMedia('only screen and(deviceType:phone)and(max-height:100000)');
-// mMediaQueryList.onreadystatechange = function(){
- function logicOnlyMatch(e){
- if(e.matches){
- //do something
- console.info('MediaQuery logicOnly success');
- expect(test).assertEqual('success');
- }
- else{
- console.info('MediaQuery logicOnly fail');
- expect(test).assertEqual('fail');
- }
- }
- mMediaQueryList.addListener(logicOnlyMatch)
- console.info('MediaQuery logicOnly end')
- //}
- });
-
- it('logicNot', 0, function() {
- console.info('logicOnly start');
- var mMediaQueryList = mediaquery.matchMedia('not screen and(deviceType:tv)');
-// mMediaQueryList.onreadystatechange = function(){
- function logicNotMatch(e){
- if(e.matches){
- //do something
- console.info('MediaQuery logicNot success');
- expect(test).assertEqual('success');
- }
- else{
- console.info('MediaQuery logicNot fail');
- expect(test).assertEqual('fail');
- }
- }
- mMediaQueryList.addListener(logicNotMatch)
- console.info('MediaQuery logicNot end')
- //}
- });
-
- it('logicAnd', 0, function() {
- console.info('MediaQuery logicAnd start');
- var mMediaQueryList = mediaquery.matchMedia('screen and(deviceType:phone)');
- function logicAndMatch(e){
- if(e.matches){
- //do something
- expect(e.matches).assertEqual(true)
- console.info('MediaQuery logicAnd success');
- expect(test).assertEqual('success');
- }
- else{
- expect(e.matches).assertEqual(true)
- console.info('MediaQuery logicAnd fail');
- expect(test).assertEqual('fail');
- }
- }
- mMediaQueryList.addListener(logicAndMatch)
- console.info('MediaQuery logicAnd end')
- });
-
- it('logicComma', 0, function() {
- console.info('MediaQuery logicComma start');
- var mMediaQueryList = mediaquery.matchMedia('screen and(min-height:0),(round-screen:true)');
- function logicCommaMatch(e){
- if(e.matches){
- //do something
- expect(e.matches).assertEqual(true)
- console.info('MediaQuery logicComma success');
- expect(test).assertEqual('success');
- }
- else{
- expect(e.matches).assertEqual(true)
- console.info('MediaQuery logicComma fail');
- expect(test).assertEqual('fail');
- }
- }
- mMediaQueryList.addListener(logicCommaMatch)
- console.info('MediaQuery logicComma end')
- });
-
- it('logicOr', 0, function() {
- console.info('MediaQuery logicOr start');
- var mMediaQueryList = mediaquery.matchMedia('screen and(max-device-height:2000)or(round-screen:true)');
- function logicOrMatch(e){
- if(e.matches){
- //do something
- expect(e.matches).assertEqual(true)
- console.info('MediaQuery logicOr success');
- expect(test).assertEqual('success');
- }
- else{
- expect(e.matches).assertEqual(true)
- console.info('MediaQuery logicOr fail');
- expect(test).assertEqual('fail');
- }
- }
- mMediaQueryList.addListener(logicOrMatch)
- console.info('MediaQuery logicOr end')
- });
-
- it('logic1', 0, function() {
- console.info('MediaQuery logic>= start');
- var mMediaQueryList = mediaquery.matchMedia('screen and(height>=0)');
- function logicOrMatch(e){
- if(e.matches){
- //do something
- expect(e.matches).assertEqual(true)
- console.info('MediaQuery logic>= success');
- expect(test).assertEqual('success');
- }
- else{
- expect(e.matches).assertEqual(true)
- console.info('MediaQuery logic>= fail');
- expect(test).assertEqual('fail');
- }
- }
- mMediaQueryList.addListener(logicOrMatch)
- console.info('MediaQuery logic>= end')
- })
-});
\ No newline at end of file
+/*
+ * 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 {describe,beforeAll,beforeEach,afterEach,afterAll,it,expect}from '@ohos/hypium'
+import mediaquery from '@system.mediaquery';
+
+export default function mediaquery_vioTest() {
+describe('mediaquery_vioTest', function() {
+ let testResult;
+ let test;
+ beforeAll(function() {
+ testResult = false;
+ test="success"
+ });
+
+ it('addListener', 0, function() {
+ console.info('MediaQuery addListener start');
+ var mMediaQueryList = mediaquery.matchMedia('(min-height:0)');
+// mMediaQueryList.onreadystatechange = function(){
+ function minWidthMatch(e){
+ if(e.matches){
+ //do something
+ expect(e.matches).assertEqual(true);
+ console.info('MediaQuery addListener success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ expect(e.matches).assertEqual(true);
+ console.info('MediaQuery addListener fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+
+ mMediaQueryList.addListener(minWidthMatch)
+ console.info('MediaQuery addListener end');
+ // }
+ });
+
+ it('matchMedia', 0, function() {
+ console.info('matchMedia start');
+ var mMediaQueryList = mediaquery.matchMedia('(min-height:0)');
+ var med = mMediaQueryList.media
+ console.info("media:"+med)
+ mMediaQueryList.onchange = function(){
+ console.info('MediaQuery detonate onchange')
+ }
+ function minWidthMatch(e){
+ if(e.matches){
+ console.info("MediaQuery matches:"+e.matches)
+ console.info("MediaQuery onchangeMessage:"+e.onchange)
+ console.info('MediaQuery matchMedia success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ console.info('MediaQuery matchMedia fail');
+ expect(test).assertEqual('fail');
+ }
+ console.info('MediaQuery matchMedia end');
+ }
+ mMediaQueryList.addListener(minWidthMatch);
+ });
+
+ it('orientation', 0, function() {
+ console.info('orientation test start');
+ var mMediaQueryList = mediaquery.matchMedia('(orientation:landscape)');
+ var med = mMediaQueryList.media
+ console.info("orientation onchangeMessage:"+mMediaQueryList.onchange)
+ function orientationMatch(e){
+ if(e.matches){
+ //do something
+ console.info("MediaQuery orientation matches:"+e.matches)
+ console.info('MediaQuery orientation success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ console.info('MediaQuery orientation fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+ mMediaQueryList.addListener(orientationMatch)
+ console.info('MediaQuery orientation test end')
+ });
+
+ it('rmeoveListener', 0, function() {
+ console.info('rmeoveListener start');
+ var mMediaQueryList = mediaquery.matchMedia('(max-width:466)');
+ function maxWidthMatch(e){
+ if(e.matches){
+ //do something
+ console.info('MediaQuery rmeoveListener success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ console.info('MediaQuery rmeoveListener fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+ mMediaQueryList.addListener(maxWidthMatch)
+ mMediaQueryList.removeListener(maxWidthMatch)
+ console.info('MediaQuery removeListener end')
+ });
+
+ it('maxHeight', 0, function() {
+ console.info('maxHeight start');
+ var mMediaQueryList = mediaquery.matchMedia('(max-width:10000)');
+// mMediaQueryList.onreadystatechange = function(){
+ function maxHeightMatch(e){
+ if(e.matches){
+ //do something
+ console.info('MediaQuery maxHeight success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ console.info('MediaQuery maxHeight fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+ // }
+
+ mMediaQueryList.addListener(maxHeightMatch)
+ console.info('MediaQuery maxHeight end')
+ });
+
+ it('deviceType', 0, function() {
+ console.info('deviceType start');
+ var mMediaQueryList = mediaquery.matchMedia('(deviceType:phone)');
+ function deviceTypeMatch(e){
+ if(e.matches){
+ //do something
+ console.info('MediaQuery deviceType success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ console.info('MediaQuery deviceType fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+ mMediaQueryList.addListener(deviceTypeMatch)
+ console.info('MediaQuery deviceType end')
+ });
+
+ it('logicOnly', 0, function() {
+ console.info('MediaQuery logicOnly start');
+ var mMediaQueryList = mediaquery.matchMedia('only screen and(deviceType:phone)and(max-height:100000)');
+// mMediaQueryList.onreadystatechange = function(){
+ function logicOnlyMatch(e){
+ if(e.matches){
+ //do something
+ console.info('MediaQuery logicOnly success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ console.info('MediaQuery logicOnly fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+ mMediaQueryList.addListener(logicOnlyMatch)
+ console.info('MediaQuery logicOnly end')
+ //}
+ });
+
+ it('logicNot', 0, function() {
+ console.info('logicOnly start');
+ var mMediaQueryList = mediaquery.matchMedia('not screen and(deviceType:tv)');
+// mMediaQueryList.onreadystatechange = function(){
+ function logicNotMatch(e){
+ if(e.matches){
+ //do something
+ console.info('MediaQuery logicNot success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ console.info('MediaQuery logicNot fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+ mMediaQueryList.addListener(logicNotMatch)
+ console.info('MediaQuery logicNot end')
+ //}
+ });
+
+ it('logicAnd', 0, function() {
+ console.info('MediaQuery logicAnd start');
+ var mMediaQueryList = mediaquery.matchMedia('screen and(deviceType:phone)');
+ function logicAndMatch(e){
+ if(e.matches){
+ //do something
+ expect(e.matches).assertEqual(true)
+ console.info('MediaQuery logicAnd success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ expect(e.matches).assertEqual(true)
+ console.info('MediaQuery logicAnd fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+ mMediaQueryList.addListener(logicAndMatch)
+ console.info('MediaQuery logicAnd end')
+ });
+
+ it('logicComma', 0, function() {
+ console.info('MediaQuery logicComma start');
+ var mMediaQueryList = mediaquery.matchMedia('screen and(min-height:0),(round-screen:true)');
+ function logicCommaMatch(e){
+ if(e.matches){
+ //do something
+ expect(e.matches).assertEqual(true)
+ console.info('MediaQuery logicComma success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ expect(e.matches).assertEqual(true)
+ console.info('MediaQuery logicComma fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+ mMediaQueryList.addListener(logicCommaMatch)
+ console.info('MediaQuery logicComma end')
+ });
+
+ it('logicOr', 0, function() {
+ console.info('MediaQuery logicOr start');
+ var mMediaQueryList = mediaquery.matchMedia('screen and(max-device-height:2000)or(round-screen:true)');
+ function logicOrMatch(e){
+ if(e.matches){
+ //do something
+ expect(e.matches).assertEqual(true)
+ console.info('MediaQuery logicOr success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ expect(e.matches).assertEqual(true)
+ console.info('MediaQuery logicOr fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+ mMediaQueryList.addListener(logicOrMatch)
+ console.info('MediaQuery logicOr end')
+ });
+
+ it('logic1', 0, function() {
+ console.info('MediaQuery logic>= start');
+ var mMediaQueryList = mediaquery.matchMedia('screen and(height>=0)');
+ function logicOrMatch(e){
+ if(e.matches){
+ //do something
+ expect(e.matches).assertEqual(true)
+ console.info('MediaQuery logic>= success');
+ expect(test).assertEqual('success');
+ }
+ else{
+ expect(e.matches).assertEqual(true)
+ console.info('MediaQuery logic>= fail');
+ expect(test).assertEqual('fail');
+ }
+ }
+ mMediaQueryList.addListener(logicOrMatch)
+ console.info('MediaQuery logic>= end')
+ })
+});}
diff --git a/arkui/ace_standard_video/src/main/resources/base/element/string.json b/arkui/ace_standard_video/src/main/resources/base/element/string.json
index 4e4bd19381d56630ba5b56a1ec5091ff678bb789..95825d58ddf7ce0f1e2f08d6aed50d4cecfe35d7 100644
--- a/arkui/ace_standard_video/src/main/resources/base/element/string.json
+++ b/arkui/ace_standard_video/src/main/resources/base/element/string.json
@@ -1,12 +1,28 @@
-{
- "string": [
- {
- "name": "entry_MainAbility",
- "value": "entry_MainAbility"
- },
- {
- "name": "mainability_description",
- "value": "JS_Empty Ability"
- }
- ]
-}
+{
+ "string": [
+ {
+ "name": "entry_MainAbility",
+ "value": "entry_MainAbility"
+ },
+ {
+ "name": "mainability_description",
+ "value": "JS_Empty Ability"
+ },
+ {
+ "name": "MainAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "MainAbility_label",
+ "value": "label"
+ },
+ {
+ "name": "TestAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "TestAbility_label",
+ "value": "label"
+ }
+ ]
+}