提交 65b97e4e 编写于 作者: J jiyong_sd

Adapt to the new framework

Signed-off-by: Njiyong_sd <jiyong@huawei.com>
Change-Id: Iabdd2ec328f741733cb0964f35a23c2ed2110cc0
上级 d736bfc3
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsApplicationinfoTest") { ohos_js_hap_suite("ActsApplicationinfoTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
...@@ -23,11 +23,11 @@ ohos_js_hap_suite("ActsApplicationinfoTest") { ...@@ -23,11 +23,11 @@ ohos_js_hap_suite("ActsApplicationinfoTest") {
hap_name = "ActsApplicationinfoTest" hap_name = "ActsApplicationinfoTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js"
hap_profile = "entry/src/main/config.json"
js2abc = true js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "300000", "test-timeout": "300000",
"package": "com.example.applicationinfo", "bundle-name": "com.example.applicationinfo",
"shell-timeout": "600000" "package-name": "com.example.applicationinfo",
}, "shell-timeout": "600000"
"kits": [ },
{ "kits": [
"test-file-name": [ {
"ActsApplicationinfoTest.hap" "test-file-name": [
], "ActsApplicationinfoTest.hap"
"type": "AppInstallKit", ],
"cleanup-apps": true "type": "AppInstallKit",
} "cleanup-apps": true
] }
} ]
}
{ {
"app": { "app": {
"bundleName": "com.example.applicationinfo", "bundleName": "com.example.applicationinfo",
"vendor": "example", "vendor": "example",
"version": { "version": {
"code": 1, "code": 1,
"name": "1.0" "name": "1.0"
}, },
"apiVersion": { "apiVersion": {
"compatible": 4, "compatible": 4,
"target": 5, "target": 5,
"releaseType": "Beta1" "releaseType": "Beta1"
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.example.applicationinfo", "package": "com.example.applicationinfo",
"name": ".MyApplication", "name": ".entry",
"deviceType": [ "mainAbility": ".MainAbility",
"phone" "srcPath":"",
], "deviceType": [
"distro": { "phone"
"deliveryWithInstall": true, ],
"moduleName": "entry", "distro": {
"moduleType": "entry", "deliveryWithInstall": true,
"installationFree": true "moduleName": "entry",
}, "moduleType": "entry",
"abilities": [ "installationFree": true
{ },
"skills": [ "abilities": [
{ {
"entities": [ "skills": [
"entity.system.home" {
], "entities": [
"actions": [ "entity.system.home"
"action.system.home" ],
] "actions": [
} "action.system.home"
], ]
"orientation": "unspecified", }
"visible": true, ],
"srcPath": "MainAbility", "orientation": "unspecified",
"name": ".MainAbility", "formsEnabled": false,
"srcLanguage": "js", "name": ".MainAbility",
"icon": "$media:icon", "srcLanguage": "js",
"description": "$string:description_mainability", "srcPath": "MainAbility",
"formsEnabled": false, "icon": "$media:icon",
"label": "$string:entry_MainAbility", "description": "$string:MainAbility_desc",
"type": "page", "label": "$string:MainAbility_label",
"launchType": "standard" "type": "page",
}, "visible": true,
{ "launchType": "standard"
"orientation": "unspecified", },
"srcPath": "MainAbility2", {
"name": ".MainAbility2", "orientation": "unspecified",
"srcLanguage": "js", "formsEnabled": false,
"icon": "$media:icon", "name": ".TestAbility",
"description": "$string:description_mainability2", "srcLanguage": "js",
"formsEnabled": false, "srcPath": "TestAbility",
"label": "$string:entry_MainAbility2", "icon": "$media:icon",
"type": "page", "description": "$string:TestAbility_desc",
"launchType": "standard" "label": "$string:TestAbility_label",
} "type": "page",
], "visible": true,
"js": [ "launchType": "standard"
{ },
"pages": [ {
"pages/index/index" "orientation": "unspecified",
], "srcPath": "MainAbility2",
"name": ".MainAbility", "name": ".MainAbility2",
"window": { "srcLanguage": "js",
"designWidth": 720, "icon": "$media:icon",
"autoDesignWidth": false "description": "$string:description_mainability2",
} "formsEnabled": false,
}, "label": "$string:entry_MainAbility2",
{ "type": "page",
"pages": [ "launchType": "standard"
"pages/index/index" }
], ],
"name": ".MainAbility2", "js": [
"window": { {
"designWidth": 720, "pages": [
"autoDesignWidth": false "pages/index/index"
} ],
} "name": ".MainAbility",
] "window": {
} "designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".MainAbility2",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
} }
\ 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info('TestApplication onCreate')
setTimeout(()=>{
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}, 100)
},
onDestroy() {
console.info("TestApplication onDestroy");
}
};
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World", "world": "World",
"page": "Second Page", "page": "Second Page",
"next": "Next Page", "next": "Next Page",
"back": "Back" "back": "Back"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "您好", "hello": "您好",
"world": "世界", "world": "世界",
"page": "第二页", "page": "第二页",
"next": "下一页", "next": "下一页",
"back": "返回" "back": "返回"
}, },
"Files": { "Files": {
} }
} }
\ 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.
*/
.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;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!-- <!--
Copyright (c) 2021 Huawei Device Co., Ltd. Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<div class="container" onswipe="touchMove"> <div class="container" onswipe="touchMove">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{ title }} {{text}} {{ $t('strings.hello') }} {{ title }} {{text}}
</text> </text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div> </div>
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {Core} from 'deccjsunit/index' export default {
data: {
export default { title: "",
data: { text: ""
title: "", },
text: "" onInit() {
}, this.title = this.$t('strings.world');
onInit() { this.text = "MainAbility 1111"
this.title = this.$t('strings.world'); },
this.text = "MainAbility 1111" onShow() {
}, console.info('onShow finish')
onShow() { }
console.info('onShow finish')
const core = Core.getInstance()
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test.js')
core.execute();
}
} }
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info("ApplicationMainAbility2 onCreate"); console.info("ApplicationMainAbility2 onCreate");
}, },
onDestroy() { onDestroy() {
console.info("Application onDestroy"); console.info("Application onDestroy");
} }
}; };
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World", "world": "World",
"page": "Second Page", "page": "Second Page",
"next": "Next Page", "next": "Next Page",
"back": "Back" "back": "Back"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "您好", "hello": "您好",
"world": "世界", "world": "世界",
"page": "第二页", "page": "第二页",
"next": "下一页", "next": "下一页",
"back": "返回" "back": "返回"
}, },
"Files": { "Files": {
} }
} }
\ 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.
*/
.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;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
<!-- <!--
Copyright (c) 2021 Huawei Device Co., Ltd. Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<div class="container" onswipe="touchMove"> <div class="container" onswipe="touchMove">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{ title }} {{ $t('strings.hello') }} {{ title }}
</text> </text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div> </div>
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
let event = '' let event = ''
let commonEventPublishData = '' let commonEventPublishData = ''
function PublishCallBackOne() { function PublishCallBackOne() {
console.info("====>Publish CallBack SUB_AA_OpenHarmony_Want_0200_CommonEvent====>"); console.info("====>Publish CallBack SUB_AA_OpenHarmony_Want_0200_CommonEvent====>");
} }
function PublishCallBackTwo() { function PublishCallBackTwo() {
console.info("====>Publish CallBack SUB_AA_OpenHarmony_Want_0300_CommonEvent====>"); console.info("====>Publish CallBack SUB_AA_OpenHarmony_Want_0300_CommonEvent====>");
} }
export default { export default {
data: { data: {
title: '' title: ''
}, },
onInit() { onInit() {
this.title = this.$t('strings.world ApplicationMainAbility2'); this.title = this.$t('strings.world ApplicationMainAbility2');
}, },
onShow() { onShow() {
console.info('======Start MainAbility2 onShow======'); console.info('======Start MainAbility2 onShow======');
featureAbility.getWant( featureAbility.getWant(
(err, data) => { (err, data) => {
if (data.uri == '{true,true,false}'){ if (data.uri == '{true,true,false}'){
console.info("SUB_AA_OpenHarmony_Want_0200_StartAbility" + JSON console.info("SUB_AA_OpenHarmony_Want_0200_StartAbility" + JSON
.stringify(data) + JSON.stringify(err)); .stringify(data) + JSON.stringify(err));
event = data.uri event = data.uri
commonEventPublishData = { commonEventPublishData = {
data: event, data: event,
} }
commonEvent.publish('SUB_AA_OpenHarmony_Want_0200_CommonEvent', commonEvent.publish('SUB_AA_OpenHarmony_Want_0200_CommonEvent',
commonEventPublishData, PublishCallBackOne); commonEventPublishData, PublishCallBackOne);
} }
if (data.type == 'MIMETYPE'){ if (data.type == 'MIMETYPE'){
console.info("SUB_AA_OpenHarmony_Want_0300_StartAbility" + JSON console.info("SUB_AA_OpenHarmony_Want_0300_StartAbility" + JSON
.stringify(data) + JSON.stringify(err)); .stringify(data) + JSON.stringify(err));
event = data.type event = data.type
commonEventPublishData = { commonEventPublishData = {
data: event, data: event,
} }
commonEvent.publish('SUB_AA_OpenHarmony_Want_0300_CommonEvent', commonEvent.publish('SUB_AA_OpenHarmony_Want_0300_CommonEvent',
commonEventPublishData, PublishCallBackTwo); commonEventPublishData, PublishCallBackTwo);
} }
} }
) )
}, },
onReady() { onReady() {
console.info('ApplicationInfo MainAbility2 onReady'); console.info('ApplicationInfo MainAbility2 onReady');
}, },
} }
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info("Application onCreate"); console.info("Application onCreate");
}, },
onDestroy() { onDestroy() {
console.info("Application onDestroy"); console.info("Application onDestroy");
} }
}; };
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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');
}
}
/*
* 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);
})
}
};
/* /*
* Copyright (c) 2022 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
import formBindingData from '@ohos.application.formBindingData' import formBindingData from '@ohos.application.formBindingData'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
var getCallingBundleUri = {
events: ['SUB_AA_OpenHarmony_Want_0200_CommonEvent'] var getCallingBundleUri = {
} events: ['SUB_AA_OpenHarmony_Want_0200_CommonEvent']
}
var getCallingBundleType = {
events: ['SUB_AA_OpenHarmony_Want_0300_CommonEvent'] var getCallingBundleType = {
} events: ['SUB_AA_OpenHarmony_Want_0300_CommonEvent']
}
describe('ApplicationInfoTest', function () { export default function ApplicationInfoTest() {
var TAG = ''; describe('ApplicationInfoTest', function () {
var TAG = '';
/*
* @tc.number SUB_AA_OpenHarmony_FormBase_1000 /*
* @tc.name Validate formbindingdata creation data * @tc.number SUB_AA_OpenHarmony_FormBase_1000
* @tc.desc Function test * @tc.name Validate formbindingdata creation data
* @tc.level 0 * @tc.desc Function test
*/ * @tc.level 0
it('SUB_AA_OpenHarmony_FormBase_1000', 0, async function (done) { */
console.info('------------start SUB_AA_OpenHarmony_FormBase_1000-------------'); it('SUB_AA_OpenHarmony_FormBase_1000', 0, async function (done) {
TAG = 'SUB_AA_OpenHarmony_FormBase_1000'; console.info('------------start SUB_AA_OpenHarmony_FormBase_1000-------------');
var dataObj = { TAG = 'SUB_AA_OpenHarmony_FormBase_1000';
temperature:"11c", var dataObj = {
"time":"11:00", temperature:"11c",
"test":11, "time":"11:00",
"test3":true "test":11,
} "test3":true
var formData = formBindingData.createFormBindingData(dataObj) }
console.info(TAG + " result is : " + JSON.stringify(formData)) var formData = formBindingData.createFormBindingData(dataObj)
console.info(TAG + " result is : " + JSON.stringify(formData))
let formDataStr = JSON.stringify(formData.data);
let formDataStrToObj = JSON.parse(formDataStr); let formDataStr = JSON.stringify(formData.data);
if (typeof(formDataStrToObj) == "string" ) { let formDataStrToObj = JSON.parse(formDataStr);
console.info(TAG + " formDataStrToObj1 is : " + typeof formDataStrToObj) if (typeof(formDataStrToObj) == "string" ) {
let formDataStrToObj2 = JSON.parse(formDataStrToObj) console.info(TAG + " formDataStrToObj1 is : " + typeof formDataStrToObj)
console.info(TAG + " formDataStrToObj2 is : " + typeof formDataStrToObj2) let formDataStrToObj2 = JSON.parse(formDataStrToObj)
expect(formDataStrToObj2.test).assertEqual(11) console.info(TAG + " formDataStrToObj2 is : " + typeof formDataStrToObj2)
expect(formDataStrToObj2.test3).assertTrue() expect(formDataStrToObj2.test).assertEqual(11)
expect(formDataStrToObj2.time).assertEqual("11:00") expect(formDataStrToObj2.test3).assertTrue()
done(); expect(formDataStrToObj2.time).assertEqual("11:00")
} else { done();
console.info(TAG + " formDataStrToObj is : " + typeof formDataStrToObj) } else {
expect(formDataStrToObj.test).assertEqual(11) console.info(TAG + " formDataStrToObj is : " + typeof formDataStrToObj)
expect(formDataStrToObj.test3).assertTrue() expect(formDataStrToObj.test).assertEqual(11)
expect(formDataStrToObj.time).assertEqual("11:00") expect(formDataStrToObj.test3).assertTrue()
done(); expect(formDataStrToObj.time).assertEqual("11:00")
} done();
console.info('------------end SUB_AA_OpenHarmony_FormBase_1000-------------'); }
}); console.info('------------end SUB_AA_OpenHarmony_FormBase_1000-------------');
});
/*
* @tc.number SUB_AA_OpenHarmony_Want_0200 /*
* @tc.name Switching the mission in the launcherlist to the foreground is not supported * @tc.number SUB_AA_OpenHarmony_Want_0200
* @tc.desc Function test * @tc.name Switching the mission in the launcherlist to the foreground is not supported
* @tc.level 0 * @tc.desc Function test
*/ * @tc.level 0
it('SUB_AA_OpenHarmony_Want_0200', 0, async function (done) { */
console.info('------------start SUB_AA_OpenHarmony_Want_0200-------------'); it('SUB_AA_OpenHarmony_Want_0200', 0, async function (done) {
TAG = 'SUB_AA_OpenHarmony_Want_0200'; console.info('------------start SUB_AA_OpenHarmony_Want_0200-------------');
var Subscriber = ''; TAG = 'SUB_AA_OpenHarmony_Want_0200';
var Subscriber = '';
function SubscribeCallBackUri(err, data) {
console.info(TAG + ' Subscribe CallBack data:' + JSON.stringify(data) + JSON.stringify(err)); function SubscribeCallBackUri(err, data) {
expect(data.data == '{true,true,false}').assertTrue(); console.info(TAG + ' Subscribe CallBack data:' + JSON.stringify(data) + JSON.stringify(err));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); expect(data.data == '{true,true,false}').assertTrue();
done(); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
} done();
}
function UnSubscribeCallback() {
console.debug(TAG + "====>UnSubscribe CallBack====>"); function UnSubscribeCallback() {
done(); console.debug(TAG + "====>UnSubscribe CallBack====>");
} done();
}
commonEvent.createSubscriber(getCallingBundleUri).then(async (data) => {
console.info(TAG + '====>Create Subscriber===='); commonEvent.createSubscriber(getCallingBundleUri).then(async (data) => {
Subscriber = data; console.info(TAG + '====>Create Subscriber====');
console.info(TAG + '====>Create Subscriber====' + JSON.stringify(data) ); Subscriber = data;
await commonEvent.subscribe(Subscriber, SubscribeCallBackUri); console.info(TAG + '====>Create Subscriber====' + JSON.stringify(data) );
}); await commonEvent.subscribe(Subscriber, SubscribeCallBackUri);
});
featureAbility.startAbility({
want: { featureAbility.startAbility({
abilityName: 'com.example.applicationinfo.MainAbility2', want: {
bundleName: 'com.example.applicationinfo', abilityName: 'com.example.applicationinfo.MainAbility2',
uri: '{true,true,false}' bundleName: 'com.example.applicationinfo',
} uri: '{true,true,false}'
}, (err, data) => { }
console.info(TAG + ':startAbility success , err:' + JSON.stringify(err) + ',data:' + JSON.stringify(data)); }, (err, data) => {
}); console.info(TAG + ':startAbility success , err:' + JSON.stringify(err) + ',data:' + JSON.stringify(data));
console.info('------------end SUB_AA_OpenHarmony_Want_0200-------------'); });
}); console.info('------------end SUB_AA_OpenHarmony_Want_0200-------------');
});
/*
* @tc.number SUB_AA_OpenHarmony_Want_0300 /*
* @tc.name Switching the mission in the launcherlist to the foreground is not supported * @tc.number SUB_AA_OpenHarmony_Want_0300
* @tc.desc Function test * @tc.name Switching the mission in the launcherlist to the foreground is not supported
* @tc.level 0 * @tc.desc Function test
*/ * @tc.level 0
it('SUB_AA_OpenHarmony_Want_0300', 0, async function (done) { */
console.info('------------start SUB_AA_OpenHarmony_Want_0300-------------'); it('SUB_AA_OpenHarmony_Want_0300', 0, async function (done) {
TAG = 'SUB_AA_OpenHarmony_Want_0300'; console.info('------------start SUB_AA_OpenHarmony_Want_0300-------------');
var Subscriber = ''; TAG = 'SUB_AA_OpenHarmony_Want_0300';
var Subscriber = '';
function SubscribeCallBackType(err, data) {
console.info(TAG + ' Subscribe CallBack data:' + JSON.stringify(data) + JSON.stringify(err)); function SubscribeCallBackType(err, data) {
expect(data.data == 'MIMETYPE').assertTrue(); console.info(TAG + ' Subscribe CallBack data:' + JSON.stringify(data) + JSON.stringify(err));
commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); expect(data.data == 'MIMETYPE').assertTrue();
done(); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback);
} done();
}
function UnSubscribeCallback() {
console.debug(TAG + "====>UnSubscribe CallBack====>"); function UnSubscribeCallback() {
done(); console.debug(TAG + "====>UnSubscribe CallBack====>");
} done();
}
commonEvent.createSubscriber(getCallingBundleType).then(async (data) => {
console.info(TAG + '====>Create Subscriber====>'); commonEvent.createSubscriber(getCallingBundleType).then(async (data) => {
Subscriber = data; console.info(TAG + '====>Create Subscriber====>');
await commonEvent.subscribe(Subscriber, SubscribeCallBackType); Subscriber = data;
}); await commonEvent.subscribe(Subscriber, SubscribeCallBackType);
});
featureAbility.startAbility({
want: { featureAbility.startAbility({
abilityName: 'com.example.applicationinfo.MainAbility2', want: {
bundleName: 'com.example.applicationinfo', abilityName: 'com.example.applicationinfo.MainAbility2',
type: 'MIMETYPE', bundleName: 'com.example.applicationinfo',
} type: 'MIMETYPE',
}, (err, data) => { }
console.info(TAG + ':startAbility success , err:' + JSON.stringify(err) + ',data:' + JSON.stringify(data)); }, (err, data) => {
}); console.info(TAG + ':startAbility success , err:' + JSON.stringify(err) + ',data:' + JSON.stringify(data));
console.info('------------end SUB_AA_OpenHarmony_Want_0300-------------'); });
}) console.info('------------end SUB_AA_OpenHarmony_Want_0300-------------');
}) })
\ No newline at end of file })
}
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
require('./JsCoverApi.test') import ApplicationInfoTest from './ApplicationInfoJsunit.test.js'
\ No newline at end of file
export default function testsuite() {
ApplicationInfoTest()
}
\ No newline at end of file
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "entry_MainAbility",
"value": "entry_MainAbility" "value": "entry_MainAbility"
}, },
{ {
"name": "description_mainability", "name": "description_mainability",
"value": "JS_Empty Ability" "value": "JS_Empty Ability"
}, },
{ {
"name": "description_mainability2", "name": "description_mainability2",
"value": "JS_Empty Ability" "value": "JS_Empty Ability"
}, },
{ {
"name": "entry_MainAbility2", "name": "entry_MainAbility2",
"value": "entry_MainAbility2" "value": "entry_MainAbility2"
} },
] {
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
} }
\ No newline at end of file
...@@ -9,23 +9,25 @@ ...@@ -9,23 +9,25 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsConfigurationconstantTest") { ohos_js_hap_suite("ActsConfigurationconstantTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsConfigurationconstantTest" hap_name = "ActsConfiGurationConstantTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "300000", "test-timeout": "300000",
"package": "com.example.configuration", "bundle-name": "com.example.configuration",
"shell-timeout": "600000" "package-name": "com.example.configuration",
}, "shell-timeout": "600000",
"kits": [ "testcase-timeout": 10000
{ },
"test-file-name": [ "kits": [
"ActsConfigurationconstantTest.hap" {
], "test-file-name": [
"type": "AppInstallKit", "ActsConfiGurationConstantTest.hap"
"cleanup-apps": true ],
} "type": "AppInstallKit",
] "cleanup-apps": true
} }
]
}
/*
* 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 {Core, ExpectExtend} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
let once = true
export default {
data: {
title: ''
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
if (once) {
once = false
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
id: 'extend'
})
core.addService('expect', expectExtend)
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
this.timeout = 10000
require('../../../test/List.test')
core.execute()
}
},
onReady() {
console.info('onReady');
},
}
{ {
"app": { "app": {
"bundleName": "com.example.configuration", "bundleName": "com.example.configuration",
"vendor": "example", "vendor": "example",
"version": { "version": {
"code": 1, "code": 1,
"name": "1.0" "name": "1.0"
}, },
"apiVersion": { "apiVersion": {
"compatible": 4, "compatible": 4,
"target": 5, "target": 5,
"releaseType": "Beta1" "releaseType": "Beta1"
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.example.configuration", "package": "com.example.configuration",
"name": ".MyApplication", "name": ".entry",
"deviceType": [ "mainAbility": ".MainAbility",
"phone" "srcPath":"",
], "deviceType": [
"distro": { "phone"
"deliveryWithInstall": true, ],
"moduleName": "entry", "distro": {
"moduleType": "entry", "deliveryWithInstall": true,
"installationFree": true "moduleName": "entry",
}, "moduleType": "entry",
"abilities": [ "installationFree": true
{ },
"visible": true, "abilities": [
"name": "com.example.configuration.MainAbility", {
"icon": "$media:icon", "skills": [
"description": "$string:mainability_description", {
"label": "$string:app_name", "entities": [
"type": "page", "entity.system.home"
"isVisible": "true", ],
"launchType": "singleton" "actions": [
} "action.system.home"
], ]
"reqPermissions": [ }
{ ],
"name": "ohos.permission.GET_BUNDLE_INFO", "orientation": "unspecified",
"reason": "need use ohos.permission.INSTALL_BUNDLE" "formsEnabled": false,
}, "name": ".MainAbility",
{ "srcLanguage": "js",
"name": "ohos.permission.UPDATE_CONFIGURATION", "srcPath": "MainAbility",
"reason": "need use ohos.permission.INSTALL_BUNDLE" "icon": "$media:icon",
} "description": "$string:MainAbility_desc",
], "label": "$string:MainAbility_label",
"js": [ "type": "page",
{ "visible": true,
"pages": [ "launchType": "singleton"
"pages/index/index" },
], {
"name": "default", "orientation": "unspecified",
"window": { "formsEnabled": false,
"designWidth": 720, "name": ".TestAbility",
"autoDesignWidth": false "srcLanguage": "js",
} "srcPath": "TestAbility",
} "icon": "$media:icon",
] "description": "$string:TestAbility_desc",
} "label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "singleton"
}
],
"reqPermissions": [
{
"name": "ohos.permission.GET_BUNDLE_INFO",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
},
{
"name": "ohos.permission.UPDATE_CONFIGURATION",
"reason": "need use ohos.permission.INSTALL_BUNDLE"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
} }
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default {
onCreate() { export default {
console.info('AceApplication onCreate'); onCreate() {
}, console.info('AceApplication onCreate');
onDestroy() { },
console.info('AceApplication onDestroy'); onDestroy() {
} console.info('AceApplication onDestroy');
}; }
};
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World" "world": "World"
} }
} }
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
left: 0px; left: 0px;
top: 0px; top: 0px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.title { .title {
font-size: 60px; font-size: 60px;
text-align: center; text-align: center;
width: 100%; width: 100%;
height: 40%; height: 40%;
margin: 10px; margin: 10px;
} }
.btn {
.btn { width: 50%;
width: 50%; height: 100px;
height: 100px; font-size: 40px;
font-size: 40px; }
}
<!-- <!--
Copyright (c) 2021 Huawei Device Co., Ltd. Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<div class="container" onswipe="touchMove"> <div class="container" onswipe="touchMove">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{title}} {{ $t('strings.hello') }} {{title}}
</text> </text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div> </div>
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {Core, ExpectExtend} from 'deccjsunit/index' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
const injectRef = Object.getPrototypeOf(global) || global import testsuite from '../../../test/List.test'
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
let once = true const injectRef = Object.getPrototypeOf(global) || global
export default { injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
data: { let once = true
title: '' export default {
}, data: {
onInit() { title: ''
this.title = this.$t('strings.world'); },
}, onInit() {
onShow() { this.title = this.$t('strings.world');
if (once) { },
once = false onShow() {
console.info('onShow finish') if (once) {
once = false
const core = Core.getInstance() console.info('onShow finish')
const expectExtend = new ExpectExtend({
id: 'extend' var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
}) var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
core.addService('expect', expectExtend) console.info('start run testcase!!!')
core.init() Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
const configService = core.getDefaultService('config') },
configService.setConfig(this) onReady() {
this.timeout = 10000 console.info('onReady');
},
require('../../../test/List.test') }
core.execute()
}
},
onReady() {
console.info('onReady');
},
}
/*
* 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("Application onCreate");
},
onDestroy() {
console.info("Application onDestroy");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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');
}
}
/*
* 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);
})
}
};
/* /*
* Copyright (c) 2022 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import ConfigurationConstant from '@ohos.application.ConfigurationConstant' import ConfigurationConstant from '@ohos.application.ConfigurationConstant'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
export default function ConfigurationTest() {
describe('ConfigurationTest', function () { describe('ConfigurationTest', function () {
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100
* @tc.name colorMode is "ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT" * @tc.name colorMode is "ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100-------------");
expect(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT).assertEqual(1); expect(ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT).assertEqual(1);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0100-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200
* @tc.name colorMode is "ConfigurationConstant.ColorMode.COLOR_MODE_DARK" * @tc.name colorMode is "ConfigurationConstant.ColorMode.COLOR_MODE_DARK"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200-------------");
expect(ConfigurationConstant.ColorMode.COLOR_MODE_DARK).assertEqual(0); expect(ConfigurationConstant.ColorMode.COLOR_MODE_DARK).assertEqual(0);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0200-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300
* @tc.name colorMode is "ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET" * @tc.name colorMode is "ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300-------------");
expect(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET).assertEqual(-1); expect(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET).assertEqual(-1);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_colorMode_0300-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100
* @tc.name Direction is "ConfigurationConstant.Direction.DIRECTION_VERTICAL" * @tc.name Direction is "ConfigurationConstant.Direction.DIRECTION_VERTICAL"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100-------------");
expect(ConfigurationConstant.Direction.DIRECTION_VERTICAL).assertEqual(0); expect(ConfigurationConstant.Direction.DIRECTION_VERTICAL).assertEqual(0);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0100-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200
* @tc.name Direction is "ConfigurationConstant.Direction.DIRECTION_HORIZONTAL" * @tc.name Direction is "ConfigurationConstant.Direction.DIRECTION_HORIZONTAL"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200-------------");
expect(ConfigurationConstant.Direction.DIRECTION_HORIZONTAL).assertEqual(1); expect(ConfigurationConstant.Direction.DIRECTION_HORIZONTAL).assertEqual(1);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0200-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300
* @tc.name Direction is "ConfigurationConstant.Direction.DIRECTION_NOT_SET" * @tc.name Direction is "ConfigurationConstant.Direction.DIRECTION_NOT_SET"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300-------------");
expect(ConfigurationConstant.Direction.DIRECTION_NOT_SET).assertEqual(-1); expect(ConfigurationConstant.Direction.DIRECTION_NOT_SET).assertEqual(-1);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_Direction_0300-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI" * @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI).assertEqual(120); expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI).assertEqual(120);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0100-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_MDPI" * @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_MDPI"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_MDPI).assertEqual(160); expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_MDPI).assertEqual(160);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0200-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_LDPI" * @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_LDPI"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_LDPI).assertEqual(240); expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_LDPI).assertEqual(240);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0300-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XLDPI" * @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XLDPI"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XLDPI).assertEqual(320); expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XLDPI).assertEqual(320);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0400-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXLDPI" * @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXLDPI"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXLDPI).assertEqual(480); expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXLDPI).assertEqual(480);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0500-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXXLDPI" * @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXXLDPI"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXXLDPI).assertEqual(640); expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_XXXLDPI).assertEqual(640);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0600-------------");
}); });
/* /*
* @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700 * @tc.number SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700
* @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET" * @tc.name ScreenDensity is "ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET"
* @tc.desc Function test * @tc.desc Function test
* @tc.level 0 * @tc.level 0
*/ */
it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700', 0, async function (done) { it('SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700', 0, async function (done) {
console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700-------------"); console.log("------------start SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700-------------");
expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET).assertEqual(0); expect(ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_NOT_SET).assertEqual(0);
done(); done();
console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700-------------"); console.log("------------end SUB_AA_OpenHarmony_ConfigurationConstant_ScreenDensity_0700-------------");
}); });
}) })
\ No newline at end of file }
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
require('./JsConfiguration.test.js') import ConfigurationTest from './JsConfiguration.test.js'
\ No newline at end of file
export default function testsuite() {
ConfigurationTest()
}
\ No newline at end of file
{ {
"string": [ "string": [
{ {
"name": "app_name", "name": "app_name",
"value": "JsHelloWorld" "value": "JsHelloWorld"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "hap sample empty page" "value": "hap sample empty page"
} },
] {
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
} }
\ No newline at end of file
...@@ -9,23 +9,25 @@ ...@@ -9,23 +9,25 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsCoverapiTest") { ohos_js_hap_suite("ActsCoverapiTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsCoverapiTest" hap_name = "ActsCoverApiTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "300000", "test-timeout": "300000",
"package": "com.example.coverapi", "shell-timeout": "600000",
"shell-timeout": "600000" "testcase-timeout": 10000,
}, "bundle-name": "com.example.coverapi",
"kits": [ "package-name": "com.example.coverapi"
{ },
"test-file-name": [ "kits": [
"ActsCoverapiTest.hap" {
], "test-file-name": [
"type": "AppInstallKit", "ActsCoverApiTest.hap"
"cleanup-apps": true ],
} "type": "AppInstallKit",
] "cleanup-apps": true
} }
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.coverapi",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.coverapi",
"name": ".MyApplication",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"abilities": [
{
"visible": true,
"name": "com.example.coverapi.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"isVisible": "true",
"launchType": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.coverapi",
"vendor": "example",
"version": {
"code": 1,
"name": "1.0"
},
"apiVersion": {
"compatible": 4,
"target": 5,
"releaseType": "Beta1"
}
},
"deviceConfig": {},
"module": {
"package": "com.example.coverapi",
"name": ".entry",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": true
},
"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": "singleton"
},
{
"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": "singleton"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
},
"mainAbility": ".MainAbility",
"srcPath": ""
}
}
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info('AceApplication onCreate'); console.info('AceApplication onCreate');
}, },
onDestroy() { onDestroy() {
console.info('AceApplication onDestroy'); console.info('AceApplication onDestroy');
} }
}; };
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World" "world": "World"
} }
} }
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "您好", "hello": "您好",
"world": "世界" "world": "世界"
} }
} }
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
left: 0px; left: 0px;
top: 0px; top: 0px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.title { .title {
font-size: 60px; font-size: 60px;
text-align: center; text-align: center;
width: 100%; width: 100%;
height: 40%; height: 40%;
margin: 10px; margin: 10px;
} }
.btn { .btn {
width: 50%; width: 50%;
height: 100px; height: 100px;
font-size: 40px; font-size: 40px;
} }
<!-- <!--
Copyright (c) 2021 Huawei Device Co., Ltd. Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<div class="container" onswipe="touchMove"> <div class="container" onswipe="touchMove">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{title}} {{ $t('strings.hello') }} {{title}}
</text> </text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div> </div>
/*
* 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.
*/
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
let once = true
export default {
data: {
title: ''
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
},
onReady() {
console.info('onReady');
},
}
/*
* 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'
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");
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* 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');
}
}
/*
* 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'] + '.TestAbility'
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);
})
}
};
/* /*
* Copyright (c) 2022 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import appManager from '@ohos.application.appManager'; import appManager from '@ohos.application.appManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium";
describe('CoverApiTest', function () { export default function CoverApiTest() {
describe('CoverApiTest', function () {
/*
* @tc.number SUB_AA_OpenHarmony_CoverApi_0500 /*
* @tc.name whether the system is under stability test * @tc.number SUB_AA_OpenHarmony_CoverApi_0500
* @tc.desc Function test * @tc.name whether the system is under stability test
* @tc.level 0 * @tc.desc Function test
*/ * @tc.level 0
it('SUB_AA_OpenHarmony_CoverApi_0500', 0, async function (done) { */
console.log("------------start SUB_AA_OpenHarmony_CoverApi_0500-------------"); it('SUB_AA_OpenHarmony_CoverApi_0500', 0, async function (done) {
appManager.isRunningInStabilityTest() console.log("------------start SUB_AA_OpenHarmony_CoverApi_0500-------------");
.then((data) => { appManager.isRunningInStabilityTest()
console.info('SUB_AA_OpenHarmony_CoverApi_0500 successful. data: ' + JSON.stringify(data)); .then((data) => {
expect(data == false).assertTrue(); console.info('SUB_AA_OpenHarmony_CoverApi_0500 successful. data: ' + JSON.stringify(data));
done(); expect(data == false).assertTrue();
}).catch((error) => { done();
console.error('SUB_AA_OpenHarmony_CoverApi_0500 failed. error: ' + JSON.stringify(error)); }).catch((error) => {
expect().assertFalse(); console.error('SUB_AA_OpenHarmony_CoverApi_0500 failed. error: ' + JSON.stringify(error));
done(); expect().assertFalse();
}) done();
}); })
}) });
\ No newline at end of file })}
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
require('./ApplicationInfoJsunit.test.js') import CoverApiTest from './JsCoverApi.test.js'
\ No newline at end of file
export default function testsuite() {
CoverApiTest()
}
{ {
"string": [ "string": [
{ {
"name": "app_name", "name": "app_name",
"value": "JsHelloWorld" "value": "JsHelloWorld"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "hap sample empty page" "value": "hap sample empty page"
} },
] {
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
} }
\ No newline at end of file
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import("//test/xts/tools/build/suite.gni") import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsEqueryabilitybywantTest") { ohos_js_hap_suite("ActsEqueryabilitybywantTest") {
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":hjs_demo_js_assets", ":hjs_demo_js_assets",
":hjs_demo_resources", ":hjs_demo_resources",
...@@ -23,11 +23,11 @@ ohos_js_hap_suite("ActsEqueryabilitybywantTest") { ...@@ -23,11 +23,11 @@ ohos_js_hap_suite("ActsEqueryabilitybywantTest") {
hap_name = "ActsEqueryabilitybywantTest" hap_name = "ActsEqueryabilitybywantTest"
} }
ohos_js_assets("hjs_demo_js_assets") { ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./entry/src/main/js"
hap_profile = "entry/src/main/config.json"
js2abc = true js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("hjs_demo_resources") { ohos_resources("hjs_demo_resources") {
sources = [ "./entry/src/main/js/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./entry/src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "300000", "test-timeout": "300000",
"package": "com.example.abilitydisable", "bundle-name": "com.example.abilitydisable",
"shell-timeout": "600000" "package-name": "com.example.abilitydisable",
}, "shell-timeout": "600000"
"kits": [ },
{ "kits": [
"test-file-name": [ {
"ActsEqueryabilitybywantTest.hap" "test-file-name": [
], "ActsEqueryabilitybywantTest.hap"
"type": "AppInstallKit", ],
"cleanup-apps": true "type": "AppInstallKit",
} "cleanup-apps": true
] }
} ]
}
/*
* 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.
*/
.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;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
/*
* 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.
*/
.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;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
{
"strings": {
"hello": "Hello",
"world": "World",
"page": "Second Page",
"next": "Next Page",
"back": "Back"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界",
"page": "第二页",
"next": "下一页",
"back": "返回"
},
"Files": {
}
}
\ 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.
*/
.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;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
{
"strings": {
"hello": "Hello",
"world": "World",
"page": "Second Page",
"next": "Next Page",
"back": "Back"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界",
"page": "第二页",
"next": "下一页",
"back": "返回"
},
"Files": {
}
}
\ 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.
*/
.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;
}
.btn {
width: 50%;
height: 100px;
font-size: 40px;
}
{ {
"app": { "app": {
"bundleName": "com.example.abilitydisable", "bundleName": "com.example.abilitydisable",
"vendor": "example", "vendor": "example",
"version": { "version": {
"code": 1, "code": 1,
"name": "1.0" "name": "1.0"
}, },
"apiVersion": { "apiVersion": {
"compatible": 4, "compatible": 4,
"target": 5, "target": 5,
"releaseType": "Beta1" "releaseType": "Beta1"
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
"module": { "module": {
"package": "com.example.abilitydisable", "package": "com.example.abilitydisable",
"name": ".MyApplication", "name": ".entry",
"deviceType": [ "mainAbility": ".MainAbility",
"phone" "srcPath":"",
], "deviceType": [
"distro": { "phone"
"deliveryWithInstall": true, ],
"moduleName": "entry", "distro": {
"moduleType": "entry", "deliveryWithInstall": true,
"installationFree": true "moduleName": "entry",
}, "moduleType": "entry",
"abilities": [ "installationFree": true
{ },
"skills": [ "abilities": [
{ {
"entities": [ "skills": [
"entity.system.home" {
], "entities": [
"actions": [ "entity.system.home"
"action.system.home" ],
] "actions": [
} "action.system.home"
], ]
"orientation": "unspecified", }
"visible": true, ],
"srcPath": "MainAbility", "orientation": "unspecified",
"name": ".MainAbility", "formsEnabled": false,
"srcLanguage": "js", "name": ".MainAbility",
"icon": "$media:icon", "srcLanguage": "js",
"description": "$string:description_mainability", "srcPath": "MainAbility",
"formsEnabled": false, "icon": "$media:icon",
"label": "$string:entry_MainAbility", "description": "$string:MainAbility_desc",
"type": "page", "label": "$string:MainAbility_label",
"launchType": "standard" "type": "page",
}, "visible": true,
{ "launchType": "standard"
"orientation": "unspecified", },
"srcPath": "MainAbility2", {
"name": ".MainAbility2", "orientation": "unspecified",
"srcLanguage": "js", "formsEnabled": false,
"icon": "$media:icon", "name": ".TestAbility",
"description": "$string:description_mainability2", "srcLanguage": "js",
"formsEnabled": false, "srcPath": "TestAbility",
"label": "$string:entry_MainAbility", "icon": "$media:icon",
"type": "page", "description": "$string:TestAbility_desc",
"launchType": "standard" "label": "$string:TestAbility_label",
}, "type": "page",
{ "visible": true,
"orientation": "unspecified", "launchType": "standard"
"srcPath": "MainAbility3", },
"name": ".MainAbility3", {
"srcLanguage": "js", "orientation": "unspecified",
"icon": "$media:icon", "srcPath": "MainAbility2",
"description": "$string:description_mainability3", "name": ".MainAbility2",
"formsEnabled": false, "srcLanguage": "js",
"label": "$string:entry_MainAbility", "icon": "$media:icon",
"type": "page", "description": "$string:description_mainability2",
"launchType": "standard" "formsEnabled": false,
}, "label": "$string:entry_MainAbility",
{ "type": "page",
"orientation": "unspecified", "launchType": "standard"
"srcPath": "MainAbility4", },
"name": ".MainAbility4", {
"srcLanguage": "js", "orientation": "unspecified",
"icon": "$media:icon", "srcPath": "MainAbility3",
"description": "$string:description_mainability4", "name": ".MainAbility3",
"formsEnabled": false, "srcLanguage": "js",
"label": "$string:entry_MainAbility", "icon": "$media:icon",
"type": "page", "description": "$string:description_mainability3",
"launchType": "standard" "formsEnabled": false,
}, "label": "$string:entry_MainAbility",
{ "type": "page",
"srcPath": "ServiceAbility", "launchType": "standard"
"name": ".ServiceAbility", },
"icon": "$media:icon", {
"srcLanguage": "js", "orientation": "unspecified",
"description": "$string:description_serviceability", "srcPath": "MainAbility4",
"type": "service" "name": ".MainAbility4",
} "srcLanguage": "js",
], "icon": "$media:icon",
"js": [ "description": "$string:description_mainability4",
{ "formsEnabled": false,
"pages": [ "label": "$string:entry_MainAbility",
"pages/index/index", "type": "page",
"pages/second/second" "launchType": "standard"
], },
"name": ".MainAbility", {
"window": { "srcPath": "ServiceAbility",
"designWidth": 720, "name": ".ServiceAbility",
"autoDesignWidth": false "icon": "$media:icon",
} "srcLanguage": "js",
}, "description": "$string:description_serviceability",
{ "type": "service"
"pages": [ }
"pages/index/index", ],
"pages/second/second" "js": [
], {
"name": ".MainAbility2", "pages": [
"window": { "pages/index/index",
"designWidth": 720, "pages/second/second"
"autoDesignWidth": false ],
} "name": ".MainAbility",
}, "window": {
{ "designWidth": 720,
"pages": [ "autoDesignWidth": false
"pages/index/index", }
"pages/second/second" },
], {
"name": ".MainAbility3", "pages": [
"window": { "pages/index/index",
"designWidth": 720, "pages/second/second"
"autoDesignWidth": false ],
} "name": ".MainAbility2",
}, "window": {
{ "designWidth": 720,
"pages": [ "autoDesignWidth": false
"pages/index/index", }
"pages/second/second" },
], {
"name": ".MainAbility4", "pages": [
"window": { "pages/index/index",
"designWidth": 720, "pages/second/second"
"autoDesignWidth": false ],
} "name": ".MainAbility3",
} "window": {
] "designWidth": 720,
} "autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index",
"pages/second/second"
],
"name": ".MainAbility4",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
} }
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default {
onCreate() { export default {
console.info("Application onCreate"); onCreate() {
}, console.info("Application onCreate");
onDestroy() { },
console.info("Application onDestroy"); onDestroy() {
}, console.info("Application onDestroy");
onForgeGround(){ },
console.info("Application onForgeGround"); onForgeGround(){
} console.info("Application onForgeGround");
}; }
};
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World", "world": "World",
"page": "Second Page", "page": "Second Page",
"next": "Next Page", "next": "Next Page",
"back": "Back" "back": "Back"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "您好", "hello": "您好",
"world": "世界", "world": "世界",
"page": "第二页", "page": "第二页",
"next": "下一页", "next": "下一页",
"back": "返回" "back": "返回"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
.container {
.container { display: flex;
display: flex; flex-direction: column;
flex-direction: column; justify-content: center;
justify-content: center; align-items: center;
align-items: center; left: 0px;
left: 0px; top: 0px;
top: 0px; width: 100%;
width: 100%; height: 100%;
height: 100%; }
}
.title {
.title { font-size: 60px;
font-size: 60px; text-align: center;
text-align: center; width: 100%;
width: 100%; height: 40%;
height: 40%; margin: 10px;
margin: 10px; }
}
.btn { .btn {
width: 50%; width: 50%;
height: 100px; height: 100px;
font-size: 40px; font-size: 40px;
} }
<!-- <!--
Copyright (c) 2021 Huawei Device Co., Ltd. Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<div class="container" onswipe="touchMove"> <div class="container" onswipe="touchMove">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{ title }} {{ $t('strings.hello') }} {{ title }}
</text> </text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div> </div>
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import router from '@system.router' import router from '@system.router'
import {Core} from 'deccjsunit/index' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
export default { import testsuite from '../../../test/List.test'
data: {
title: "" export default {
}, data: {
onInit() { title: ""
this.title = 'yingyong1'; },
}, onInit() {
onclick: function () { this.title = 'yingyong1';
router.replace({ },
uri: "pages/second/second" onclick: function () {
}) router.replace({
}, uri: "pages/second/second"
onShow() { })
console.info('onShow start') },
const core = Core.getInstance() onShow() {
console.info('onShow start1') console.info('onShow start')
console.info('onShow start1')
core.init()
console.info('onShow start2') console.info('onShow start2')
const configService = core.getDefaultService('config') console.info('onShow start3')
console.info('onShow start3')
console.info('onShow start4')
configService.setConfig(this)
console.info('onShow start4') console.info('onShow start5')
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
require('../../../test/List.test') var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('onShow start5') console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
core.execute()
} }
} }
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
left: 0px; left: 0px;
top: 0px; top: 0px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.title { .title {
font-size: 60px; font-size: 60px;
text-align: center; text-align: center;
width: 100%; width: 100%;
height: 40%; height: 40%;
margin: 10px; margin: 10px;
} }
.btn { .btn {
width: 50%; width: 50%;
height: 100px; height: 100px;
font-size: 40px; font-size: 40px;
} }
<!-- <!--
Copyright (c) 2021 Huawei Device Co., Ltd. Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<div class="container"> <div class="container">
<text class="title"> <text class="title">
{{ $t('strings.page') }} {{ $t('strings.page') }}
</text> </text>
<input class="btn" type="button" value="{{ $t('strings.back') }}" onclick="onclick"></input> <input class="btn" type="button" value="{{ $t('strings.back') }}" onclick="onclick"></input>
</div> </div>
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import router from '@system.router' import router from '@system.router'
export default { export default {
data: { data: {
title: 'World' title: 'World'
}, },
onclick: function () { onclick: function () {
router.replace({ router.replace({
uri: "pages/index/index" uri: "pages/index/index"
}) })
} }
} }
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info("Application onCreate"); console.info("Application onCreate");
setTimeout(()=>{ setTimeout(()=>{
this.content.terminateSelf().then((data)=>{ this.content.terminateSelf().then((data)=>{
console.log("Application terminateSelf data:" + JSON.stringify(data) ) console.log("Application terminateSelf data:" + JSON.stringify(data) )
}).catch((error)=>{ }).catch((error)=>{
console.log("Application terminateSelf data:" + JSON.stringify(error) ) console.log("Application terminateSelf data:" + JSON.stringify(error) )
}) })
},4000) },4000)
}, },
onDestroy() { onDestroy() {
console.info("Application onDestroy"); console.info("Application onDestroy");
} }
}; };
{ {
"strings": { "strings": {
"hello": "Hello", "hello": "Hello",
"world": "World", "world": "World",
"page": "Second Page", "page": "Second Page",
"next": "Next Page", "next": "Next Page",
"back": "Back" "back": "Back"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
{ {
"strings": { "strings": {
"hello": "您好", "hello": "您好",
"world": "世界", "world": "世界",
"page": "第二页", "page": "第二页",
"next": "下一页", "next": "下一页",
"back": "返回" "back": "返回"
}, },
"Files": { "Files": {
} }
} }
\ No newline at end of file
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
.container {
.container { display: flex;
display: flex; flex-direction: column;
flex-direction: column; justify-content: center;
justify-content: center; align-items: center;
align-items: center; left: 0px;
left: 0px; top: 0px;
top: 0px; width: 100%;
width: 100%; height: 100%;
height: 100%; }
}
.title {
.title { font-size: 60px;
font-size: 60px; text-align: center;
text-align: center; width: 100%;
width: 100%; height: 40%;
height: 40%; margin: 10px;
margin: 10px; }
}
.btn {
.btn { width: 50%;
width: 50%; height: 100px;
height: 100px; font-size: 40px;
font-size: 40px; }
}
<!-- <!--
Copyright (c) 2021 Huawei Device Co., Ltd. Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<div class="container" onswipe="touchMove"> <div class="container" onswipe="touchMove">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{ title }} {{ $t('strings.hello') }} {{ title }}
</text> </text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input> <input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div> </div>
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import router from '@system.router' import router from '@system.router'
import {Core} from 'deccjsunit/index' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
export default { import testsuite from '../../../test/List.test'
data: {
title: "" export default {
}, data: {
onInit() { title: ""
this.title = 'yingyong2'; },
}, onInit() {
onclick: function () { this.title = 'yingyong2';
router.replace({ },
uri: "pages/second/second" onclick: function () {
}) router.replace({
}, uri: "pages/second/second"
onShow() { })
console.info('onShow start') },
const core = Core.getInstance() onShow() {
core.init() console.info('onShow start')
const configService = core.getDefaultService('config') var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
configService.setConfig(this) var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
require('../../../test/List.test') console.info('start run testcase!!!')
core.execute() Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
} }
} }
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
.container { .container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
left: 0px; left: 0px;
top: 0px; top: 0px;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.title { .title {
font-size: 60px; font-size: 60px;
text-align: center; text-align: center;
width: 100%; width: 100%;
height: 40%; height: 40%;
margin: 10px; margin: 10px;
} }
.btn { .btn {
width: 50%; width: 50%;
height: 100px; height: 100px;
font-size: 40px; font-size: 40px;
} }
<!-- <!--
Copyright (c) 2021 Huawei Device Co., Ltd. Copyright (c) 2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
--> -->
<div class="container"> <div class="container">
<text class="title"> <text class="title">
{{ $t('strings.page') }} {{ $t('strings.page') }}
</text> </text>
<input class="btn" type="button" value="{{ $t('strings.back') }}" onclick="onclick"></input> <input class="btn" type="button" value="{{ $t('strings.back') }}" onclick="onclick"></input>
</div> </div>
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import router from '@system.router' import router from '@system.router'
export default { export default {
data: { data: {
title: 'World' title: 'World'
}, },
onclick: function () { onclick: function () {
router.replace({ router.replace({
uri: "pages/index/index" uri: "pages/index/index"
}) })
} }
} }
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import abilityFeatureAbility from '@ohos.ability.featureAbility'; import abilityFeatureAbility from '@ohos.ability.featureAbility';
export default { export default {
onCreate() { onCreate() {
console.info("Application onCreate MainAbility3"); console.info("Application onCreate MainAbility3");
setTimeout(()=>{ setTimeout(()=>{
abilityFeatureAbility.terminateSelf().then((data)=>{ abilityFeatureAbility.terminateSelf().then((data)=>{
console.log("Application terminateSelf data:" + JSON.stringify(data) ) console.log("Application terminateSelf data:" + JSON.stringify(data) )
}).catch((error)=>{ }).catch((error)=>{
console.log("Application terminateSelf data:" + JSON.stringify(error) ) console.log("Application terminateSelf data:" + JSON.stringify(error) )
}) })
},4000) },4000)
}, },
onDestroy() { onDestroy() {
console.info("Application onDestroy"); console.info("Application onDestroy");
} }
}; };
{
"strings": {
"hello": "Hello",
"world": "World",
"page": "Second Page",
"next": "Next Page",
"back": "Back"
},
"Files": {
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册