提交 a7dc1ac2 编写于 作者: X xdmal

Signed-off-by: xdmal <1114560882@qq.com>

 On branch master
 Your branch is up to date with 'origin/master'.
上级 d646e899
......@@ -16,10 +16,14 @@ group("compileruntime") {
testonly = true
if (is_standard_system) {
deps = [
"convertxml_lib_standard:convertxml_js_test",
"process_lib_standard:process_js_test",
"uri_lib_standard:uri_js_test",
"url_lib_standard:url_js_test",
"util_lib_standard:util_js_test",
"worker_lib_standard:worker_js_hap",
"xml_lib_standard:xml_js_test",
# "worker_lib_standard:worker_js_hap",
]
}
}
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("convertxml_js_test") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":convertxml_js_assets",
":convertxml_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ConvertxmlJSApiTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
}
ohos_js_assets("convertxml_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("convertxml_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for startup convertxml js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.convertxml",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ConvertxmlJSApiTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.convertxml",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "com.example.convertxml",
"name": ".MyApplication",
"mainAbility": "com.example.convertxml.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.convertxml.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ No newline at end of file
/*
* 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 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,
* 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('TestApplication onCreate');
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
console.info('AceApplication onDestroy');
}
};
......@@ -2,7 +2,5 @@
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("../../common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<div class="container">
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
......
......@@ -13,13 +13,26 @@
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import device from '@system.device'
import router from '@system.router'
import {Core} from 'deccjsunit/lite'
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect(info.versionName).assertEqual('1.0')
expect(info.versionCode).assertEqual('3')
})
})
\ No newline at end of file
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
core.init()
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
......@@ -13,4 +13,4 @@
* limitations under the License.
*/
require('./ExampleJsunit.test.js')
\ No newline at end of file
require('./convertxml.test.js')
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "URL"
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
"value": "JS_Empty Ability"
}
]
}
}
\ No newline at end of file
......@@ -12,16 +12,25 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("process_js_test") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":process_js_assets",
":process_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsProcessJSApiTest"
hap_name = "ProcessJSApiTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
}
ohos_js_assets("process_js_assets") {
source_dir = "./src/main/js/default"
}
......
......@@ -9,7 +9,7 @@
"kits": [
{
"test-file-name": [
"ActsProcessJSApiTest.hap"
"ProcessJSApiTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -5,6 +5,10 @@
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
......
/*
* 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.
*/
package com.example.childprocess;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* 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.
*/
package com.example.childprocess;
import ohos.aafwk.ability.AbilityPackage;
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
......@@ -2,5 +2,4 @@
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
\ 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 app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite'
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect(info.versionCode).assertEqual('1000000')
})
})
\ No newline at end of file
......@@ -13,5 +13,4 @@
* limitations under the License.
*/
require('./ExampleJsunit.test.js')
require('./Process.test.js')
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* 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 file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
const instrumentLog = new InstrumentLog({
'id': 'report'
})
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.addService('report', instrumentLog)
core.init()
core.subscribeEvent('spec', instrumentLog)
core.subscribeEvent('suite', instrumentLog)
core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ 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 app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect(info.versionName).assertEqual('1.0')
expect(info.versionCode).assertEqual('3')
})
})
\ 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("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("uri_js_test") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":uri_js_assets",
":uri_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "UriJSApiTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
}
ohos_js_assets("uri_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("uri_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for startup uri js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.uri",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"UriJSApiTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.uri",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "com.example.uri",
"name": ".MyApplication",
"mainAbility": "com.example.uri.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.uri.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
......@@ -2,7 +2,5 @@
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
......@@ -2,7 +2,5 @@
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("../../common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<div class="container">
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
......
......@@ -17,7 +17,7 @@ import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
import {Core} from 'deccjsunit/lite'
export default {
data: {
......@@ -29,27 +29,11 @@ export default {
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
const instrumentLog = new InstrumentLog({
'id': 'report'
})
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.addService('report', instrumentLog)
core.init()
core.subscribeEvent('spec', instrumentLog)
core.subscribeEvent('suite', instrumentLog)
core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
}
......@@ -13,4 +13,4 @@
* limitations under the License.
*/
require('./ExampleJsunit.test.js')
\ No newline at end of file
require('./uri.test.js')
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "childprocess"
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
"value": "JS_Empty Ability"
}
]
}
}
\ No newline at end of file
......@@ -12,15 +12,23 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("url_js_test") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":url_js_assets",
":url_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsUrlJsTest"
hap_name = "UrlJsTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
}
ohos_js_assets("url_js_assets") {
source_dir = "./src/main/js/default"
......
......@@ -9,7 +9,7 @@
"kits": [
{
"test-file-name": [
"ActsUrlJsTest.hap"
"UrlJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -5,6 +5,10 @@
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
......
/*
* 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.
*/
package com.example.url;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* 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.
*/
package com.example.url;
import ohos.aafwk.ability.AbilityPackage;
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
/*
* 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 app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite'
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect(info.versionCode).assertEqual('1000000')
})
})
\ No newline at end of file
......@@ -13,4 +13,4 @@
* limitations under the License.
*/
require('./url.test.js')
require('./ExampleJsunit.test.js')
......@@ -12,11 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite'
import Url from '@ohos.url'
describe('UrlFunTest', function () {
/**
* @tc.name: testUrlAppend001
* @tc.desc: Appends a specified key/value pair as a new search parameter.
......@@ -255,7 +253,7 @@ describe('UrlFunTest', function () {
expect(arr[4]).assertEqual("jss")
})
/**
/**
* @tc.name: testUrlForEach001
* @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object.
* @tc.require: AR000GFB2S
......@@ -274,7 +272,7 @@ describe('UrlFunTest', function () {
expect(arr[0]).assertEqual("value1 key1 true");
})
/**
/**
* @tc.name: testUrlForEach002
* @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object.
* @tc.require: AR000GFB2S
......@@ -424,13 +422,7 @@ describe('UrlFunTest', function () {
let params = new Url.URLSearchParams("key1=value1&key2=value2")
params.append("key1","AAA")
var result = params.getAll("key1")
console.info('test result size=' + result.length)
console.info('test result type=' + typeof result )
console.info('test result=' + result)
var s = "value1,AAA"
console.info('test s size=' + s.length)
expect(result[0]).assertEqual("value1")
expect(result[1]).assertEqual("AAA")
expect(result).assertEqual("value1,AAA")
})
/**
......@@ -443,13 +435,7 @@ describe('UrlFunTest', function () {
let params = new Url.URLSearchParams("key1=value1&8=DEF")
params.append("8","A8A")
var result = params.getAll("8")
console.info('test result size=' + result.length)
console.info('test result type=' + typeof result )
console.info('test result=' + result)
var s = "DEF,A8A"
console.info('test s size=' + s.length)
expect(result[0]).assertEqual("DEF")
expect(result[1]).assertEqual("A8A")
expect(result).assertEqual("DEF,A8A")
})
/**
......@@ -459,11 +445,10 @@ describe('UrlFunTest', function () {
* @tc.author: maxiaodong
*/
it('testUrlGetAll003', 0, function () {
let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=")
let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=da")
params.append("key3","A3A")
var result = params.getAll("key3")
expect(result[0]).assertEqual("")
expect(result[1]).assertEqual("A3A")
expect(result).assertEqual("da,A3A")
})
/**
......@@ -474,12 +459,9 @@ describe('UrlFunTest', function () {
*/
it('testUrlGetAll004', 0, function () {
let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大")
params.append("key4","A3A3")
params.append("key3","A3A")
var result = params.getAll("key4")
console.info('test result size=' + result.length)
console.info('test result type=' + typeof result )
console.info('test result=' + result)
expect(result[0]).assertEqual("A3A3")
expect(result).assertEqual('')
})
/**
......@@ -492,12 +474,7 @@ describe('UrlFunTest', function () {
let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大")
params.append("key3","A3A")
var result = params.getAll("key2")
console.info('test result size=' + result.length)
console.info('test result type=' + typeof result )
console.info('test result=' + result)
var s = "value2"
console.info('test s size=' + s.length)
expect(result[0]).assertEqual("value2")
expect(result).assertEqual("value2")
})
/**
......@@ -657,6 +634,7 @@ describe('UrlFunTest', function () {
*/
it('testUrlSet001', 0, function () {
let params = new Url.URLSearchParams("1=value1&2=value2&key3=3");
// params.append("11","ACA");
params.set("11","CCC");
var res = params.toString();
expect(res).assertEqual("1=value1&2=value2&key3=3&11=CCC");
......@@ -702,6 +680,7 @@ describe('UrlFunTest', function () {
*/
it('testUrlSet004', 0, function () {
let params = new Url.URLSearchParams("1=value1&2=value2&key3=3");
// params.append("1","ACA");
params.set("1","CCC");
var res = params.toString();
expect(res).assertEqual("1=CCC&2=value2&key3=3");
......@@ -972,9 +951,9 @@ describe('UrlFunTest', function () {
*/
it('testUrlSearchParamsConstruction003', 0, function () {
let params = new Url.URLSearchParams([
['user', 'abc'],
['query', 'first'],
['query', 'second'],
['user', 'abc'],
['query', 'first'],
['query', 'second'],
]);
var result= params.toString()
expect(result).assertEqual("user=abc&query=first&query=second")
......@@ -1215,7 +1194,7 @@ describe('UrlFunTest', function () {
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it('Url_origin_test_005', 0, function () {
it('testUrlOrigin005', 0, function () {
let params = new Url.URL('http://username:password@host22:100#fragment')
var result= params.origin
expect(result).assertEqual('http://host22:100')
......@@ -1314,12 +1293,9 @@ describe('UrlFunTest', function () {
* @tc.author: zhaoduwei
*/
it('testUrlUsername003', 0, function () {
console.log('testUrlUsername[start]')
let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment')
params.username = 'skk'
console.log('testUrlUsername['+params.username+']')
var result= params.username
console.log('testUrlUsername['+result+']')
expect(result).assertEqual('skk')
})
......@@ -1330,12 +1306,9 @@ describe('UrlFunTest', function () {
* @tc.author: zhaoduwei
*/
it('testUrlUsername004', 0, function () {
console.log('testUrlUsername[start]')
let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment')
params.username = 'skp111'
console.log('testUrlUsername['+params.username+']')
var result= params.username
console.log('testUrlUsername['+result+']')
expect(result).assertEqual('skp111')
})
......@@ -1395,7 +1368,7 @@ describe('UrlFunTest', function () {
*/
it('testUrlPassword004', 0, function () {
let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment')
params.password = "1234"
params.password = '1234'
var result= params.password
expect(result).assertEqual('1234')
})
......@@ -1408,7 +1381,7 @@ describe('UrlFunTest', function () {
*/
it('testUrlPassword005', 0, function () {
let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment')
params.password = "";
params.password = '';
var result= params.password
expect(result).assertEqual('')
})
......@@ -1458,7 +1431,6 @@ describe('UrlFunTest', function () {
it('testUrlHost004', 0, function () {
let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment')
params.host = 'jkjk'
params.password = 'test'
var result= params.host
expect(result).assertEqual('jkjk:8080')
})
......@@ -2044,7 +2016,7 @@ describe('UrlFunTest', function () {
* @tc.require: AR000GFB2S
* @tc.author: zhaoduwei
*/
it('Url_construction_test_011', 0, function () {
it('testUrlConstruction011', 0, function () {
let params = new Url.URL('htt1p://www.0902zy.cn/path?abc=123&def=456#yyyy')
let params1 = new Url.URL('www.baidu.com/ssaa',params)
var result = params1.href
......
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
/*
* 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 file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
const instrumentLog = new InstrumentLog({
'id': 'report',
'version': '1.0.3'
})
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.addService('report', instrumentLog)
core.init()
core.subscribeEvent('spec', instrumentLog)
core.subscribeEvent('suite', instrumentLog)
core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
......@@ -12,15 +12,23 @@
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("util_js_test") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":util_js_assets",
":util_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsUtilJsTest"
hap_name = "UtilJsTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
}
ohos_js_assets("util_js_assets") {
source_dir = "./src/main/js/default"
......
......@@ -9,7 +9,7 @@
"kits": [
{
"test-file-name": [
"ActsUtilJsTest.hap"
"UtilJsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
......
......@@ -5,6 +5,10 @@
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
......
/*
* 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.
*/
package com.example.childprocess;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* 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.
*/
package com.example.childprocess;
import ohos.aafwk.ability.AbilityPackage;
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
/*
* 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.
*/
package com.example.url;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* 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.
*/
package com.example.url;
import ohos.aafwk.ability.AbilityPackage;
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
......@@ -2,5 +2,4 @@
<text class="title">
{{ $t('strings.hello') }} {{title}}
</text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div>
\ No newline at end of file
......@@ -14,4 +14,4 @@
*/
require('./ExampleJsunit.test.js')
require('./TextCodr.test.js')
\ No newline at end of file
require('./util.test.js')
\ 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.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("xml_js_test") {
hap_profile = "./src/main/config.json"
js2abc = true
deps = [
":xml_js_assets",
":xml_resources",
]
# shared_libraries = [
# "//third_party/giflib:libgif",
# "//third_party/libpng:libpng",
# ]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "XmlJSApiTest"
# part_name = "prebuilt_hap"
# subsystem_name = "xts"
}
ohos_js_assets("xml_js_assets") {
source_dir = "./src/main/js/default"
}
ohos_resources("xml_resources") {
sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json"
}
{
"description": "Configuration for startup xml js api Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "60000",
"package": "com.example.xml",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"XmlJSApiTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
\ No newline at end of file
{
"app": {
"bundleName": "com.example.xml",
"vendor": "example",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
}
},
"deviceConfig": {},
"module": {
"package": "com.example.xml",
"name": ".MyApplication",
"mainAbility": "com.example.xml.MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"name": "com.example.xml.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"pages": [
"pages/index/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": true
}
}
]
}
}
\ 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.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
},
onDestroy() {
console.info('AceApplication onDestroy');
}
};
......@@ -2,7 +2,5 @@
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
......@@ -2,7 +2,5 @@
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 40px;
color: #000000;
opacity: 0.9;
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
@media screen and (device-type: wearable) {
.title {
font-size: 28px;
color: #FFFFFF;
}
}
@media screen and (device-type: tv) {
.container {
background-image: url("../../common/images/Wallpaper.png");
background-size: cover;
background-repeat: no-repeat;
background-position: center;
}
.title {
font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
}
<div class="container">
<div class="container" onswipe="touchMove">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
......
......@@ -13,13 +13,26 @@
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import device from '@system.device'
import router from '@system.router'
import {Core} from 'deccjsunit/lite'
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect(info.versionName).assertEqual('1.0')
expect(info.versionCode).assertEqual('3')
})
})
\ No newline at end of file
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
core.init()
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
......@@ -13,4 +13,4 @@
* limitations under the License.
*/
require('./ExampleJsunit.test.js')
\ No newline at end of file
require('./xml.test.js')
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "childprocess"
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
"value": "JS_Empty Ability"
}
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册