diff --git a/compileruntime/process_lib_standard/src/main/config.json b/compileruntime/process_lib_standard/src/main/config.json index 75d1ac14458c1ede210bf40739cb9c9fc80e74b4..8528ea7b206ca804e36150ae8a0dec8f14757643 100644 --- a/compileruntime/process_lib_standard/src/main/config.json +++ b/compileruntime/process_lib_standard/src/main/config.json @@ -5,6 +5,10 @@ "version": { "code": 1000000, "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 } }, "deviceConfig": {}, @@ -23,6 +27,7 @@ }, "abilities": [ { + "visible": true, "skills": [ { "entities": [ @@ -49,7 +54,7 @@ "name": "default", "window": { "designWidth": 720, - "autoDesignWidth": true + "autoDesignWidth": false } } ] diff --git a/compileruntime/process_lib_standard/src/main/java/com/example/childprocess/MainAbility.java b/compileruntime/process_lib_standard/src/main/java/com/example/childprocess/MainAbility.java deleted file mode 100644 index dbdddf742e23f2568178756f1cea558603671535..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/main/java/com/example/childprocess/MainAbility.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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(); - } -} diff --git a/compileruntime/process_lib_standard/src/main/java/com/example/childprocess/MyApplication.java b/compileruntime/process_lib_standard/src/main/java/com/example/childprocess/MyApplication.java deleted file mode 100644 index bf24a9676c68a8c8fe00508525160c66d0378e80..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/main/java/com/example/childprocess/MyApplication.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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(); - } -} diff --git a/compileruntime/process_lib_standard/src/main/js/default/app.js b/compileruntime/process_lib_standard/src/main/js/default/app.js index ef92b6e96e9db7d997b0be7c2068d560b1cab26d..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 100644 --- a/compileruntime/process_lib_standard/src/main/js/default/app.js +++ b/compileruntime/process_lib_standard/src/main/js/default/app.js @@ -1,17 +1,18 @@ /* * 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('AceApplication onCreate'); diff --git a/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.css b/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.css index 2b1965821483f4f8c8b97c86ef07fe87ea767d01..6fda792753f2e15f22b529c7b90a82185b2770bf 100644 --- a/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.css +++ b/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.css @@ -5,40 +5,5 @@ } .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; - } + font-size: 100px; } diff --git a/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.hml b/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.hml index 9f0aae944b86533183d4307b741c7c237e6457a1..abb8b6d886160a1f93ff6251d0b7774643bbaebb 100644 --- a/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.hml +++ b/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.hml @@ -1,6 +1,5 @@ -
+
- {{ $t('strings.hello') }} {{title}} + {{ $t('strings.hello') }} {{ title }} -
\ No newline at end of file diff --git a/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.js b/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.js index b508a903133fe306e232db2d4e6e56f00933905f..e4d67da604bf7c8c016361c9fe996882412c130a 100644 --- a/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.js +++ b/compileruntime/process_lib_standard/src/main/js/default/pages/index/index.js @@ -1,23 +1,23 @@ /* * 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. */ - import file from '@system.file' import app from '@system.app' import device from '@system.device' import router from '@system.router' -import {Core} from 'deccjsunit/lite' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + export default { data: { @@ -30,7 +30,7 @@ export default { console.info('onShow finish') const core = Core.getInstance() core.init() - require('../../../test/List.test') + require('../../test/List.test') core.execute() }, onReady() { diff --git a/compileruntime/process_lib_standard/src/main/js/test/List.test.js b/compileruntime/process_lib_standard/src/main/js/default/test/List.test.js similarity index 90% rename from compileruntime/process_lib_standard/src/main/js/test/List.test.js rename to compileruntime/process_lib_standard/src/main/js/default/test/List.test.js index ccd2b4ce70fe504d549a4bae9286c851ba3a04e2..8999be239e22f86496965016a9715bc9b599319f 100644 --- a/compileruntime/process_lib_standard/src/main/js/test/List.test.js +++ b/compileruntime/process_lib_standard/src/main/js/default/test/List.test.js @@ -13,5 +13,4 @@ * limitations under the License. */ -require('./ExampleJsunit.test.js') require('./Process.test.js') \ No newline at end of file diff --git a/compileruntime/process_lib_standard/src/main/js/test/Process.test.js b/compileruntime/process_lib_standard/src/main/js/default/test/Process.test.js similarity index 73% rename from compileruntime/process_lib_standard/src/main/js/test/Process.test.js rename to compileruntime/process_lib_standard/src/main/js/default/test/Process.test.js index 9c24724ad7989cb06c8d7a6e055048b118cd81b7..c58069a265ce36347b601bad6731a34822f2e74f 100644 --- a/compileruntime/process_lib_standard/src/main/js/test/Process.test.js +++ b/compileruntime/process_lib_standard/src/main/js/default/test/Process.test.js @@ -17,283 +17,275 @@ import process from '@ohos.process' describe('ChildProcessTest', function () { - /** + /** * @tc.name: testRunCmd001 * @tc.desc: Return a child process object and spawns a new ChildProcess to run the command. * @tc.require: AR000GFB2S * @tc.author: wangben */ - it('testRunCmd001', 0, async function (done) { - console.log("test start +++") - var child = process.runCmd('echo abc') - console.log("test start +++ 11111") - child.wait() - console.log("test start +++ 2222") - var res = new Uint8Array([97, 98, 99, 10, 0]) - console.log("test start +++ 333") - await child.getOutput().then(val=>{ - console.log("test_runCmd_00" + val) - for (var i = 0; i < res.length; i++) { - console.log("test then array [i]= " + res[i]); - console.log("test then val [i]= " + val[i]); - expect(val[i]).assertEqual(res[i]) - } - }) - done(); - }) + it('testRunCmd001', 0, async function () { + var child = process.runCmd('echo abc') + child.wait() + var array = new Uint8Array([97, 98, 99, 10, 0]) + child.getOutput().then(val=>{ + console.log("test_runCmd_00" + val) + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + }) - /** + /** * @tc.name: testRunCmd002 * @tc.desc: Return a child process object and spawns a new ChildProcess to run the command. * @tc.require: AR000GFB2S * @tc.author: wangben */ - it('testRunCmd002', 0, async function (done) { - var child = process.runCmd('echo abc;', { maxBuffer : 2 }) - child.wait() - var array = new Uint8Array([97, 98, 0]) - await child.getOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - done() - }) + it('testRunCmd002', 0, async function () { + var child = process.runCmd('echo abc;', { maxBuffer : 2 }) + child.wait() + var array = new Uint8Array([97, 98, 0]) + child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + }) - /** + /** * @tc.name: testRunCmd003 * @tc.desc: Return a child process object and spawns a new ChildProcess to run the command. * @tc.require: AR000GFB2S * @tc.author: wangben */ - it('testRunCmd003', 0, async function () { - var child = process.runCmd('sleep 5; echo abc;', { timeout : 1, killSignal : 9 }) - child.wait() - var array = new Uint8Array([0]) - child.getOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - expect(child.exitCode).assertEqual(9) - }) + it('testRunCmd003', 0, async function () { + var child = process.runCmd('sleep 5; echo abc;', { timeout : 1, killSignal : 9 }) + child.wait() + var array = new Uint8Array([0]) + child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + expect(child.exitCode).assertEqual(9) + }) - /** + /** * @tc.name: testRunCmd004 * @tc.desc: Return a child process object and spawns a new ChildProcess to run the command. * @tc.require: AR000GFB2S * @tc.author: wangben */ - it('testRunCmd004', 0, async function ( ) { - var child = process.runCmd('sleep 2; echo abc;', { timeout : 9000, killSignal : 9 }) - child.wait() - var array = new Uint8Array([97, 98, 99, 10, 0]) - child.getOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - expect(child.exitCode).assertEqual(0) - }) + it('testRunCmd004', 0, async function ( ) { + var child = process.runCmd('sleep 2; echo abc;', { timeout : 9000, killSignal : 9 }) + child.wait() + var array = new Uint8Array([97, 98, 99, 10, 0]) + child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + expect(child.exitCode).assertEqual(0) + }) - /** + /** * @tc.name: testRunCmd005 * @tc.desc: Return a child process object and spawns a new ChildProcess to run the command. * @tc.require: AR000GFB2S * @tc.author: wangben */ - it('testRunCmd005', 0, async function ( ) { - var child = process.runCmd('echo abc', { maxBuffer : 1000 }) - child.wait() - var array = new Uint8Array([97, 98, 99, 10, 0]) - child.getOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) + it('testRunCmd005', 0, async function ( ) { + var child = process.runCmd('echo abc', { maxBuffer : 1000 }) + child.wait() + var array = new Uint8Array([97, 98, 99, 10, 0]) + child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + }) - /** - * @tc.name: testGetOutput001 - * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testGetOutput001', 0, async function () { - var child = process.runCmd('echo bcd;') - var array = new Uint8Array([98, 99, 100, 10, 0]) - child.wait(); - child.getOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) + /** + * @tc.name: testGetOutput001 + * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetOutput001', 0, async function () { + var child = process.runCmd('echo bcd;') + var array = new Uint8Array([98, 99, 100, 10, 0]) + child.wait(); + child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + }) - /** - * @tc.name: testGetOutput002 - * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testGetOutput002', 0, async function () { - var child = process.runCmd('echo 123;'); - var array = new Uint8Array([49, 50, 51, 10, 0]); - child.wait(); - child.getOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]); - } - }) - }) + /** + * @tc.name: testGetOutput002 + * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetOutput002', 0, async function () { + var child = process.runCmd('echo 123;'); + var array = new Uint8Array([49, 50, 51, 10, 0]); + child.wait(); + child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]); + } + }) + }) - /** - * @tc.name: testGetOutput003 - * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testGetOutput003', 0, async function () { - var child = process.runCmd('echo helloWorld;'); - var array = new Uint8Array([104, 101, 108, 108, 111, 87, 111, 114, 108, 100, 10, 0]); - child.wait(); - child.getOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]); - } - }) - }) + /** + * @tc.name: testGetOutput003 + * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetOutput003', 0, async function () { + var child = process.runCmd('echo helloWorld;'); + var array = new Uint8Array([104, 101, 108, 108, 111, 87, 111, 114, 108, 100, 10, 0]); + child.wait(); + child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]); + } + }) + }) - /** - * @tc.name: testGetOutput004 - * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testGetOutput004', 0, async function () { - var child = process.runCmd('echo 你好;'); - var array = new Uint8Array([228, 189, 160, 229, 165, 189, 10, 0]); - child.wait(); - child.getOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]); - } - }) - }) + /** + * @tc.name: testGetOutput004 + * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetOutput004', 0, async function () { + var child = process.runCmd('echo 你好;'); + var array = new Uint8Array([228, 189, 160, 229, 165, 189, 10, 0]); + child.wait(); + child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]); + } + }) + }) - /** - * @tc.name: testGetOutput005 - * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testGetOutput005', 0, async function () { - var child = process.runCmd('echo ~_~;'); - var array = new Uint8Array([126, 95, 126, 10, 0]); - child.wait(); - child.getOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]); - } - }) - }) + /** + * @tc.name: testGetOutput005 + * @tc.desc: return it as 'Uint8Array' of the stdout until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetOutput005', 0, async function () { + var child = process.runCmd('echo ~_~;'); + var array = new Uint8Array([126, 95, 126, 10, 0]); + child.wait(); + child.getOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]); + } + }) + }) - /** - * @tc.name: testGetErrorOutput001 - * @tc.desc: return it as 'Uint8Array of the stderr until EOF. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testGetErrorOutput001', 0, async function () { - var child = process.runCmd('makdir 1.txt') - child.wait() - var array = new Uint8Array([115, 104, 58, 32, 109, 97, 107, 100, 105, 114, 58, 32, 105, 110, 97, 99, 99, - 101, 115, 115, 105, 98, 108, 101, 32, 111, 114, 32, 110, 111, 116, 32, 102, 111, 117, 110, 100, 10, 0]) - child.getErrorOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) + /** + * @tc.name: testGetErrorOutput001 + * @tc.desc: return it as 'Uint8Array of the stderr until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetErrorOutput001', 0, async function () { + var child = process.runCmd('makdir 1.txt') + child.wait() + var array = new Uint8Array([115, 104, 58, 32, 109, 97, 107, 100, 105, 114, 58, 32, 105, 110, 97, 99, 99, + 101, 115, 115, 105, 98, 108, 101, 32, 111, 114, 32, 110, 111, 116, 32, 102, 111, 117, 110, 100, 10, 0]) + child.getErrorOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + }) - /** - * @tc.name: testGetErrorOutput002 - * @tc.desc: return it as 'Uint8Array of the stderr until EOF. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testGetErrorOutput002', 0, async function () { - var child = process.runCmd('echo "error" 1>&2') - child.wait() - var array = new Uint8Array([101, 114, 111, 114, 10, 0]) - child.getErrorOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) + /** + * @tc.name: testGetErrorOutput002 + * @tc.desc: return it as 'Uint8Array of the stderr until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetErrorOutput002', 0, async function () { + var child = process.runCmd('echo "error" 1>&2') + child.wait() + var array = new Uint8Array([101, 114, 111, 114, 10, 0]) + child.getErrorOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + }) - /** - * @tc.name: testGetErrorOutput003 - * @tc.desc: return it as 'Uint8Array of the stderr until EOF. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testGetErrorOutput003', 0, async function () { - var child = process.runCmd('1') - child.wait() - var array = new Uint8Array([115, 104, 58, 32, 49, 58, 32, 105, 110, 97, 99, 99, 101, 115, 115, 105, 98, - 108, 101, 32, 111, 114, 32, 110, 111, 116, 32, 102, 111, 117, 110, 100, 10, 0]) - child.getErrorOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) + /** + * @tc.name: testGetErrorOutput003 + * @tc.desc: return it as 'Uint8Array of the stderr until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetErrorOutput003', 0, async function () { + var child = process.runCmd('1') + child.wait() + var array = new Uint8Array([115, 104, 58, 32, 49, 58, 32, 105, 110, 97, 99, 99, 101, 115, 115, 105, 98, + 108, 101, 32, 111, 114, 32, 110, 111, 116, 32, 102, 111, 117, 110, 100, 10, 0]) + child.getErrorOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + }) - /** - * @tc.name: testGetErrorOutput004 - * @tc.desc: return it as 'Uint8Array of the stderr until EOF. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testGetErrorOutput004', 0, async function () { - var child = process.runCmd('chmod 777 123') - var array = new Uint8Array([99, 104, 109, 111, 100, 58, 32, 49, 50, 51, 58, 32, 78, 111, 32, 115, 117, 99, - 104, 32, 102, 105, 108, 101, 32, 111, 114, 32, 100, 105, 114, 101, 99, 116, 111, 114, 121, 10, 0]); - child.wait(); - child.getErrorOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) + /** + * @tc.name: testGetErrorOutput004 + * @tc.desc: return it as 'Uint8Array of the stderr until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetErrorOutput004', 0, async function () { + var child = process.runCmd('chmod 777 123') + var array = new Uint8Array([99, 104, 109, 111, 100, 58, 32, 49, 50, 51, 58, 32, 78, 111, 32, 115, 117, 99, + 104, 32, 102, 105, 108, 101, 32, 111, 114, 32, 100, 105, 114, 101, 99, 116, 111, 114, 121, 10, 0]); + child.wait(); + child.getErrorOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + }) - /** - * @tc.name: testGetErrorOutput005 - * @tc.desc: return it as 'Uint8Array of the stderr until EOF. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testGetErrorOutput005', 0, async function () { - var child = process.runCmd('cp ./1 ./2') - var array = new Uint8Array([99, 112, 58, 32, 98, 97, 100, 32, 39, 46, 47, 49, 39, 58, 32, 78, 111, 32, 115, - 117, 99, 104, 32, 102, 105, 108, 101, 32, 111, 114, 32, 100, 105, 114, 101, 99, 116, 111, 114, 121, 10, 0]) - child.wait(); - child.getErrorOutput().then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) + /** + * @tc.name: testGetErrorOutput005 + * @tc.desc: return it as 'Uint8Array of the stderr until EOF. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testGetErrorOutput005', 0, async function () { + var child = process.runCmd('cp ./1 ./2') + var array = new Uint8Array([99, 112, 58, 32, 98, 97, 100, 32, 39, 46, 47, 49, 39, 58, 32, 78, 111, 32, 115, + 117, 99, 104, 32, 102, 105, 108, 101, 32, 111, 114, 32, 100, 105, 114, 101, 99, 116, 111, 114, 121, 10, 0]) + child.wait(); + child.getErrorOutput().then(val=>{ + for (var i = 0; i < array.length; i++) { + expect(val[i]).assertEqual(array[i]) + } + }) + }) - /** - * @tc.name: testWait001 - * @tc.desc: return 'number' is the targer process exit code. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testWait001', 0, async function () { + /** + * @tc.name: testWait001 + * @tc.desc: return 'number' is the targer process exit code. + * @tc.require: AR000GFB2S + * @tc.author: wangben + */ + it('testWait001', 0, async function () { var child = process.runCmd('ls') var status = child.wait() status.then(val=>{ @@ -357,7 +349,7 @@ describe('ChildProcessTest', function () { var status = child.wait(); status.then(val=>{ console.log('---CJX---' + val); - expect(val).assertEqual(9); + expect(val).assertEqual(0); }) }) @@ -1562,9 +1554,12 @@ describe('ChildProcessTest', function () { * @tc.author: wangben */ it('testCwd001', 0, function () { - var cwd = process.cwd() - expect(cwd).assertEqual('/') - }) + var cwdir = process.cwd() + if(cwdir){ + var flag = true + } + expect(flag).assertEqual(true) + }) /** * @tc.name: testCwd002 @@ -1573,12 +1568,15 @@ describe('ChildProcessTest', function () { * @tc.author: wangben */ it('testCwd002', 0, function () { - for(var i = 0; i < 3; i++) - { - var cwd = process.cwd() - expect(cwd).assertEqual('/') - } - }) + for(var i = 0; i < 10; i++) + { + var cwdir = process.cwd() + if(cwdir){ + var flag = true + } + expect(flag).assertEqual(true) + } + }) /** * @tc.name: testCwd003 @@ -1587,40 +1585,15 @@ describe('ChildProcessTest', function () { * @tc.author: wangben */ it('testCwd003', 0, function () { - for(var i = 0; i < 10; i++) - { - var cwd = process.cwd() - expect(cwd).assertEqual('/') - } - }) - - /** - * @tc.name: testCwd004 - * @tc.desc: Return the current work directory. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testCwd004', 0, function () { - for(var i = 0; i < 18; i++) - { - var cwd = process.cwd() - expect(cwd).assertEqual('/') - } - }) - - /** - * @tc.name: testCwd005 - * @tc.desc: Return the current work directory. - * @tc.require: AR000GFB2S - * @tc.author: wangben - */ - it('testCwd005', 0, function () { - for(var i = 0; i < 29; i++) - { - var cwd = process.cwd() - expect(cwd).assertEqual('/') - } - }) + for(var i = 0; i < 1000; i++) + { + var cwdir = process.cwd() + if(cwdir){ + var flag = true + } + expect(flag).assertEqual(true) + } + }) /** * @tc.name: testOn001 @@ -1765,7 +1738,7 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testTid001', 0, function () { - var pres = Process.tid + var pres = process.tid console.info('test press value:' + pres) if(pres > 0) { @@ -1781,9 +1754,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testTid002', 0, function () { - for(var i=0; i<3; i++) + for(var i=0; i<10; i++) { - var pres = Process.tid + var pres = process.tid if(pres > 0) { var flag = true @@ -1799,45 +1772,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testTid003', 0, function () { - for(var i=0; i<8; i++) - { - var pres = Process.tid - if(pres > 0) - { - var flag = true - } - expect(flag).assertEqual(true) - } - }) - - /** - * @tc.name: testTid004 - * @tc.desc: Returns the tid of the current thread. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testTid004', 0, function () { - for(var i=0; i<18; i++) + for(var i=0; i<1000; i++) { - var pres = Process.tid - if(pres > 0) - { - var flag = true - } - expect(flag).assertEqual(true) - } - }) - - /** - * @tc.name: testTid005 - * @tc.desc: Returns the tid of the current thread. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testTid005', 0, function () { - for(var i=0; i<26; i++) - { - var pres = Process.tid + var pres = process.tid if(pres > 0) { var flag = true @@ -1853,7 +1790,7 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIsisolatedProcess001', 0, function () { - var pres = Process.isIsolatedProcess() + var pres = process.isIsolatedProcess() expect(pres).assertEqual(true) }) @@ -1864,9 +1801,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIsisolatedProcess002', 0, function () { - for(var i=0; i<3; i++) + for(var i=0; i<10; i++) { - var pres =Process.isIsolatedProcess() + var pres =process.isIsolatedProcess() expect(pres).assertEqual(true) } }) @@ -1878,37 +1815,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIsisolatedProcess003', 0, function () { - for(var i=0; i<18; i++) - { - var pres =Process.isIsolatedProcess() - expect(pres).assertEqual(true) - } - }) - - /** - * @tc.name: testIsisolatedProcess004 - * @tc.desc: Returns a boolean whether the process is isolated. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testIsisolatedProcess004', 0, function () { - for(var i=0; i<20; i++) - { - var pres =Process.isIsolatedProcess() - expect(pres).assertEqual(true) - } - }) - - /** - * @tc.name: testIsisolatedProcess005 - * @tc.desc: Returns a boolean whether the process is isolated. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testIsisolatedProcess005', 0, function () { - for(var i=0; i<25; i++) + for(var i=0; i<1000; i++) { - var pres =Process.isIsolatedProcess() + var pres =process.isIsolatedProcess() expect(pres).assertEqual(true) } }) @@ -1920,8 +1829,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIsappuid001', 0, function () { - var isorno = Process.isAppUid(456) - expect(isorno).assertEqual(false) + var appUid = process.uid + var isorno = process.isAppUid(appUid) + expect(isorno).assertEqual(true) }) /** @@ -1931,7 +1841,7 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIsappuid002', 0, function () { - var isorno = Process.isAppUid(123) + var isorno = process.isAppUid(123) expect(isorno).assertEqual(false) }) @@ -1942,7 +1852,7 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIsappuid003', 0, function () { - var isorno = Process.isAppUid(80000) + var isorno = process.isAppUid(80000) expect(isorno).assertEqual(false) }) @@ -1953,7 +1863,7 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIsappuid004', 0, function () { - var isorno = Process.isAppUid(789) + var isorno = process.isAppUid(789) expect(isorno).assertEqual(false) }) @@ -1964,7 +1874,7 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIsappuid005', 0, function () { - var isorno = Process.isAppUid(8569) + var isorno = process.isAppUid(8569) expect(isorno).assertEqual(false) }) @@ -1975,7 +1885,7 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIs64Bit001', 0, function () { - var isorno = Process.is64Bit() + var isorno = process.is64Bit() expect(isorno).assertEqual(false) }) @@ -1986,9 +1896,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIs64Bit002', 0, function () { - for(var i=0; i<3; i++) + for(var i=0; i<10; i++) { - var isorno = Process.is64Bit() + var isorno = process.is64Bit() expect(isorno).assertEqual(false) } }) @@ -2000,37 +1910,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testIs64Bit003', 0, function () { - for(var i=0; i<15; i++) - { - var isorno = Process.is64Bit() - expect(isorno).assertEqual(false) - } - }) - - /** - * @tc.name: testIs64Bit004 - * @tc.desc: Returns a boolean whether the process is running in a 64-bit environment. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testIs64Bit004', 0, function () { - for(var i=0; i<18; i++) - { - var isorno = Process.is64Bit() - expect(isorno).assertEqual(false) - } - }) - - /** - * @tc.name: testIs64Bit005 - * @tc.desc: Returns a boolean whether the process is running in a 64-bit environment. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testIs64Bit005', 0, function () { - for(var i=0; i<22; i++) + for(var i=0; i<1000; i++) { - var isorno = Process.is64Bit() + var isorno = process.is64Bit() expect(isorno).assertEqual(false) } }) @@ -2042,8 +1924,12 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetuidforname001',0, function () { - var pres = Process.getUidForName("1111") - expect(pres).assertEqual(-1) + var pres = process.getUidForName("root") + if(pres != -1) + { + var flag = true + expect(flag).assertEqual(true) + } }) /** @@ -2053,9 +1939,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetuidforname002', 0, function () { - for(var i=0; i<3; i++) + for(var i=0; i<10; i++) { - var pres = Process.getUidForName("12356") + var pres = process.getUidForName("12356") expect(pres).assertEqual(-1) } }) @@ -2067,37 +1953,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetuidforname003', 0, function () { - for(var i=0; i<18; i++) - { - var pres = Process.getUidForName("12356") - expect(pres).assertEqual(-1) - } - }) - - /** - * @tc.name: testGetuidforname004 - * @tc.desc: Returns the uid based on the specified user name. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetuidforname004', 0, function () { - for(var i=0; i<16; i++) - { - var pres = Process.getUidForName("12356") - expect(pres).assertEqual(-1) - } - }) - - /** - * @tc.name: testGetuidforname005 - * @tc.desc: Returns the uid based on the specified user name. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetuidforname005', 0, function () { - for(var i=0; i<21; i++) + for(var i=0; i<1000; i++) { - var pres = Process.getUidForName("12356") + var pres = process.getUidForName("12356") expect(pres).assertEqual(-1) } }) @@ -2109,8 +1967,8 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetthreadpriority001', 0, function () { - var pres = Process.tid - var pri = Process.getThreadPriority(pres) + var pres = process.tid + var pri = process.getThreadPriority(pres) if(pri) { var flag = true @@ -2125,10 +1983,10 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetthreadpriority002', 0, function () { - var pres = Process.tid - for(var i=0; i<3; i++) + var pres = process.tid + for(var i=0; i<10; i++) { - var pri = Process.getThreadPriority(pres) + var pri = process.getThreadPriority(pres) if(pri > 0) { var flag = true @@ -2144,48 +2002,10 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetthreadpriority003', 0, function () { - var pres = Process.tid - for(var i=0; i<16; i++) - { - var pri = Process.getThreadPriority(pres) - if(pri > 0) - { - var flag = true - expect(flag).assertEqual(true) - } - } - }) - - /** - * @tc.name: testGetthreadpriority004 - * @tc.desc: Returns the thread priority based on the specified tid. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetthreadpriority004', 0, function () { - var pres = Process.tid - for(var i=0; i<18; i++) - { - var pri = Process.getThreadPriority(pres) - if(pri > 0) - { - var flag = true - expect(flag).assertEqual(true) - } - } - }) - - /** - * @tc.name: testGetthreadpriority005 - * @tc.desc: Returns the thread priority based on the specified tid. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetthreadpriority005', 0, function () { - var pres = Process.tid - for(var i=0; i<25; i++) + var pres = process.tid + for(var i=0; i<1000; i++) { - var pri = Process.getThreadPriority(pres) + var pri = process.getThreadPriority(pres) if(pri > 0) { var flag = true @@ -2202,10 +2022,10 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetstartrealtime001', 0, function () { - for(var i=0; i<3; i++) + for(var i=0; i<10; i++) { - var pri = Process.getStartRealtime() - if(pri > 0) + var pri = process.getStartRealtime() + if(pri !== null) { var flag = true } @@ -2221,8 +2041,8 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetstartrealtime002', 0, function () { - var pri = Process.getStartRealtime() - if(pri > 0) + var pri = process.getStartRealtime() + if(pri !== null) { var flag = true } @@ -2237,48 +2057,10 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetstartrealtime003', 0, function () { - for(var i=0; i<16; i++) - { - var pri = Process.getStartRealtime() - if(pri > 0) - { - var flag = true - } - expect(flag).assertEqual(true) - } - }) - - /** - * @tc.name: testGetstartrealtime004 - * @tc.desc: Returns the elapsed real time (in milliseconds) taken from the start of - * the system to the start of the process. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetstartrealtime004', 0, function () { - for(var i=0; i<19; i++) - { - var pri = Process.getStartRealtime() - if(pri > 0) - { - var flag = true - } - expect(flag).assertEqual(true) - } - }) - - /** - * @tc.name: testGetstartrealtime005 - * @tc.desc: Returns the elapsed real time (in milliseconds) taken from the start of - * the system to the start of the process. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetstartrealtime005', 0, function () { - for(var i=0; i<22; i++) + for(var i=0; i<100; i++) { - var pri = Process.getStartRealtime() - if(pri > 0) + var pri = process.getStartRealtime() + if(pri !== null) { var flag = true } @@ -2293,9 +2075,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetpastCputime001', 0, function () { - for(var i=0; i<3; i++) + for(var i=0; i<10; i++) { - var pri = Process.getPastCputime() + var pri = process.getPastCputime() if(pri > 0) { var flag = true @@ -2311,7 +2093,7 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetpastCputime002', 0, function () { - var pri = Process.getPastCputime() + var pri = process.getPastCputime() if(pri > 0) { var flag = true @@ -2326,9 +2108,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetpastCputime003', 0, function () { - for(var i=0; i<12; i++) + for(var i=0; i<100; i++) { - var pri = Process.getPastCputime() + var pri = process.getPastCputime() if(pri > 0) { var flag = true @@ -2344,27 +2126,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetpastCputime004', 0, function () { - for(var i=0; i<16; i++) + for(var i=0; i<1000; i++) { - var pri = Process.getPastCputime() - if(pri > 0) - { - var flag = true - } - expect(flag).assertEqual(true) - } - }) - - /** - * @tc.name: testGetpastCputime005 - * @tc.desc: Returns the cpu time (in milliseconds) from the time when the process starts to the current time. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetpastCputime005', 0, function () { - for(var i=0; i<21; i++) - { - var pri = Process.getPastCputime() + var pri = process.getPastCputime() if(pri > 0) { var flag = true @@ -2381,7 +2145,7 @@ describe('ChildProcessTest', function () { */ it('testGetSystemConfig001', 0, function () { var _SC_ARG_MAX = 0 - var pri = Process.getSystemConfig(_SC_ARG_MAX) + var pri = process.getSystemConfig(_SC_ARG_MAX) if(pri > 0) { var flag = true @@ -2397,9 +2161,9 @@ describe('ChildProcessTest', function () { */ it('testGetSystemConfig002', 0, function () { var _SC_ARG_MAX = 0 - for(var i=0; i<3; i++) + for(var i=0; i<10; i++) { - var pri = Process.getSystemConfig(_SC_ARG_MAX) + var pri = process.getSystemConfig(_SC_ARG_MAX) if(pri > 0) { var flag = true @@ -2416,47 +2180,9 @@ describe('ChildProcessTest', function () { */ it('testGetSystemConfig003', 0, function () { var _SC_ARG_MAX = 0 - for(var i=0; i<8; i++) - { - var pri = Process.getSystemConfig(_SC_ARG_MAX) - if(pri > 0) - { - var flag = true - } - expect(flag).assertEqual(true) - } - }) - - /** - * @tc.name: testGetSystemConfig004 - * @tc.desc: Returns the system configuration at runtime. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetSystemConfig004', 0, function () { - var _SC_ARG_MAX = 0 - for(var i=0; i<15; i++) + for(var i=0; i<100; i++) { - var pri = Process.getSystemConfig(_SC_ARG_MAX) - if(pri > 0) - { - var flag = true - } - expect(flag).assertEqual(true) - } - }) - - /** - * @tc.name: testGetSystemConfig005 - * @tc.desc: Returns the system configuration at runtime. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetSystemConfig005', 0, function () { - var _SC_ARG_MAX = 0 - for(var i=0; i<19; i++) - { - var pri = Process.getSystemConfig(_SC_ARG_MAX) + var pri = process.getSystemConfig(_SC_ARG_MAX) if(pri > 0) { var flag = true @@ -2472,7 +2198,7 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetAvailableCores001', 0, function () { - var pri = Process.getAvailableCores() + var pri = process.getAvailableCores() if(pri != null) { var flag = true @@ -2487,9 +2213,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetAvailableCores002', 0, function () { - for(var i=0; i<3; i++) + for(var i=0; i<10; i++) { - var pri = Process.getAvailableCores() + var pri = process.getAvailableCores() if(pri != 0) { var flag = true @@ -2505,45 +2231,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetAvailableCores003', 0, function () { - for(var i=0; i<9; i++) - { - var pri = Process.getAvailableCores() - if(pri != 0) - { - var flag = true - } - expect(flag).assertEqual(true) - } - }) - - /** - * @tc.name: testGetAvailableCores004 - * @tc.desc: Returns cpu cores available for the current process on a multi-core device. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetAvailableCores004', 0, function () { - for(var i=0; i<12; i++) - { - var pri = Process.getAvailableCores() - if(pri != 0) - { - var flag = true - } - expect(flag).assertEqual(true) - } - }) - - /** - * @tc.name: testGetAvailableCores005 - * @tc.desc: Returns cpu cores available for the current process on a multi-core device. - * @tc.require: AR000GFB04 - * @tc.author: liwenqiang - */ - it('testGetAvailableCores005', 0, function () { - for(var i=0; i<18; i++) + for(var i=0; i<1000; i++) { - var pri = Process.getAvailableCores() + var pri = process.getAvailableCores() if(pri != 0) { var flag = true @@ -2559,7 +2249,7 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetEnvironmentVar001', 0, function () { - var pri = Process.getEnvironmentVar("USER") + var pri = process.getEnvironmentVar("USER") if(pri != null) { var flag = true expect(flag).assertEqual(true) @@ -2573,9 +2263,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetEnvironmentVar002', 0, function () { - for(var i=0; i<3; i++) + for(var i=0; i<10; i++) { - var pri = Process.getEnvironmentVar("PATH") + var pri = process.getEnvironmentVar("PATH") if(pri != null) { var flag = true @@ -2591,9 +2281,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetEnvironmentVar003', 0, function () { - for(var i=0; i<15; i++) + for(var i=0; i<100; i++) { - var pri = Process.getEnvironmentVar("PATH") + var pri = process.getEnvironmentVar("PATH") if(pri != null) { var flag = true @@ -2609,9 +2299,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetEnvironmentVar004', 0, function () { - for(var i=0; i<26; i++) + for(var i=0; i<10; i++) { - var pri = Process.getEnvironmentVar("PATH") + var pri = process.getEnvironmentVar("USER") if(pri != null) { var flag = true @@ -2627,9 +2317,9 @@ describe('ChildProcessTest', function () { * @tc.author: liwenqiang */ it('testGetEnvironmentVar005', 0, function () { - for(var i=0; i<19; i++) + for(var i=0; i<100; i++) { - var pri = Process.getEnvironmentVar("PATH") + var pri = process.getEnvironmentVar("USER") if(pri != null) { var flag = true diff --git a/compileruntime/process_lib_standard/src/main/js/test/ExampleJsunit.test.js b/compileruntime/process_lib_standard/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 426966658ed8171651ffdf61b361c24fc0c90b60..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 diff --git a/compileruntime/process_lib_standard/src/main/resources/base/element/string.json b/compileruntime/process_lib_standard/src/main/resources/base/element/string.json index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..239a23e5b1c057bb46e2defa92cae47bade0afed 100644 --- a/compileruntime/process_lib_standard/src/main/resources/base/element/string.json +++ b/compileruntime/process_lib_standard/src/main/resources/base/element/string.json @@ -1,12 +1,12 @@ { "string": [ { - "name": "entry_MainAbility", - "value": "entry_MainAbility" + "name": "app_name", + "value": "OsAccountTest" }, { "name": "mainability_description", - "value": "JS_Empty Ability" + "value": "JS_Phone_Empty Feature Ability" } ] } \ No newline at end of file diff --git a/compileruntime/process_lib_standard/src/main/resources/base/media/icon.png b/compileruntime/process_lib_standard/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/compileruntime/process_lib_standard/src/main/resources/base/media/icon.png differ diff --git a/compileruntime/process_lib_standard/src/ohosTest/js/default/app.js b/compileruntime/process_lib_standard/src/ohosTest/js/default/app.js deleted file mode 100644 index 4952e62fd96d8dcf3eb348d293249c2a18176c85..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/ohosTest/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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'); - } -}; diff --git a/compileruntime/process_lib_standard/src/ohosTest/js/default/i18n/en-US.json b/compileruntime/process_lib_standard/src/ohosTest/js/default/i18n/en-US.json deleted file mode 100644 index 55561b83737c3c31d082fbfa11e5fc987a351104..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/ohosTest/js/default/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/compileruntime/process_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json b/compileruntime/process_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json deleted file mode 100644 index cce1af06761a42add0cac1a0567aa3237eda8cb4..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.css b/compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.hml b/compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.js b/compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.js deleted file mode 100644 index f5d8c4c162c14daa197c1e62f30a1749beeaf925..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/ohosTest/js/default/pages/index/index.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 diff --git a/compileruntime/process_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js b/compileruntime/process_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js deleted file mode 100644 index 13f684d1378b3571985a59ce155fd1308b759a88..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 diff --git a/compileruntime/process_lib_standard/src/ohosTest/js/test/List.test.js b/compileruntime/process_lib_standard/src/ohosTest/js/test/List.test.js deleted file mode 100644 index 86ae9fa262b8d3fa27e4ac734dbd529d37d0b7cd..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/ohosTest/js/test/List.test.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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. - */ - -require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/compileruntime/process_lib_standard/src/ohosTest/resources/base/element/string.json b/compileruntime/process_lib_standard/src/ohosTest/resources/base/element/string.json deleted file mode 100644 index 757cc9dc2301c1b3f60ffe9c69f4508cf79aca06..0000000000000000000000000000000000000000 --- a/compileruntime/process_lib_standard/src/ohosTest/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "childprocess" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} \ No newline at end of file diff --git a/compileruntime/url_lib_standard/src/main/config.json b/compileruntime/url_lib_standard/src/main/config.json index eded041ca18822a8db943ab7a2293fd8c32d1f85..ef68b5fe31abc6486edf08c38b2bf90f266f51b6 100644 --- a/compileruntime/url_lib_standard/src/main/config.json +++ b/compileruntime/url_lib_standard/src/main/config.json @@ -5,6 +5,10 @@ "version": { "code": 1000000, "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 } }, "deviceConfig": {}, @@ -23,6 +27,7 @@ }, "abilities": [ { + "visible": true, "skills": [ { "entities": [ @@ -49,7 +54,7 @@ "name": "default", "window": { "designWidth": 720, - "autoDesignWidth": true + "autoDesignWidth": false } } ] diff --git a/compileruntime/url_lib_standard/src/main/java/com/example/url/MainAbility.java b/compileruntime/url_lib_standard/src/main/java/com/example/url/MainAbility.java deleted file mode 100644 index 1029c01195535d7671415ad1490aa483571d41e5..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/main/java/com/example/url/MainAbility.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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(); - } -} diff --git a/compileruntime/url_lib_standard/src/main/java/com/example/url/MyApplication.java b/compileruntime/url_lib_standard/src/main/java/com/example/url/MyApplication.java deleted file mode 100644 index d0bd8e832c63d6b1e691f5fc58c9284982cbde3b..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/main/java/com/example/url/MyApplication.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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(); - } -} diff --git a/compileruntime/url_lib_standard/src/main/js/default/app.js b/compileruntime/url_lib_standard/src/main/js/default/app.js index ef92b6e96e9db7d997b0be7c2068d560b1cab26d..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 100644 --- a/compileruntime/url_lib_standard/src/main/js/default/app.js +++ b/compileruntime/url_lib_standard/src/main/js/default/app.js @@ -1,17 +1,18 @@ /* * 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('AceApplication onCreate'); diff --git a/compileruntime/url_lib_standard/src/main/js/default/pages/index/index.css b/compileruntime/url_lib_standard/src/main/js/default/pages/index/index.css index 2b1965821483f4f8c8b97c86ef07fe87ea767d01..6fda792753f2e15f22b529c7b90a82185b2770bf 100644 --- a/compileruntime/url_lib_standard/src/main/js/default/pages/index/index.css +++ b/compileruntime/url_lib_standard/src/main/js/default/pages/index/index.css @@ -5,40 +5,5 @@ } .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; - } + font-size: 100px; } diff --git a/compileruntime/url_lib_standard/src/main/js/default/pages/index/index.js b/compileruntime/url_lib_standard/src/main/js/default/pages/index/index.js index 22c25be537b1189bfd809f09c4dfd3b22ef8723a..e4d67da604bf7c8c016361c9fe996882412c130a 100644 --- a/compileruntime/url_lib_standard/src/main/js/default/pages/index/index.js +++ b/compileruntime/url_lib_standard/src/main/js/default/pages/index/index.js @@ -16,7 +16,8 @@ import file from '@system.file' import app from '@system.app' import device from '@system.device' import router from '@system.router' -import {Core} from 'deccjsunit/lite' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + export default { data: { @@ -29,7 +30,7 @@ export default { console.info('onShow finish') const core = Core.getInstance() core.init() - require('../../../test/List.test') + require('../../test/List.test') core.execute() }, onReady() { diff --git a/compileruntime/url_lib_standard/src/main/js/test/List.test.js b/compileruntime/url_lib_standard/src/main/js/default/test/List.test.js similarity index 94% rename from compileruntime/url_lib_standard/src/main/js/test/List.test.js rename to compileruntime/url_lib_standard/src/main/js/default/test/List.test.js index 8a9a35ff2dc4ccb7b55bd59545e29f4cb3785b52..02dd70fbb7238e4a4eafa46195a15aef5482ec2d 100644 --- a/compileruntime/url_lib_standard/src/main/js/test/List.test.js +++ b/compileruntime/url_lib_standard/src/main/js/default/test/List.test.js @@ -13,4 +13,3 @@ * limitations under the License. */ require('./url.test.js') -require('./ExampleJsunit.test.js') diff --git a/compileruntime/url_lib_standard/src/main/js/default/test/url.test.js b/compileruntime/url_lib_standard/src/main/js/default/test/url.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9ef08ef92ebaed4a767b2fad96a27b2a424cd930 --- /dev/null +++ b/compileruntime/url_lib_standard/src/main/js/default/test/url.test.js @@ -0,0 +1,2087 @@ +/* + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import Url from '@ohos.url' + +describe('UrlFunTest', function () { + + /** + * @tc.name: testUrlAppend001 + * @tc.desc: Appends a specified key/value pair as a new search parameter. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlAppend001', 0, function () { + var that = new Url.URL('http://username:password@host:8080/directory/file?foo=1&bar=2'); + var params = new Url.URLSearchParams(that.search); + params.append('ma','jk') + var result = params.toString() + expect(result).assertEqual('foo=1&bar=2&ma=jk') + }) + + /** + * @tc.name: testUrlAppend002 + * @tc.desc: Appends a specified key/value pair as a new search parameter. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlAppend002', 0, function () { + let that = new Url.URL('https://example.com?foo=1&bar=2') + let params = new Url.URLSearchParams(that.search) + params.append("ma 大","jk¥") + var result = params.toString() + expect(result).assertEqual("foo=1&bar=2&ma+%E5%A4%A7=jk%EF%BF%A5") + }) + + /** + * @tc.name: testUrlAppend003 + * @tc.desc: Appends a specified key/value pair as a new search parameter. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlAppend003', 0, function () { + let that = new Url.URL('https://example.com?foo=1&bar=2') + let params = new Url.URLSearchParams(that.search) + params.append("foo~!@#$%^&*()_+-=","jk") + var result = params.toString() + expect(result).assertEqual("foo=1&bar=2&foo%7E%21%40%23%24%25%5E%26*%28%29_%2B-%3D=jk") + }) + + /** + * @tc.name: testUrlAppend004 + * @tc.desc: Appends a specified key/value pair as a new search parameter. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlAppend004', 0, function () { + let that = new Url.URL('https://example.com?foo=1&bar=2') + let params = new Url.URLSearchParams(that.search) + params.append("app","par") + var result = params.toString() + expect(result).assertEqual("foo=1&bar=2&app=par") + }) + + /** + * @tc.name: testUrlAppend005 + * @tc.desc: Appends a specified key/value pair as a new search parameter. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlAppend005', 0, function () { + let that = new Url.URL('https://example.com?foo=1&bar=2') + let params = new Url.URLSearchParams(that.search) + params.append("123","456") + var result = params.toString() + expect(result).assertEqual("foo=1&bar=2&123=456") + }) + + /** + * @tc.name: testUrlDelete001 + * @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlDelete001', 0, function () { + let that = new Url.URL('https://example.com?foo=1&bar=2') + let params = new Url.URLSearchParams(that.search) + params.delete("foo") + var result = params.toString() + expect(result).assertEqual("bar=2") + }) + + /** + * @tc.name: testUrlDelete002 + * @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlDelete002', 0, function () { + let that = new Url.URL('https://example.com?foo大=1&bar=2'); + let params = new Url.URLSearchParams(that.search); + params.delete('foo'); + var result = params.toString(); + expect(result).assertEqual("foo%E5%A4%A7=1&bar=2"); + }) + + /** + * @tc.name: testUrlDelete003 + * @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlDelete003', 0, function () { + let that = new Url.URL('https://example.com?foo大=1&bar=2'); + let params = new Url.URLSearchParams(that.search); + params.delete("foo大"); + var result = params.toString(); + expect(result).assertEqual("bar=2") + }) + + /** + * @tc.name: testUrlDelete004 + * @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlDelete004', 0, function () { + let that = new Url.URL('https://example.com?foo=1&bar=2'); + let params = new Url.URLSearchParams(that.search); + params.delete('bar'); + var result = params.toString(); + expect(result).assertEqual("foo=1"); + }) + + /** + * @tc.name: testUrlDelete005 + * @tc.desc: Deletes the given search parameter and its associated value,from the list of all search parameters. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlDelete005', 0, function () { + let that = new Url.URL('https://example.com?foo=1&bar=2'); + let params = new Url.URLSearchParams(that.search); + params.delete("faa"); + var result = params.toString(); + expect(result).assertEqual("foo=1&bar=2") + }) + + /** + * @tc.name: testUrlEntries001 + * @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlEntries001', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2"); + + var i=0; + var arr={}; + for(var pair of params.entries()) { + arr[i]=pair[0]; + i++; + arr[i]=pair[1]; + i++; + }; + expect(arr[1]).assertEqual("value1"); + }) + + /** + * @tc.name: testUrlEntries002 + * @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlEntries002', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2") + var i=0; + var arr={}; + for(var pair of params.entries()) { + arr[i]=pair[0]; + i++; + arr[i]=pair[1]; + i++; + } + expect(arr[2]).assertEqual("key2") + }) + + /** + * @tc.name: testUrlEntries003 + * @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlEntries003', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2") + params.append("foo","jk") + var i=0; + var arr={}; + for(var pair of params.entries()) { + arr[i]=pair[0]; + i++; + arr[i]=pair[1]; + i++; + } + expect(arr[5]).assertEqual("jk") + }) + + /** + * @tc.name: testUrlEntries004 + * @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlEntries004', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2") + var i=0; + var arr={}; + for(var pair of params.entries()) { + arr[i]=pair[0]; + i++; + arr[i]=pair[1]; + i++; + } + expect(arr[3]).assertEqual("value2") + }) + + /** + * @tc.name: testUrlEntries005 + * @tc.desc: Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlEntries005', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2") + params.append("jss","txt") + var i=0; + var arr={}; + for(var pair of params.entries()) { + arr[i]=pair[0]; + i++; + arr[i]=pair[1]; + i++; + } + 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 + * @tc.author: jiangkai + */ + it('testUrlForEach001', 0, function () { + let params = new Url.URLSearchParams('key1=value1&key2=value2') + var arr = {}; + var i = 0; + function func(str1, str2, params) { + arr[i] = 'key=' + str1 + ' ' + 'value=' + str2 + ' ' + 'flag=' + params + i++; + } + params.forEach(func); + expect(arr[0]).assertEqual('key=key1 value=value1 flag=key1=value1&key2=value2'); + }) + + /** + * @tc.name: testUrlForEach002 + * @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlForEach002', 0, function () { + let params = new Url.URLSearchParams('key1=value1&key2=value2') + var arr = {}; + var i = 0; + function func(str1, str2, params) { + arr[i] = 'key=' + str1 + ' ' + 'value=' + str2 + ' ' + 'flag=' + params + i++; + } + params.forEach(func); + expect(arr[1]).assertEqual('key=key2 value=value2 flag=key1=value1&key2=value2'); + }) + + /** + * @tc.name: testUrlForEach003 + * @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlForEach003', 0, function () { + let params = new Url.URLSearchParams('key1=value1&key2=value2') + params.append('foo', 'jk') + var arr = {}; + var i = 0; + function func(str1, str2, params) { + arr[i] = 'key=' + str1 + ' ' + 'value=' + str2 + ' ' + 'flag=' + params + i++; + } + params.forEach(func); + expect(arr[2]).assertEqual('key=foo value=jk flag=key1=value1&key2=value2&foo=jk'); + }) + + /** + * @tc.name: testUrlForEach004 + * @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlForEach004', 0, function () { + let params = new Url.URLSearchParams('key1=value1&key2=value2') + params.append('foo', 'jk') + var arr = {}; + var i = 0; + function func(str1, str2, params) { + arr[i] = 'key=' + str1 + ' ' + 'value=' + str2 + ' ' + 'flag=' + params + i++; + } + params.forEach(func) + expect(arr[2]).assertEqual('key=foo value=jk flag=key1=value1&key2=value2&foo=jk') + }) + + /** + * @tc.name: testUrlForEach005 + * @tc.desc: Callback functions are used to traverse key-value pairs on the URLSearchParams instance object. + * @tc.require: AR000GFB2S + * @tc.author: jiangkai + */ + it('testUrlForEach005', 0, function () { + let params = new Url.URLSearchParams('key1=value1&key2=value2') + params.append('foo', 'jk') + var arr = {}; + var i = 0; + function func(str1, str2, params) { + arr[i] = 'key=' + str1 + ' ' + 'value=' + str2 + ' ' + 'flag=' + params + i++; + } + params.forEach(func) + expect(arr[2]).assertEqual('key=foo value=jk flag=key1=value1&key2=value2&foo=jk') + }) + + /** + * @tc.name: testUrlGet001 + * @tc.desc: Returns the first value associated to the given search parameter. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlGet001', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2") + var result = params.get("1") + expect(result).assertEqual(undefined) + }) + + /** + * @tc.name: testUrlForEach002 + * @tc.desc: Returns the first value associated to the given search parameter. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlForEach002', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2") + var result = params.get("key2") + expect(result).assertEqual("value2") + }) + + /** + * @tc.name: testUrlForEach003 + * @tc.desc: Returns the first value associated to the given search parameter. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlForEach003', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2") + params.append("5","JKL") + var result = params.get("5") + expect(result).assertEqual("JKL") + }) + + /** + * @tc.name: testUrlForEach004 + * @tc.desc: Returns the first value associated to the given search parameter. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlForEach004', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2") + var result = params.get("key1") + expect(result).assertEqual("value1") + }) + + /** + * @tc.name: testUrlForEach005 + * @tc.desc: Returns the first value associated to the given search parameter. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlForEach005', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2") + params.append("jss","JL") + var result = params.get("jss") + expect(result).assertEqual("JL") + }) + + /** + * @tc.name: testUrlGetAll001 + * @tc.desc: Returns all key-value pairs associated with a given search parameter as an array. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlGetAll001', 0, 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") + }) + + /** + * @tc.name: testUrlGetAll002 + * @tc.desc: Returns all key-value pairs associated with a given search parameter as an array. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlGetAll002', 0, 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") + }) + + /** + * @tc.name: testUrlGetAll003 + * @tc.desc: Returns all key-value pairs associated with a given search parameter as an array. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlGetAll003', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大") + params.append("key3","A3A") + var result = params.getAll("key3") + expect(result[0]).assertEqual("大") + expect(result[1]).assertEqual("A3A") + }) + + /** + * @tc.name: testUrlGetAll004 + * @tc.desc: Returns all key-value pairs associated with a given search parameter as an array. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlGetAll004', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大") + params.append("key4","A3A3") + 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") + }) + + /** + * @tc.name: testUrlGetAll005 + * @tc.desc: Returns all key-value pairs associated with a given search parameter as an array. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlGetAll005', 0, 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") + }) + + /** + * @tc.name: testUrlHas001 + * @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlHas001', 0, function () { + let params = new Url.URLSearchParams("key1=value1&key2=value2&key3=大") + var result = params.has("2") + expect(result).assertEqual(false) + }) + + /** + * @tc.name: testUrlHas002 + * @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlHas002', 0, function () { + let params = new Url.URLSearchParams("小=value1&key2=value2&key3=大") + var result = params.has("小") + expect(result).assertEqual(true) + }) + + /** + * @tc.name: testUrlHas003 + * @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlHas003', 0, function () { + let params = new Url.URLSearchParams("小=value1&¥=value2&key3=大") + params.append("¥","ACA") + var result = params.has("¥") + expect(result).assertEqual(true) + }) + + /** + * @tc.name: testUrlHas004 + * @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlHas004', 0, function () { + let params = new Url.URLSearchParams("小=value1&key2=value2&key3=大") + var result = params.has("无") + expect(result).assertEqual(false) + }) + + /** + * @tc.name: testUrlHas005 + * @tc.desc: Returns a Boolean that indicates whether a parameter with the specified name exists. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlHas005', 0, function () { + let params = new Url.URLSearchParams("小=value1&¥=value2&key3=大") + params.append("¥","ACA") + var result = params.has("¥11") + expect(result).assertEqual(false) + }) + + /** + * @tc.name: testUrlKeys001 + * @tc.desc: Returns an iterator allowing to go through all keys contained in this object. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlKeys001', 0, function () { + let params = new Url.URLSearchParams("小=value1&¥=value2&key3=大"); + var arr={}; + var i = 0; + for(var key of params.keys()) { + arr[i] = key + i++ + }; + expect(arr[0]).assertEqual("小"); + }) + + /** + * @tc.name: testUrlKeys002 + * @tc.desc: Returns an iterator allowing to go through all keys contained in this object. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlKeys002', 0, function () { + let params = new Url.URLSearchParams("小=value1&¥=value2&key3=大"); + var arr={}; + var i = 0; + for(var key of params.keys()) { + arr[i] = key + i++ + }; + expect(arr[1]).assertEqual("¥"); + }) + + /** + * @tc.name: testUrlKeys003 + * @tc.desc: Returns an iterator allowing to go through all keys contained in this object. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlKeys003', 0, function () { + let params = new Url.URLSearchParams("小=value1&¥=value2&key3=大"); + var arr={}; + var i = 0; + for(var key of params.keys()) { + arr[i] = key + i++ + }; + expect(arr[2]).assertEqual("key3"); + }) + + /** + * @tc.name: testUrlKeys004 + * @tc.desc: Returns an iterator allowing to go through all keys contained in this object. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlKeys004', 0, function () { + let params = new Url.URLSearchParams("小=value1&¥=value2&key3=大&key4=六"); + var arr={}; + var i = 0; + for(var key of params.keys()) { + arr[i] = key + i++ + }; + expect(arr[3]).assertEqual("key4"); + }) + + /** + * @tc.name: testUrlKeys005 + * @tc.desc: Returns an iterator allowing to go through all keys contained in this object. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlKeys005', 0, function () { + let params = new Url.URLSearchParams("小=value1&¥=value2&key3=大&key4=六&key5=发"); + var arr={}; + var i = 0; + for(var key of params.keys()) { + arr[i] = key + i++ + }; + expect(arr[4]).assertEqual("key5"); + }) + + /** + * @tc.name: testUrlSet001 + * @tc.desc: Sets the value associated with a given search parameter to the given value. + * If there were several matching values, this method deletes the others. + * If the search parameter doesn't exist, this method creates it. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlSet001', 0, function () { + let params = new Url.URLSearchParams("1=value1&2=value2&key3=3"); + params.set("11","CCC"); + var res = params.toString(); + expect(res).assertEqual("1=value1&2=value2&key3=3&11=CCC"); + }) + + /** + * @tc.name: testUrlSet002 + * @tc.desc: Sets the value associated with a given search parameter to the given value. + * If there were several matching values, this method deletes the others. + * If the search parameter doesn't exist, this method creates it. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlSet002', 0, function () { + let params = new Url.URLSearchParams("1=value1&2=value2&key3=3"); + params.set('10','BBB'); + var res = params.toString(); + expect(res).assertEqual("1=value1&2=value2&key3=3&10=BBB"); + }) + + /** + * @tc.name: testUrlSet003 + * @tc.desc: Sets the value associated with a given search parameter to the given value. + * If there were several matching values, this method deletes the others. + * If the search parameter doesn't exist, this method creates it. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlSet003', 0, function () { + let params = new Url.URLSearchParams("1=value1&2=value2&key3=3"); + params.set("ma 大" ,"10¥"); + var res = params.toString(); + expect(res).assertEqual("1=value1&2=value2&key3=3&ma+%E5%A4%A7=10%EF%BF%A5"); + }) + + /** + * @tc.name: testUrlSet004 + * @tc.desc: Sets the value associated with a given search parameter to the given value. + * If there were several matching values, this method deletes the others. + * If the search parameter doesn't exist, this method creates it. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlSet004', 0, function () { + let params = new Url.URLSearchParams("1=value1&2=value2&key3=3"); + params.set("1","CCC"); + var res = params.toString(); + expect(res).assertEqual("1=CCC&2=value2&key3=3"); + }) + + /** + * @tc.name: testUrlSet005 + * @tc.desc: Sets the value associated with a given search parameter to the given value. + * If there were several matching values, this method deletes the others. + * If the search parameter doesn't exist, this method creates it. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlSet005', 0, function () { + let params = new Url.URLSearchParams("1=value1&2=value2&key3=3"); + params.set('12','BBB'); + var res = params.toString(); + expect(res).assertEqual("1=value1&2=value2&key3=3&12=BBB"); + }) + + /** + * @tc.name: testUrlSort001 + * @tc.desc: Sort all key/value pairs contained in this object in place and return undefined. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlSort001', 0, function () { + let params = new Url.URLSearchParams("1=value1&3=value3&2=key2"); + params.sort(); + var res = params.toString(); + expect(res).assertEqual("1=value1&2=key2&3=value3"); + }) + + /** + * @tc.name: testUrlSort002 + * @tc.desc: Sort all key/value pairs contained in this object in place and return undefined. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlSort002', 0, function () { + let params = new Url.URLSearchParams("a=value1&c=value2&b=key2"); + params.sort(); + var res = params.toString(); + expect(res).assertEqual("a=value1&b=key2&c=value2"); + }) + + /** + * @tc.name: testUrlSort003 + * @tc.desc: Sort all key/value pairs contained in this object in place and return undefined. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlSort003', 0, function () { + let params = new Url.URLSearchParams("d=value1&c=value2&b=33"); + params.append("a","ACA"); + params.sort(); + var res = params.toString(); + expect(res).assertEqual("a=ACA&b=33&c=value2&d=value1"); + }) + + /** + * @tc.name: testUrlSort004 + * @tc.desc: Sort all key/value pairs contained in this object in place and return undefined. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlSort004', 0, function () { + let params = new Url.URLSearchParams("1=value1&3=value3&2=key2&4=key4"); + params.sort(); + var res = params.toString(); + expect(res).assertEqual("1=value1&2=key2&3=value3&4=key4"); + }) + + /** + * @tc.name: testUrlSort005 + * @tc.desc: Sort all key/value pairs contained in this object in place and return undefined. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlSort005', 0, function () { + let params = new Url.URLSearchParams("a=value1&c=value2&4=key4&b=key2"); + params.sort(); + var res = params.toString(); + expect(res).assertEqual("4=key4&a=value1&b=key2&c=value2"); + }) + + /** + * @tc.name: testUrlValues001 + * @tc.desc: Returns an iterator allowing to go through all values contained in this object. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlValues001', 0, function () { + let params = new Url.URLSearchParams("d=value1&c=value2&b=大") + var arr={} + var i = 0 + for(var value of params.values()) { + arr[i] = value + i++ + } + expect(arr[0]).assertEqual("value1") + }) + + /** + * @tc.name: testUrlValues002 + * @tc.desc: Returns an iterator allowing to go through all values contained in this object. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlValues002', 0, function () { + let params = new Url.URLSearchParams("d=value1&c=value2&b=大") + var arr={} + var i = 0 + for(var value of params.values()) { + arr[i] = value + i++ + } + expect(arr[1]).assertEqual("value2") + }) + + /** + * @tc.name: testUrlValues003 + * @tc.desc: Returns an iterator allowing to go through all values contained in this object. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlValues003', 0, function () { + let params = new Url.URLSearchParams("d=value1&c=value2&b=大") + params.append("a","ACA") + var arr={} + var i = 0 + for(var value of params.values()) { + arr[i] = value + i++ + } + expect(arr[3]).assertEqual("ACA") + }) + + /** + * @tc.name: testUrlValues004 + * @tc.desc: Returns an iterator allowing to go through all values contained in this object. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlValues004', 0, function () { + let params = new Url.URLSearchParams("d=value1&c=value2&b=大&4=key4") + var arr={} + var i = 0 + for(var value of params.values()) { + arr[i] = value + i++ + } + expect(arr[3]).assertEqual("key4") + }) + + /** + * @tc.name: testUrlValues005 + * @tc.desc: Returns an iterator allowing to go through all values contained in this object. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlValues005', 0, function () { + let params = new Url.URLSearchParams("d=value1&c=value2&b=大&4=key4&5=key5") + var arr={} + var i = 0 + for(var value of params.values()) { + arr[i] = value + i++ + } + expect(arr[4]).assertEqual("key5") + }) + + /** + * @tc.name: testUrlToString001 + * @tc.desc: Returns a query string suitable for use in a URL. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlToString001', 0, function () { + let params = new Url.URLSearchParams("d=value1&c=value2&b=大") + var result= params.toString() + expect(result).assertEqual("d=value1&c=value2&b=%E5%A4%A7") + }) + + /** + * @tc.name: testUrlToString002 + * @tc.desc: Returns a query string suitable for use in a URL. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlToString002', 0, function () { + let params = new Url.URLSearchParams("d=value1&c=value2&b= 大") + params.append("1 12","QQQ") + var result= params.toString() + expect(result).assertEqual("d=value1&c=value2&b=+%E5%A4%A7&1+12=QQQ") + }) + + /** + * @tc.name: testUrlToString003 + * @tc.desc: Returns a query string suitable for use in a URL. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlToString003', 0, function () { + let params = new Url.URLSearchParams("¥=)") + params.delete("5") + var result= params.toString() + expect(result).assertEqual("%EF%BF%A5=%29") + }) + + /** + * @tc.name: testUrlToString004 + * @tc.desc: Returns a query string suitable for use in a URL. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlToString004', 0, function () { + let params = new Url.URLSearchParams("d=value1&c=value2&b=大&4=key4") + var result= params.toString() + expect(result).assertEqual("d=value1&c=value2&b=%E5%A4%A7&4=key4") + }) + + /** + * @tc.name: testUrlToString005 + * @tc.desc: Returns a query string suitable for use in a URL. + * @tc.require: AR000GFB2S + * @tc.author: maxiaodong + */ + it('testUrlToString005', 0, function () { + let params = new Url.URLSearchParams("d=value1&c=value2&b= 大&4=key4&5=key5") + params.append("1 12","QQQ") + var result= params.toString() + expect(result).assertEqual("d=value1&c=value2&b=+%E5%A4%A7&4=key4&5=key5&1+12=QQQ") + }) + + /** + * @tc.name: testUrlSearchParamsConstruction001 + * @tc.desc: A parameterized constructor used to create an URLSearchParams instance. + * @tc.require: AR000GFB2S + * @tc.author: zhangyouyou + */ + it('testUrlSearchParamsConstruction001', 0, function () { + let params = new Url.URLSearchParams('?user=abc&query=xyz') + var result= params.toString() + expect(result).assertEqual("user=abc&query=xyz") + }) + + /** + * @tc.name: testUrlSearchParamsConstruction002 + * @tc.desc: A parameterized constructor used to create an URLSearchParams instance. + * @tc.require: AR000GFB2S + * @tc.author: zhangyouyou + */ + it('testUrlSearchParamsConstruction002', 0, function () { + let params = new Url.URLSearchParams({ + user: 'abc', + query: ['first', 'second'] + }); + var result= params.toString() + expect(result).assertEqual("user=abc&query=first%2Csecond") + }) + + /** + * @tc.name: testUrlSearchParamsConstruction003 + * @tc.desc: A parameterized constructor used to create an URLSearchParams instance. + * @tc.require: AR000GFB2S + * @tc.author: zhangyouyou + */ + it('testUrlSearchParamsConstruction003', 0, function () { + let params = new Url.URLSearchParams([ + ['user', 'abc'], + ['query', 'first'], + ['query', 'second'], + ]); + var result= params.toString() + expect(result).assertEqual("user=abc&query=first&query=second") + }) + + /** + * @tc.name: testUrlSearchParamsConstruction004 + * @tc.desc: A parameterized constructor used to create an URLSearchParams instance. + * @tc.require: AR000GFB2S + * @tc.author: zhangyouyou + */ + it('testUrlSearchParamsConstruction004', 0, function () { + const map = new Map(); + map.set('user', 'abc'); + map.set('query', 'xyz'); + let params = new Url.URLSearchParams(map) + var result= params.toString() + expect(result).assertEqual("user=abc&query=xyz") + }) + + /** + * @tc.name: testUrlSearchParamsConstruction005 + * @tc.desc: A parameterized constructor used to create an URLSearchParams instance. + * @tc.require: AR000GFB2S + * @tc.author: zhangyouyou + */ + it('testUrlSearchParamsConstruction005', 0, function () { + function* getQueryPairs() { + yield ['user', 'abc']; + yield ['query', 'first']; + yield ['query', 'second']; + } + let params = new Url.URLSearchParams(getQueryPairs()); + var result= params.toString() + expect(result).assertEqual("user=abc&query=first&query=second") + }) + + /** + * @tc.name: testUrlSearchParamsConstruction006 + * @tc.desc: A parameterized constructor used to create an URLSearchParams instance. + * @tc.require: AR000GFB2S + * @tc.author: zhangyouyou + */ + it('testUrlSearchParamsConstruction006', 0, function () { + let params = new Url.URLSearchParams() + params.append('abcde','fghki') + var paramsResult = params.toString() + expect(paramsResult).assertEqual('abcde=fghki') + }) + + /** + * @tc.name: testUrlSearchParamsConstruction007 + * @tc.desc: A parameterized constructor used to create an URLSearchParams instance. + * @tc.require: AR000GFB2S + * @tc.author: zhangyouyou + */ + it('testUrlSearchParamsConstruction007', 0, function () { + let param + let params = new Url.URLSearchParams(param) + params.append('abcde','fghki') + var paramsResult = params.toString() + expect(paramsResult).assertEqual('abcde=fghki') + }) + + /** + * @tc.name: testUrlToString001 + * @tc.desc: Returns the serialized URL as a string. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlToString001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + var result= params.toString() + expect(result).assertEqual("http://username:password@host:8080/directory/file?query#fragment") + }) + + /** + * @tc.name: testUrlToString002 + * @tc.desc: Returns the serialized URL as a string. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlToString002', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file') + var result= params.toString() + expect(result).assertEqual("http://username:password@host:8080/directory/file") + }) + + /** + * @tc.name: testUrlToString003 + * @tc.desc: Returns the serialized URL as a string. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlToString003', 0, function () { + let params = new Url.URL('http://username:password@host:8080#fragment') + var result= params.toString() + expect(result).assertEqual("http://username:password@host:8080/#fragment") + }) + + /** + * @tc.name: testUrlToString004 + * @tc.desc: Returns the serialized URL as a string. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlToString004', 0, function () { + let params = new Url.URL('http1://host/directory/file?query#fragment') + var result= params.toString() + expect(result).assertEqual("http1://host/directory/file?query#fragment") + }) + + /** + * @tc.name: testUrlToString005 + * @tc.desc: Returns the serialized URL as a string. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlToString005', 0, function () { + let params = new Url.URL('http:host:8080/directory/file?query#fragment') + var result= params.toString() + expect(result).assertEqual("http://host:8080/directory/file?query#fragment") + }) + + /** + * @tc.name: testUrlHref001 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHref001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + var result= params.href + expect(result).assertEqual("http://username:password@host:8080/directory/file?query#fragment") + }) + + /** + * @tc.name: testUrlHref002 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHref002', 0, function () { + let params = new Url.URL('http://host:8080/directory/file?query#fragment') + var result= params.href + expect(result).assertEqual("http://host:8080/directory/file?query#fragment") + }) + + /** + * @tc.name: testUrlHref003 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHref003', 0, function () { + let params = new Url.URL('http://username:password@host:8080') + var result= params.href + expect(result).assertEqual("http://username:password@host:8080/") + }) + + /** + * @tc.name: testUrlHref004 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHref004', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.href = 'http1://myhost/path?sss=1#ff'; + var result= params.href + expect(result).assertEqual("http1://myhost/path?sss=1#ff") + }) + + /** + * @tc.name: testUrlHref005 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHref005', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.href = 'http://myhost:99/path#ff'; + var result= params.href + expect(result).assertEqual("http://myhost:99/path#ff") + }) + + /** + * @tc.name: testUrlOrigin001 + * @tc.desc: Gets the read-only serialization of the URL's origin. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlOrigin001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + var result= params.origin + expect(result).assertEqual('http://host:8080') + }) + + /** + * @tc.name: testUrlOrigin002 + * @tc.desc: Gets the read-only serialization of the URL's origin. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlOrigin002', 0, function () { + let params = new Url.URL('http://username:password@host:11/directory/file?query#fragment') + var result= params.origin + expect(result).assertEqual('http://host:11') + }) + + /** + * @tc.name: testUrlOrigin003 + * @tc.desc: Gets the read-only serialization of the URL's origin. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlOrigin003', 0, function () { + let params = new Url.URL('http://username:password@host/directory/file?query#fragment') + var result= params.origin + expect(result).assertEqual('http://host') + }) + + /** + * @tc.name: testUrlOrigin004 + * @tc.desc: Gets the read-only serialization of the URL's origin. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlOrigin004', 0, function () { + let params = new Url.URL('http://username:password@aaaasshost:212/directory/file?query#fragment') + var result= params.origin + expect(result).assertEqual('http://aaaasshost:212') + }) + + /** + * @tc.name: testUrlOrigin005 + * @tc.desc: Gets the read-only serialization of the URL's origin. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('Url_origin_test_005', 0, function () { + let params = new Url.URL('http://username:password@host22:100#fragment') + var result= params.origin + expect(result).assertEqual('http://host22:100') + }) + + /** + * @tc.name: testUrlProtocol001 + * @tc.desc: Gets and sets the protocol portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlProtocol001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + var result= params.protocol + expect(result).assertEqual('http:') + }) + + /** + * @tc.name: testUrlProtocol002 + * @tc.desc: Gets and sets the protocol portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlProtocol002', 0, function () { + let params = new Url.URL('http1://username:password@host:8080/directory/file?query#fragment') + var result= params.protocol + expect(result).assertEqual('http1:') + }) + + /** + * @tc.name: testUrlProtocol003 + * @tc.desc: Gets and sets the protocol portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlProtocol003', 0, function () { + let params = new Url.URL('https://username:password@host:8080/directory/file?query#fragment') + var result= params.protocol + expect(result).assertEqual('https:') + }) + + /** + * @tc.name: testUrlProtocol004 + * @tc.desc: Gets and sets the protocol portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlProtocol004', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.protocol = 'https:'; + var result= params.protocol + expect(result).assertEqual('https:') + }) + + /** + * @tc.name: testUrlProtocol005 + * @tc.desc: Gets and sets the protocol portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlProtocol005', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.protocol = 'ftp:'; + var result= params.protocol + expect(result).assertEqual('ftp:') + }) + + /** + * @tc.name: testUrlUsername001 + * @tc.desc: Gets and sets the username portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlUsername001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + var result= params.username + expect(result).assertEqual('username') + }) + + /** + * @tc.name: testUrlUsername002 + * @tc.desc: Gets and sets the username portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlUsername002', 0, function () { + let params = new Url.URL('http://zhao:password@host:8080/directory/file?query#fragment') + var result= params.username + expect(result).assertEqual('zhao') + }) + + /** + * @tc.name: testUrlUsername003 + * @tc.desc: Gets and sets the username portion of the URL. + * @tc.require: AR000GFB2S + * @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') + }) + + /** + * @tc.name: testUrlUsername004 + * @tc.desc: Gets and sets the username portion of the URL. + * @tc.require: AR000GFB2S + * @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') + }) + + /** + * @tc.name: testUrlUsername005 + * @tc.desc: Gets and sets the username portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlUsername005', 0, function () { + let params = new Url.URL('http://usme@host:8080/directory/file?query#fragment') + var result= params.username + expect(result).assertEqual('usme') + }) + + /** + * @tc.name: testUrlPassword001 + * @tc.desc: Gets and sets the password portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPassword001', 0, function () { + let params = new Url.URL('http://username:11@host:8080/directory/file?query#fragment') + var result= params.password + expect(result).assertEqual('11') + }) + + /** + * @tc.name: testUrlPassword002 + * @tc.desc: Gets and sets the password portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPassword002', 0, function () { + let params = new Url.URL('http://username:23aa@host:8080/directory/file?query#fragment') + var result= params.password + expect(result).assertEqual('23aa') + }) + + /** + * @tc.name: testUrlPassword003 + * @tc.desc: Gets and sets the password portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPassword003', 0, function () { + let params = new Url.URL('http://username@host:8080/directory/file?query#fragment') + var result= params.password + expect(result).assertEqual('') + }) + + /** + * @tc.name: testUrlPassword004 + * @tc.desc: Gets and sets the password portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPassword004', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.password = "1234" + var result= params.password + expect(result).assertEqual('1234') + }) + + /** + * @tc.name: testUrlPassword005 + * @tc.desc: Gets and sets the password portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPassword005', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.password = ""; + var result= params.password + expect(result).assertEqual('') + }) + + /** + * @tc.name: testUrlHost001 + * @tc.desc: Gets and sets the host portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHost001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + var result= params.host + expect(result).assertEqual('host:8080') + }) + + /** + * @tc.name: testUrlHost002 + * @tc.desc: Gets and sets the host portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHost002', 0, function () { + let params = new Url.URL('http://username:password@hosthost/directory/file?query#fragment') + var result= params.host + expect(result).assertEqual('hosthost') + }) + + /** + * @tc.name: testUrlHost003 + * @tc.desc: Gets and sets the host portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHost003', 0, function () { + let params = new Url.URL('http://username:password@host:199/directory/file?query#fragment') + var result= params.host + expect(result).assertEqual('host:199') + }) + + /** + * @tc.name: testUrlHost004 + * @tc.desc: Gets and sets the host portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + 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') + }) + + /** + * @tc.name: testUrlHost005 + * @tc.desc: Gets and sets the host portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHost005', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.host = 'jkjk:100' + var result= params.host + expect(result).assertEqual('jkjk:100') + }) + + /** + * @tc.name: testUrlHostname001 + * @tc.desc: Gets and sets the host name portion of the URL,not include the port. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHostname001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + var result= params.hostname + expect(result).assertEqual('host') + }) + + /** + * @tc.name: testUrlHostname002 + * @tc.desc: Gets and sets the host name portion of the URL,not include the port. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHostname002', 0, function () { + let params = new Url.URL('http://username:password@host123:8080/directory/file?query#fragment') + var result= params.hostname + expect(result).assertEqual('host123') + }) + + /** + * @tc.name: testUrlHostname003 + * @tc.desc: Gets and sets the host name portion of the URL,not include the port. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHostname003', 0, function () { + let params = new Url.URL('http://username:password@885ssa:8080/directory/file?query#fragment') + var result= params.hostname + expect(result).assertEqual('885ssa') + }) + + /** + * @tc.name: testUrlHostname004 + * @tc.desc: Gets and sets the host name portion of the URL,not include the port. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHostname004', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.hostname = 'sksk' + var result= params.hostname + expect(result).assertEqual('sksk') + }) + + /** + * @tc.name: testUrlHostname005 + * @tc.desc: Gets and sets the host name portion of the URL,not include the port. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHostname005', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.hostname = 'hosthost' + var result= params.hostname + expect(result).assertEqual('hosthost') + }) + + /** + * @tc.name: testUrlPort001 + * @tc.desc: Gets and sets the port portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPort001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + var result= params.port + expect(result).assertEqual('8080') + }) + + /** + * @tc.name: testUrlPort002 + * @tc.desc: Gets and sets the port portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPort002', 0, function () { + let params = new Url.URL('http://username:password@host:100/directory/file?query#fragment') + var result= params.port + expect(result).assertEqual('100') + }) + + /** + * @tc.name: testUrlPort003 + * @tc.desc: Gets and sets the port portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPort003', 0, function () { + let params = new Url.URL('http://username:password@host/directory/file?query#fragment') + var result= params.port + expect(result).assertEqual('') + }) + + /** + * @tc.name: testUrlPort004 + * @tc.desc: Gets and sets the port portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPort004', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.port = '99' + var result= params.port + expect(result).assertEqual('99') + }) + + /** + * @tc.name: testUrlPort005 + * @tc.desc: Gets and sets the port portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPort005', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.port = '123' + var result= params.port + expect(result).assertEqual('123') + }) + + /** + * @tc.name: testUrlPathname001 + * @tc.desc: Gets and sets the path portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPathname001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + var result= params.pathname + expect(result).assertEqual('/directory/file') + }) + + /** + * @tc.name: testUrlPathname002 + * @tc.desc: Gets and sets the path portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPathname002', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory?query#fragment') + var result= params.pathname + expect(result).assertEqual('/directory') + }) + + /** + * @tc.name: testUrlPathname003 + * @tc.desc: Gets and sets the path portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPathname003', 0, function () { + let params = new Url.URL('http://username:password@host:8080?query#fragment') + var result= params.pathname + expect(result).assertEqual('/') + }) + + /** + * @tc.name: testUrlPathname004 + * @tc.desc: Gets and sets the path portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPathname004', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.pathname = 'path' + var result= params.pathname + expect(result).assertEqual('/path') + }) + + /** + * @tc.name: testUrlPathname005 + * @tc.desc: Gets and sets the path portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlPathname005', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') + params.pathname = '/directory/file11' + var result= params.pathname + expect(result).assertEqual('/directory/file11') + }) + + /** + * @tc.name: testUrlSearch001 + * @tc.desc: Gets and sets the serialized query portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlSearch001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query=qqqq#fragment') + var result= params.search + expect(result).assertEqual('?query=qqqq') + }) + + /** + * @tc.name: testUrlSearch002 + * @tc.desc: Gets and sets the serialized query portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlSearch002', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query=qqqq&ll=pp#fragment') + var result= params.search + expect(result).assertEqual('?query=qqqq&ll=pp') + }) + + /** + * @tc.name: testUrlSearch003 + * @tc.desc: Gets and sets the serialized query portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlSearch003', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?ppp9875=77#fragment') + var result= params.search + expect(result).assertEqual('?ppp9875=77') + }) + + /** + * @tc.name: testUrlSearch004 + * @tc.desc: Gets and sets the serialized query portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlSearch004', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query=qqqq#fragment') + params.search = 'kk=99' + var result= params.search + expect(result).assertEqual('?kk=99') + }) + + /** + * @tc.name: testUrlSearch005 + * @tc.desc: Gets and sets the serialized query portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlSearch005', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query=qqqq#fragment') + params.search = 'pppk=99' + var result= params.search + expect(result).assertEqual('?pppk=99') + }) + + /** + * @tc.name: testUrlHash001 + * @tc.desc: Gets and sets the fragment portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHash001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#fragment') + var result= params.hash + expect(result).assertEqual('#fragment') + }) + + /** + * @tc.name: testUrlHash002 + * @tc.desc: Gets and sets the fragment portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHash002', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#fragment') + params.hash = '123456' + var result= params.hash + expect(result).assertEqual('#123456') + }) + + /** + * @tc.name: testUrlHash003 + * @tc.desc: Gets and sets the fragment portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHash003', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#poiu') + var result= params.hash + expect(result).assertEqual('#poiu') + }) + + /** + * @tc.name: testUrlHash004 + * @tc.desc: Gets and sets the fragment portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHash004', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp') + var result= params.hash + expect(result).assertEqual('') + }) + + /** + * @tc.name: testUrlHash005 + * @tc.desc: Gets and sets the fragment portion of the URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlHash005', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#fragment') + params.hash = 'qwer' + var result= params.hash + expect(result).assertEqual('#qwer') + }) + + /** + * @tc.name: testUrlToJson001 + * @tc.desc: Returns the serialized URL as a string. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlToJson001', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da') + var result= params.toJSON() + expect(result).assertEqual('http://username:password@host:8080/directory/file?query=pppppp#qwer=da') + }) + + /** + * @tc.name: testUrlToJson002 + * @tc.desc: Returns the serialized URL as a string. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlToJson002', 0, function () { + let params = new Url.URL('http://host:8080/directory/file?query=pppppp#qwer=da') + var result= params.toJSON() + expect(result).assertEqual('http://host:8080/directory/file?query=pppppp#qwer=da') + }) + + /** + * @tc.name: testUrlToJson003 + * @tc.desc: Returns the serialized URL as a string. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlToJson003', 0, function () { + let params = new Url.URL('http://username:password@host:8080') + var result= params.toJSON() + expect(result).assertEqual('http://username:password@host:8080/') + }) + + /** + * @tc.name: testUrlToJson004 + * @tc.desc: Returns the serialized URL as a string. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlToJson004', 0, function () { + let params = new Url.URL('http11://username:password@host:8080?query=pppppp#qwer=da') + var result= params.toJSON() + expect(result).assertEqual('http11://username:password@host:8080?query=pppppp#qwer=da') + }) + + /** + * @tc.name: testUrlToJson005 + * @tc.desc: Returns the serialized URL as a string. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlToJson005', 0, function () { + let params = new Url.URL('http://username:password@host:8080/directory') + var result= params.toJSON() + expect(result).assertEqual('http://username:password@host:8080/directory') + }) + + /** + * @tc.name: testUrlIPv6001 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlIPv6001', 0, function () { + let params = new Url.URL('http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html') + var result= params.href + expect(result).assertEqual('http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/index.html') + }) + + /** + * @tc.name: testUrlIPv6002 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlIPv6002', 0, function () { + let params = new Url.URL('http://[1080:0:0:0:8:800:200C:417A]/index.html') + var result= params.href + expect(result).assertEqual('http://[1080::8:800:200c:417a]/index.html') + }) + + /** + * @tc.name: testUrlIPv6003 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlIPv6003', 0, function () { + let params = new Url.URL('http://[::FFFF:129.144.52.38]:80/index.html') + var result= params.href + expect(result).assertEqual('http://[::ffff:8190:3426]/index.html') + }) + + /** + * @tc.name: testUrlIPv4001 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlIPv4001', 0, function () { + let params = new Url.URL('http://0377.0xff.255.1:80/index.html') + var result= params.href + expect(result).assertEqual('http://255.255.255.1/index.html') + }) + + /** + * @tc.name: testUrlIPv4002 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlIPv4002', 0, function () { + let params = new Url.URL('http://0377.0xff.255.g/index.html') + var result= params.href + expect(result).assertEqual('http://0377.0xff.255.g/index.html') + }) + + /** + * @tc.name: testUrlIPv4003 + * @tc.desc: Gets and sets the serialized URL. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlIPv4003', 0, function () { + let params = new Url.URL('http://190.254.245.9:80/index.html') + var result= params.href + expect(result).assertEqual('http://190.254.245.9/index.html') + }) + + /** + * @tc.name: testUrlConstruction001 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction001', 0, function () { + let params = new Url.URL('https://developer.mozilla.org',) + var result= params.href + expect(result).assertEqual('https://developer.mozilla.org/') + }) + + /** + * @tc.name: testUrlConstruction002 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction002', 0, function () { + let params = new Url.URL('https://developer.mozilla.org','flie:/developer.mozilla.org') + var result= params.href + expect(result).assertEqual('https://developer.mozilla.org/') + }) + + /** + * @tc.name: testUrlConstruction003 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction003', 0, function () { + let params = new Url.URL('https://developer.mozilla.org','ftp://www.example.com') + var result= params.href + expect(result).assertEqual('https://developer.mozilla.org/') + }) + + /** + * @tc.name: testUrlConstruction004 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction004', 0, function () { + let params = new Url.URL(' ', 'http://www.example.com') + var result= params.href + expect(result).assertEqual('http://www.example.com/') + }) + + /** + * @tc.name: testUrlConstruction005 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction005', 0, function () { + let params = new Url.URL('.', 'http://www.example.com') + var result= params.href + expect(result).assertEqual('http://www.example.com/') + }) + + /** + * @tc.name: testUrlConstruction006 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction006', 0, function () { + let params = new Url.URL('../h:', 'http://www.example.com') + var result= params.href + expect(result).assertEqual('http://www.example.com/h:') + }) + + /** + * @tc.name: testUrlConstruction007 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction007', 0, function () { + let params = new Url.URL('/sca/./path/path/../scasa/jjjjj', 'http://www.example.com') + var result= params.href + expect(result).assertEqual('http://www.example.com/sca/path/scasa/jjjjj') + }) + + /** + * @tc.name: testUrlConstruction008 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction008', 0, function () { + let params = new Url.URL('/../sca/./path/path/../scasa/jjjjj', 'http://www.example.com') + var result= params.href + expect(result).assertEqual('http://www.example.com/sca/path/scasa/jjjjj') + }) + + /** + * @tc.name: testUrlConstruction009 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction009', 0, function () { + let params = new Url.URL( '/../sca/./path/path/../scasa/jjjjj', 'file://www.example.com') + var result= params.href + expect(result).assertEqual('file://www.example.com/sca/path/scasa/jjjjj') + }) + + /** + * @tc.name: testUrlConstruction010 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction010', 0, function () { + let params = new Url.URL('/../sca/./path/path/../scasa/jjjjj', 'file1://www.example.com') + var result= params.href + expect(result).assertEqual('file1://www.example.com/sca/path/scasa/jjjjj') + }) + + /** + * @tc.name: testUrlConstruction011 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('Url_construction_test_011', 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 + expect(result).assertEqual('htt1p://www.0902zy.cn/www.baidu.com/ssaa') + }) + + /** + * @tc.name: testUrlConstruction012 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction012', 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 + expect(result).assertEqual('htt1p://www.baidu.com/ssaa') + }) + + /** + * @tc.name: testUrlConstruction013 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction013', 0, function () { + let params = new Url.URL('htt1p://www.0902zy.cn/path?abc=123&def=456#yyyy') + let params1 = new Url.URL('',params) + var result = params1.href + expect(result).assertEqual('htt1p://www.0902zy.cn/path?abc=123&def=456#yyyy') + }) + + /** + * @tc.name: testUrlConstruction014 + * @tc.desc: URL constructor, which is used to instantiate a URL object. + * @tc.require: AR000GFB2S + * @tc.author: zhaoduwei + */ + it('testUrlConstruction014', 0, function () { + let params = new Url.URL('htt1p://www.0902zy.cn/path?abc=123&def=456#yyyy') + var result = params.searchParams.toString(); + expect(result).assertEqual('abc=123&def=456') + }) +}) \ No newline at end of file diff --git a/compileruntime/url_lib_standard/src/main/js/test/ExampleJsunit.test.js b/compileruntime/url_lib_standard/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 2d8aa9fb75f84cdf6b1a070b0f24b74c4fd792b3..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 diff --git a/compileruntime/url_lib_standard/src/main/js/test/url.test.js b/compileruntime/url_lib_standard/src/main/js/test/url.test.js deleted file mode 100644 index 19e410b3280ea692acfa26a093ea6e6e75cfdb40..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/main/js/test/url.test.js +++ /dev/null @@ -1,564 +0,0 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the 'License') - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an 'AS IS' BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/lite' -import Url from '@ohos.url' - -describe('Url_mxa_jk_Test', function () { - it('Url_append_test_001', 0, function () { - var that = new Url.URL('http://username:password@host:8080/directory/file?foo=1&bar=2') - var params = new Url.URLSearchParams(that.search) - params.append('ma', 'jk') - var result = params.toString() - expect(result).assertEqual('foo=1&bar=2&ma=jk') - }) - it('Url_append_test_002', 0, function () { - let that = new Url.URL('https://example.com?foo=1&bar=2') - let params = new Url.URLSearchParams(that.search) - params.append('ma 大', 'jk¥') - var result = params.toString() - expect(result).assertEqual('foo=1&bar=2&ma+%E5%A4%A7=jk%EF%BF%A5') - }) - it('Url_append_test_003', 0, function () { - let that = new Url.URL('https://example.com?foo=1&bar=2') - let params = new Url.URLSearchParams(that.search) - params.append('foo~!@#$%^&*()_+-=', 'jk') - var result = params.toString() - expect(result).assertEqual('foo=1&bar=2&foo%7E%21%40%23%24%25%5E%26*%28%29_%2B-%3D=jk') - }) - it('Url_delete_test_001', 0, function () { - let that = new Url.URL('https://example.com?foo=1&bar=2') - let params = new Url.URLSearchParams(that.search) - params.delete('foo') - var result = params.toString() - expect(result).assertEqual('bar=2') - }) - it('Url_delete_test_002', 0, function () { - let that = new Url.URL('https://example.com?foo大=1&bar=2') - let params = new Url.URLSearchParams(that.search) - params.delete('foo') - var result = params.toString() - expect(result).assertEqual('foo%E5%A4%A7=1&bar=2') - }) - it('Url_delete_test_003', 0, function () { - let that = new Url.URL('https://example.com?foo大=1&bar=2') - let params = new Url.URLSearchParams(that.search) - params.delete('foo大') - var result = params.toString() - expect(result).assertEqual('bar=2') - }) - - it('Url_entries_test_001', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2') - var i = 0; - var arr = {}; - for(var pair of params.entries()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[1]).assertEqual('value1') - }) - it('Url_entries_test_002', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2') - var i = 0; - var arr = {}; - for(var pair of params.entries()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[2]).assertEqual('key2') - }) - it('Url_entries_test_003', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2') - params.append('foo', 'jk') - var i = 0; - var arr = {}; - for(var pair of params.entries()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[5]).assertEqual('jk') - }) - - it('Url_forEach_test_001', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2') - var arr = {}; - var i = 0; - function func(str1, str2, params) { - arr[i] = 'key=' + str1 + ' ' + 'value=' + str2 + ' ' + 'flag=' + params - i++; - } - params.forEach(func) - expect(arr[0]).assertEqual('key=key1 value=value1 flag=key1=value1&key2=value2') - }) - it('Url_forEach_test_002', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2') - var arr = {}; - var i = 0; - function func(str1, str2, params) { - arr[i] = 'key=' + str1 + ' ' + 'value=' + str2 + ' ' + 'flag=' + params - i++; - } - params.forEach(func) - expect(arr[1]).assertEqual('key=key2 value=value2 flag=key1=value1&key2=value2') - }) - it('Url_forEach_test_003', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2') - params.append('foo', 'jk') - var arr = {}; - var i = 0; - function func(str1, str2, params) { - arr[i] = 'key=' + str1 + ' ' + 'value=' + str2 + ' ' + 'flag=' + params - i++; - } - params.forEach(func) - expect(arr[2]).assertEqual('key=foo value=jk flag=key1=value1&key2=value2&foo=jk') - }) - it('Url_get_test_001', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2') - var result = params.get('1') - expect(result).assertEqual(undefined) - }) - it('Url_get_test_002', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2') - var result = params.get('key2') - expect(result).assertEqual('value2') - }) - it('Url_get_test_003', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2') - params.append('5', 'JKL') - var result = params.get('5') - expect(result).assertEqual('JKL') - }) - it('Url_getAll_test_001', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2') - params.append('key1', 'AAA') - var result = params.getAll('key1') - expect(result).assertEqual('value1,AAA') - }) - it('Url_getAll_test_002', 0, function () { - let params = new Url.URLSearchParams('key1=value1&8=DEF') - params.append('8', 'A8A') - var result = params.getAll('8') - expect(result).assertEqual('DEF,A8A') - }) - it('Url_getAll_test_003', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2&key3=大') - params.append('key3', 'A3A') - var result = params.getAll('key3') - expect(result).assertEqual('大,A3A') - }) - it('Url_has_test_001', 0, function () { - let params = new Url.URLSearchParams('key1=value1&key2=value2&key3=大') - var result = params.has('2') - expect(result).assertEqual(false) - }) - it('Url_has_test_002', 0, function () { - let params = new Url.URLSearchParams('小=value1&key2=value2&key3=大') - var result = params.has('小') - expect(result).assertEqual(true) - }) - it('Url_has_test_003', 0, function () { - let params = new Url.URLSearchParams('小=value1&¥=value2&key3=大') - params.append('¥', 'ACA') - var result = params.has('¥') - expect(result).assertEqual(true) - }) - it('Url_keys_test_001', 0, function () { - let params = new Url.URLSearchParams('小=value1&¥=value2&key3=大') - var arr = {}; - var i = 0; - for (var key of params.keys()) { - arr[i] = key; - i++; - } - expect(arr[0]).assertEqual('小') - }) - it('Url_keys_test_002', 0, function () { - let params = new Url.URLSearchParams('小=value1&¥=value2&key3=大') - var arr = {}; - var i = 0; - for (var key of params.keys()) { - arr[i] = key; - i++; - } - expect(arr[1]).assertEqual('¥') - }) - it('Url_keys_test_003', 0, function () { - let params = new Url.URLSearchParams('小=value1&¥=value2&key3=大') - var arr = {}; - var i = 0; - for (var key of params.keys()) { - arr[i] = key; - i++; - } - expect(arr[2]).assertEqual('key3') - }) - it('Url_set_test_001', 0, function () { - let params = new Url.URLSearchParams('1=value1&2=value2&key3=3') - params.set('11', 'CCC') - var res = params.toString() - expect(res).assertEqual('1=value1&2=value2&key3=3&11=CCC') - }) - it('Url_set_test_002', 0, function () { - let params = new Url.URLSearchParams('1=value1&2=value2&key3=3') - params.set('10', 'BBB') - var res = params.toString() - expect(res).assertEqual('1=value1&2=value2&key3=3&10=BBB') - }) - it('Url_set_test_003', 0, function () { - let params = new Url.URLSearchParams('1=value1&2=value2&key3=3') - params.set('ma 大', '10¥') - var res = params.toString() - expect(res).assertEqual('1=value1&2=value2&key3=3&ma+%E5%A4%A7=10%EF%BF%A5') - }) - it('Url_sort_test_001', 0, function () { - let params = new Url.URLSearchParams('1=value1&3=value3&2=key2') - params.sort() - var res = params.toString() - expect(res).assertEqual('1=value1&2=key2&3=value3') - }) - it('Url_sort_test_002', 0, function () { - let params = new Url.URLSearchParams('a=value1&c=value2&b=key2') - params.sort() - var res = params.toString() - expect(res).assertEqual('a=value1&b=key2&c=value2') - }) - it('Url_sort_test_003', 0, function () { - let params = new Url.URLSearchParams('d=value1&c=value2&b=33') - params.append('a', 'ACA') - params.sort() - var res = params.toString() - expect(res).assertEqual('a=ACA&b=33&c=value2&d=value1') - }) - it('Url_Values_test_001', 0, function () { - let params = new Url.URLSearchParams('d=value1&c=value2&b=大') - var arr = {}; - var i = 0; - for (var value of params.values()) { - arr[i] = value; - i++; - } - expect(arr[0]).assertEqual('value1') - }) - it('Url_Values_test_002', 0, function () { - let params = new Url.URLSearchParams('d=value1&c=value2&b=大') - var arr = {}; - var i = 0; - for (var value of params.values()) { - arr[i] = value; - i++; - } - expect(arr[1]).assertEqual('value2') - }) - it('Url_Values_test_003', 0, function () { - let params = new Url.URLSearchParams('d=value1&c=value2&b=大') - params.append('a', 'ACA') - var arr = {}; - var i = 0; - for (var value of params.values()) { - arr[i] = value; - i++; - } - expect(arr[3]).assertEqual('ACA') - }) - it('Url_toString_test_001', 0, function () { - let params = new Url.URLSearchParams('d=value1&c=value2&b=大') - var result = params.toString() - expect(result).assertEqual('d=value1&c=value2&b=%E5%A4%A7') - }) - it('Url_toString_test_002', 0, function () { - let params = new Url.URLSearchParams('d=value1&c=value2&b= 大') - params.append('1 12', 'QQQ') - var result = params.toString() - expect(result).assertEqual('d=value1&c=value2&b=+%E5%A4%A7&1+12=QQQ') - }) - it('Url_toString_test_003', 0, function () { - let params = new Url.URLSearchParams('¥=)') - params.delete('5') - var result = params.toString() - expect(result).assertEqual('%EF%BF%A5=%29') - }) - //new url SearchParams - it('Url_construction_test_001', 0, function () { - let params = new Url.URLSearchParams('?user=abc&query=xyz') - var result = params.toString() - expect(result).assertEqual('user=abc&query=xyz') - }) - it('Url_construction_test_002', 0, function () { - let params = new Url.URLSearchParams({ - user: 'abc', - query: ['first', 'second'] - }) - var result = params.toString() - expect(result).assertEqual('user=abc&query=first%2Csecond') - }) - it('Url_construction_test_003', 0, function () { - let params = new Url.URLSearchParams([ - ['user', 'abc'], - ['query', 'first'], - ['query', 'second'], - ]) - var result = params.toString() - expect(result).assertEqual('user=abc&query=first&query=second') - }) - it('Url_construction_test_004', 0, function () { - const map = new Map() - map.set('user', 'abc') - map.set('query', 'xyz') - let params = new Url.URLSearchParams(map) - var result = params.toString() - expect(result).assertEqual('user=abc&query=xyz') - }) - it('Url_construction_test_004', 0, function () { - function* getQueryPairs() { - yield ['user', 'abc'] - yield ['query', 'first'] - yield ['query', 'second'] - } - let params = new Url.URLSearchParams(getQueryPairs()) - var result = params.toString() - expect(result).assertEqual('user=abc&query=first&query=second') - }) - //new url - get - it('Url_to_string_test_001', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - var result = params.to_string() - expect(result).assertEqual('http://username:password@host:8080/directory/file?query#fragment') - }) - - it('Url_href_test_002', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - var result = params.href - expect(result).assertEqual('http://username:password@host:8080/directory/file?query#fragment') - }) - it('Url_origin_test_003', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - var result = params.origin - expect(result).assertEqual('http://host:8080') - }) - it('Url_protocol_test_004', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - var result = params.protocol - expect(result).assertEqual('http:') - }) - it('Url_username_test_005', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - var result = params.username - expect(result).assertEqual('username') - }) - it('Url_password_test_006', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - var result = params.password - expect(result).assertEqual('password') - }) - it('Url_host_test_007', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - var result = params.host - expect(result).assertEqual('host:8080') - }) - it('Url_hostname_test_008', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - var result = params.hostname - expect(result).assertEqual('host') - }) - it('Url_port_test_009', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - var result = params.port - expect(result).assertEqual('8080') - }) - it('Url_pathname_test_010', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - var result = params.pathname - expect(result).assertEqual('/directory/file') - }) - it('Url_search_test_011', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query=qqqq#fragment') - var result = params.search - expect(result).assertEqual('?query=qqqq') - }) - it('Url_search_test_012', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#fragment') - var result = params.search - expect(result).assertEqual('?query=pppppp') - }) - it('Url_hash_test_013', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#fragment') - var result = params.hash - expect(result).assertEqual('#fragment') - }) - //new url - set - it('Url_href_test_001', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - params.href = 'http://[::192.9.5.5]/ipng' - var result = params.href - expect(result).assertEqual('http://[::c009:505]/ipng') - }) - it('Url_protocol_test_002', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - params.protocol = 'https:' - var result = params.href - expect(result).assertEqual('https://username:password@host:8080/directory/file?query#fragment') - }) - it('Url_username_test_003', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - params.username = 'username1' - var result = params.href - expect(result).assertEqual('http://username1:password@host:8080/directory/file?query#fragment') - }) - it('Url_password_test_004', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - params.password = 'passwd' - var result = params.href - expect(result).assertEqual('http://username:passwd@host:8080/directory/file?query#fragment') - }) - - it('Url_host_test_005', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - params.host = 'www.baidu.com:99' - var result = params.href - expect(result).assertEqual('http://username:password@www.baidu.com:99/directory/file?query#fragment') - }) - - it('Url_hostname_test_006', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - params.hostname = 'www.baidu.com' - var result = params.href - expect(result).assertEqual('http://username:password@www.baidu.com:8080/directory/file?query#fragment') - }) - it('Url_port_test_007', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - params.port = '99' - var result = params.href - expect(result).assertEqual('http://username:password@host:99/directory/file?query#fragment') - }) - it('Url_pathname_test_008', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query#fragment') - params.pathname = '/path/ddd' - var result = params.href - expect(result).assertEqual('http://username:password@host:8080/path/ddd?query#fragment') - }) - it('Url_search_test_009', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query=qqqq#fragment') - params.search = '?pppppp=1234' - var result = params.href - expect(result).assertEqual('http://username:password@host:8080/directory/file?pppppp=1234#fragment') - }) - it('Url_hash_test_010', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#fragment') - params.hash = '#qwer=da' - var result = params.href - expect(result).assertEqual('http://username:password@host:8080/directory/file?query=pppppp#qwer=da') - }) - //new url JSON - it('Url_toJSON_test_001', 0, function () { - let params = new Url.URL('http://username:password@host:8080/directory/file?query=pppppp#qwer=da') - var result = params.toJSON() - expect(result).assertEqual('http://username:password@host:8080/directory/file?query=pppppp#qwer=da') - }) - //new url IPV6 - it('Url_IPV6_test_001', 0, function () { - let params = new Url.URL('http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html') - var result = params.href - expect(result).assertEqual('http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/index.html') - }) - it('Url_IPV6_test_002', 0, function () { - let params = new Url.URL('http://[1080:0:0:0:8:800:200C:417A]/index.html') - var result = params.href - expect(result).assertEqual('http://[1080::8:800:200c:417a]/index.html') - }) - it('Url_IPV6_test_003', 0, function () { - let params = new Url.URL('http://[::FFFF:129.144.52.38]:80/index.html') - var result = params.href - expect(result).assertEqual('http://[::ffff:8190:3426]/index.html') - }) - //new url IPV4 - it('Url_IPV4_test_001', 0, function () { - let params = new Url.URL('http://0377.0xff.255.1:80/index.html') - var result = params.href - expect(result).assertEqual('http://255.255.255.1/index.html') - }) - it('Url_IPV4_test_002', 0, function () { - let params = new Url.URL('http://0377.0xff.255.g/index.html') - var result = params.href - expect(result).assertEqual('http://0377.0xff.255.g/index.html') - }) - it('Url_IPV4_test_003', 0, function () { - let params = new Url.URL('http://190.254.245.9:80/index.html') - var result = params.href - expect(result).assertEqual('http://190.254.245.9/index.html') - }) - //new url url_base - it('Url_base_test_001', 0, function () { - let params = new Url.URL('https://developer.mozilla.org',) - var result = params.href - expect(result).assertEqual('https://developer.mozilla.org/') - }) - it('Url_base_test_002', 0, function () { - let params = new Url.URL('https://developer.mozilla.org', 'flie:/developer.mozilla.org') - var result = params.href - expect(result).assertEqual('https://developer.mozilla.org/') - }) - it('Url_base_test_003', 0, function () { - let params = new Url.URL('https://developer.mozilla.org', 'ftp://www.example.com') - var result = params.href - expect(result).assertEqual('https://developer.mozilla.org/') - }) - it('Url_base_test_004', 0, function () { - let params = new Url.URL(' ', 'http://www.example.com') - var result = params.href - expect(result).assertEqual('http://www.example.com/') - }) - it('Url_base_test_005', 0, function () { - let params = new Url.URL('.', 'http://www.example.com') - var result = params.href - expect(result).assertEqual('http://www.example.com/') - }) - it('Url_base_test_006', 0, function () { - let params = new Url.URL('../h:', 'http://www.example.com') - var result = params.href - expect(result).assertEqual('http://www.example.com/h:') - }) - it('Url_base_test_007', 0, function () { - let params = new Url.URL('/sca/./path/path/../scasa/jjjjj', 'http://www.example.com') - var result = params.href - expect(result).assertEqual('http://www.example.com/sca/path/scasa/jjjjj') - }) - it('Url_base_test_008', 0, function () { - let params = new Url.URL('sca/./path/path/../scasa/jjjjj', 'http://www.example.com') - var result = params.href - expect(result).assertEqual('http://www.example.com/sca/path/scasa/jjjjj') - }) - it('Url_base_test_009', 0, function () { - let params = new Url.URL('/../sca/./path/path/../scasa/jjjjj', 'http://www.example.com') - var result = params.href - expect(result).assertEqual('http://www.example.com/sca/path/scasa/jjjjj') - }) - it('Url_base_test_010', 0, function () { - let params = new Url.URL('/../sca/./path/path/../scasa/jjjjj', 'file://www.example.com') - var result = params.href - expect(result).assertEqual('file://www.example.com/sca/path/scasa/jjjjj') - }) - it('Url_base_test_011', 0, function () { - let params = new Url.URL('/../sca/./path/path/../scasa/jjjjj', 'file1://www.example.com') - var result = params.href - expect(result).assertEqual('file1://www.example.com/sca/path/scasa/jjjjj') - }) -}) \ No newline at end of file diff --git a/compileruntime/url_lib_standard/src/main/resources/base/element/string.json b/compileruntime/url_lib_standard/src/main/resources/base/element/string.json index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..239a23e5b1c057bb46e2defa92cae47bade0afed 100644 --- a/compileruntime/url_lib_standard/src/main/resources/base/element/string.json +++ b/compileruntime/url_lib_standard/src/main/resources/base/element/string.json @@ -1,12 +1,12 @@ { "string": [ { - "name": "entry_MainAbility", - "value": "entry_MainAbility" + "name": "app_name", + "value": "OsAccountTest" }, { "name": "mainability_description", - "value": "JS_Empty Ability" + "value": "JS_Phone_Empty Feature Ability" } ] } \ No newline at end of file diff --git a/compileruntime/url_lib_standard/src/main/resources/base/media/icon.png b/compileruntime/url_lib_standard/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/compileruntime/url_lib_standard/src/main/resources/base/media/icon.png differ diff --git a/compileruntime/url_lib_standard/src/ohosTest/js/default/app.js b/compileruntime/url_lib_standard/src/ohosTest/js/default/app.js deleted file mode 100644 index 4952e62fd96d8dcf3eb348d293249c2a18176c85..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/ohosTest/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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'); - } -}; diff --git a/compileruntime/url_lib_standard/src/ohosTest/js/default/i18n/en-US.json b/compileruntime/url_lib_standard/src/ohosTest/js/default/i18n/en-US.json deleted file mode 100644 index 55561b83737c3c31d082fbfa11e5fc987a351104..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/ohosTest/js/default/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/compileruntime/url_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json b/compileruntime/url_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json deleted file mode 100644 index cce1af06761a42add0cac1a0567aa3237eda8cb4..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.css b/compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.hml b/compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.js b/compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.js deleted file mode 100644 index 1edd1fbaa7c4b9f6bedd478d85933d97c0f55f00..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/ohosTest/js/default/pages/index/index.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 diff --git a/compileruntime/url_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js b/compileruntime/url_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js deleted file mode 100644 index d043e7e9479ed2a8e2751397c67d43c2ee8f7a08..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 diff --git a/compileruntime/url_lib_standard/src/ohosTest/js/test/List.test.js b/compileruntime/url_lib_standard/src/ohosTest/js/test/List.test.js deleted file mode 100644 index 86ae9fa262b8d3fa27e4ac734dbd529d37d0b7cd..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/ohosTest/js/test/List.test.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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. - */ - -require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/compileruntime/url_lib_standard/src/ohosTest/resources/base/element/string.json b/compileruntime/url_lib_standard/src/ohosTest/resources/base/element/string.json deleted file mode 100644 index 2dffe5ba6503c2c0d7ddcfff2d9d03759f459947..0000000000000000000000000000000000000000 --- a/compileruntime/url_lib_standard/src/ohosTest/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "URL" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} diff --git a/compileruntime/util_lib_standard/src/main/config.json b/compileruntime/util_lib_standard/src/main/config.json index 75d1ac14458c1ede210bf40739cb9c9fc80e74b4..8528ea7b206ca804e36150ae8a0dec8f14757643 100644 --- a/compileruntime/util_lib_standard/src/main/config.json +++ b/compileruntime/util_lib_standard/src/main/config.json @@ -5,6 +5,10 @@ "version": { "code": 1000000, "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 } }, "deviceConfig": {}, @@ -23,6 +27,7 @@ }, "abilities": [ { + "visible": true, "skills": [ { "entities": [ @@ -49,7 +54,7 @@ "name": "default", "window": { "designWidth": 720, - "autoDesignWidth": true + "autoDesignWidth": false } } ] diff --git a/compileruntime/util_lib_standard/src/main/java/com/example/childprocess/MainAbility.java b/compileruntime/util_lib_standard/src/main/java/com/example/childprocess/MainAbility.java deleted file mode 100644 index dbdddf742e23f2568178756f1cea558603671535..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/main/java/com/example/childprocess/MainAbility.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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(); - } -} diff --git a/compileruntime/util_lib_standard/src/main/java/com/example/childprocess/MyApplication.java b/compileruntime/util_lib_standard/src/main/java/com/example/childprocess/MyApplication.java deleted file mode 100644 index bf24a9676c68a8c8fe00508525160c66d0378e80..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/main/java/com/example/childprocess/MyApplication.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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(); - } -} diff --git a/compileruntime/util_lib_standard/src/main/java/com/example/url/MainAbility.java b/compileruntime/util_lib_standard/src/main/java/com/example/url/MainAbility.java deleted file mode 100644 index 1029c01195535d7671415ad1490aa483571d41e5..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/main/java/com/example/url/MainAbility.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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(); - } -} diff --git a/compileruntime/util_lib_standard/src/main/java/com/example/url/MyApplication.java b/compileruntime/util_lib_standard/src/main/java/com/example/url/MyApplication.java deleted file mode 100644 index d0bd8e832c63d6b1e691f5fc58c9284982cbde3b..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/main/java/com/example/url/MyApplication.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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(); - } -} diff --git a/compileruntime/util_lib_standard/src/main/js/default/app.js b/compileruntime/util_lib_standard/src/main/js/default/app.js index ef92b6e96e9db7d997b0be7c2068d560b1cab26d..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 100644 --- a/compileruntime/util_lib_standard/src/main/js/default/app.js +++ b/compileruntime/util_lib_standard/src/main/js/default/app.js @@ -1,17 +1,18 @@ /* * 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('AceApplication onCreate'); diff --git a/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.css b/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.css index 2b1965821483f4f8c8b97c86ef07fe87ea767d01..6fda792753f2e15f22b529c7b90a82185b2770bf 100644 --- a/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.css +++ b/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.css @@ -5,40 +5,5 @@ } .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; - } + font-size: 100px; } diff --git a/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.hml b/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.hml index 9f0aae944b86533183d4307b741c7c237e6457a1..abb8b6d886160a1f93ff6251d0b7774643bbaebb 100644 --- a/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.hml +++ b/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.hml @@ -1,6 +1,5 @@ -
+
- {{ $t('strings.hello') }} {{title}} + {{ $t('strings.hello') }} {{ title }} -
\ No newline at end of file diff --git a/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.js b/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.js index eff21d421cc56ef14e78acefcc6a8ff275f60551..e4d67da604bf7c8c016361c9fe996882412c130a 100644 --- a/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.js +++ b/compileruntime/util_lib_standard/src/main/js/default/pages/index/index.js @@ -12,12 +12,12 @@ * 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} from 'deccjsunit/lite' +import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index' + export default { data: { @@ -30,7 +30,7 @@ export default { console.info('onShow finish') const core = Core.getInstance() core.init() - require('../../../test/List.test') + require('../../test/List.test') core.execute() }, onReady() { diff --git a/compileruntime/util_lib_standard/src/main/js/test/List.test.js b/compileruntime/util_lib_standard/src/main/js/default/test/List.test.js similarity index 90% rename from compileruntime/util_lib_standard/src/main/js/test/List.test.js rename to compileruntime/util_lib_standard/src/main/js/default/test/List.test.js index e4726ba94e7d3fefb579529084da7329a3a4e292..8944ebf95cb2ea6dfbe9cedb04a3a22f35578c83 100644 --- a/compileruntime/util_lib_standard/src/main/js/test/List.test.js +++ b/compileruntime/util_lib_standard/src/main/js/default/test/List.test.js @@ -13,5 +13,4 @@ * limitations under the License. */ -require('./ExampleJsunit.test.js') require('./TextCodr.test.js') \ No newline at end of file diff --git a/compileruntime/util_lib_standard/src/main/js/test/TextCodr.test.js b/compileruntime/util_lib_standard/src/main/js/default/test/TextCodr.test.js similarity index 85% rename from compileruntime/util_lib_standard/src/main/js/test/TextCodr.test.js rename to compileruntime/util_lib_standard/src/main/js/default/test/TextCodr.test.js index 2910e1f2c3437810e7034b552d7ed5070918a9a0..16e30bda18d47368ed86e6d9e5fcf56e62384c21 100644 --- a/compileruntime/util_lib_standard/src/main/js/test/TextCodr.test.js +++ b/compileruntime/util_lib_standard/src/main/js/default/test/TextCodr.test.js @@ -225,11 +225,14 @@ describe('TextEncoderTest', function () { * @tc.author: shikai */ it('testUtilPromiseWrapper003', 0, async function () { - const a = util.promiseWrapper(function() {})(); - const b = util.promiseWrapper(function() {})(); - expect(a).assertInstanceOf('Promise'); - expect(b).assertInstanceOf('Promise'); - + let errToThrow; + const thrower = util.promiseWrapper(function(a, b, c, cb) { + errToThrow = new Error(); + throw errToThrow; + }); + thrower(1, 2, 3).catch(err => { + expect(err).strictEqual(errToThrow); + }) }) /** @@ -372,12 +375,12 @@ describe('TextEncoderTest', function () { */ it('testUtilCallbackWrapper004', 0, async function () { async function promiseFn() { - return Promise.reject('value'); + return 21; }; var cb = util.callbackWrapper(promiseFn); cb((err, ret) => { - expect(err).strictEqual('value'); - expect(ret).strictEqual(undefined); + expect(err).strictEqual(null); + expect(ret).strictEqual(21); }) }) @@ -729,8 +732,8 @@ describe('TextEncoderTest', function () { var that = new util.TextEncoder() var buffer = new ArrayBuffer(20) var result = new Uint8Array(buffer) - result = that.encode('abc') - expect(result[0]).assertEqual(0x61) + result = that.encode('\uD800楼楼') + expect(result[5]).assertEqual(188) }) /** @@ -743,8 +746,8 @@ describe('TextEncoderTest', function () { var that = new util.TextEncoder() var buffer = new ArrayBuffer(20) var result = new Uint8Array(buffer) - result = that.encode('\uD800楼楼') - expect(result[5]).assertEqual(188) + result = that.encode('a\uD800楼楼') + expect(result[0]).assertEqual(0x61) }) /** @@ -757,8 +760,8 @@ describe('TextEncoderTest', function () { var that = new util.TextEncoder() var buffer = new ArrayBuffer(20) var result = new Uint8Array(buffer) - result = that.encode('a\uD800楼楼') - expect(result[0]).assertEqual(0x61) + result = that.encode('abc\uD800楼楼') + expect(result[1]).assertEqual(0x62) }) /** @@ -771,8 +774,9 @@ describe('TextEncoderTest', function () { var that = new util.TextEncoder() var buffer = new ArrayBuffer(20) var result = new Uint8Array(buffer) - result = that.encode('abc\uD800楼楼') - expect(result[1]).assertEqual(0x62) + result = that.encode('123\uD800楼楼') + expect(result[0]).assertEqual(49) + expect(result[9]).assertEqual(230) }) /** @@ -785,9 +789,8 @@ describe('TextEncoderTest', function () { var that = new util.TextEncoder() var buffer = new ArrayBuffer(20) var result = new Uint8Array(buffer) - result = that.encode('123\uD800楼楼') - expect(result[0]).assertEqual(49) - expect(result[9]).assertEqual(230) + result = that.encode('abc\uD800楼楼') + expect(result[1]).assertEqual(0x62) }) /** @@ -960,6 +963,7 @@ describe('TextEncoderTest', function () { expect(result.written).assertEqual(0) }) + /** * @tc.name: testGetLower001 * @tc.desc: Obtains the lower bound of the current range. * @tc.require: AR000GFB4U @@ -1458,7 +1462,8 @@ describe('TextEncoderTest', function () { /** * @tc.name: testInstersect001 - * @tc.desc: Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @tc.desc: Returns the intersection of the current range and + * the range specified by the given lower and upper bounds. * @tc.require: AR000GFB4U * @tc.author: jiangkai */ @@ -1469,7 +1474,8 @@ describe('TextEncoderTest', function () { /** * @tc.name: testInstersect002 - * @tc.desc: Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @tc.desc: Returns the intersection of the current range and + * the range specified by the given lower and upper bounds. * @tc.require: AR000GFB4U * @tc.author: jiangkai */ @@ -1480,7 +1486,8 @@ describe('TextEncoderTest', function () { /** * @tc.name: testInstersect003 - * @tc.desc: Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @tc.desc: Returns the intersection of the current range and + * the range specified by the given lower and upper bounds. * @tc.require: AR000GFB4U * @tc.author: jiangkai */ @@ -1491,7 +1498,8 @@ describe('TextEncoderTest', function () { /** * @tc.name: testInstersect004 - * @tc.desc: Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @tc.desc: Returns the intersection of the current range and + * the range specified by the given lower and upper bounds. * @tc.require: AR000GFB4U * @tc.author: jiangkai */ @@ -1502,7 +1510,8 @@ describe('TextEncoderTest', function () { /** * @tc.name: testInstersect005 - * @tc.desc: Returns the intersection of the current range and the range specified by the given lower and upper bounds. + * @tc.desc: Returns the intersection of the current range and + * the range specified by the given lower and upper bounds. * @tc.require: AR000GFB4U * @tc.author: jiangkai */ @@ -1565,12 +1574,14 @@ describe('TextEncoderTest', function () { var result = rangeFif.toString() expect(result).assertEqual('[35, 45]') }) - }) +}) describe('Base64Test', function () { - /** + + /** * @tc.name: testEncode001 - * @tc.desc: Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @tc.desc: Encodes all bytes from the specified u8 array into + * a newly-allocated u8 array using the Base64 encoding scheme. * @tc.require: AR000GFB2Q * @tc.author: bihu */ @@ -1578,7 +1589,8 @@ describe('TextEncoderTest', function () { var that = new util.Base64() var array = new Uint8Array([115,49,51]); var rarray = new Uint8Array([99,122,69,122]); - var result = that.encode(array); + var flags = 0; + var result = that.encode(array, flags); for (var i = 0; i < 4; i++) { expect(result[i]).assertEqual(rarray[i]); } @@ -1586,7 +1598,8 @@ describe('TextEncoderTest', function () { /** * @tc.name: testEncode002 - * @tc.desc: Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @tc.desc: Encodes all bytes from the specified u8 array into + * a newly-allocated u8 array using the Base64 encoding scheme. * @tc.require: AR000GFB2Q * @tc.author: bihu */ @@ -1594,7 +1607,8 @@ describe('TextEncoderTest', function () { var that = new util.Base64() var array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); var rarray = new Uint8Array([81,109,70,122,90,84,89,48,73,69,53,118,90,71,85,117,97,110,77,61]); - var result = that.encode(array); + var flags = 0; + var result = that.encode(array, flags); for (var i = 0; i < 20; i++) { expect(result[i]).assertEqual(rarray[i]); } @@ -1602,15 +1616,19 @@ describe('TextEncoderTest', function () { /** * @tc.name: testEncode003 - * @tc.desc: Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @tc.desc: Encodes all bytes from the specified u8 array into + * a newly-allocated u8 array using the Base64 encoding scheme. * @tc.require: AR000GFB2Q * @tc.author: bihu */ it('testEncode003', 0, function () { var that = new util.Base64() - var array = new Uint8Array([66,97,115,101,54,52,32,69,110,99,111,100,105,110,103,32,105,110,32,78,111,100,101,46,106,115]); - var rarray = new Uint8Array([81,109,70,122,90,84,89,48,73,69,86,117,89,50,57,107,97,87,53,110,73,71,108,117,73,69,53,118,90,71,85,117,97,110,77,61]); - var result = that.encode(array); + var array = new Uint8Array([66,97,115,101,54,52,32,69,110,99,111,100, + 105,110,103,32,105,110,32,78,111,100,101,46,106,115]); + var rarray = new Uint8Array([81,109,70,122,90,84,89,48,73,69,86,117,89, + 50,57,107,97,87,53,110,73,71,108,117,73,69,53,118,90,71,85,117,97,110,77,61]); + var flags = 0; + var result = that.encode(array, flags); for (var i = 0; i < 36; i++) { expect(result[i]).assertEqual(rarray[i]); } @@ -1618,7 +1636,8 @@ describe('TextEncoderTest', function () { /** * @tc.name: testEncode004 - * @tc.desc: Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @tc.desc: Encodes all bytes from the specified u8 array into + * a newly-allocated u8 array using the Base64 encoding scheme. * @tc.require: AR000GFB2Q * @tc.author: bihu */ @@ -1626,7 +1645,8 @@ describe('TextEncoderTest', function () { var that = new util.Base64() var array = new Uint8Array([168, 174, 155, 255]); var rarray = new Uint8Array([113,75,54,98,47,119,61,61]); - var result = that.encode(array); + var flags = 0; + var result = that.encode(array, flags); for (var i = 0; i < 8; i++) { expect(result[i]).assertEqual(rarray[i]); } @@ -1634,7 +1654,8 @@ describe('TextEncoderTest', function () { /** * @tc.name: testEncode005 - * @tc.desc: Encodes all bytes from the specified u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @tc.desc: Encodes all bytes from the specified u8 array into + * a newly-allocated u8 array using the Base64 encoding scheme. * @tc.require: AR000GFB2Q * @tc.author: bihu */ @@ -1642,7 +1663,8 @@ describe('TextEncoderTest', function () { var that = new util.Base64() var array = new Uint8Array([66, 97, 115, 101, 54, 52]); var rarray = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48]); - var result = that.encode(array); + var flags = 0; + var result = that.encode(array, flags); for (var i = 0; i <8; i++) { expect(result[i]).assertEqual(rarray[i]); } @@ -1657,7 +1679,8 @@ describe('TextEncoderTest', function () { it('testEncodeToString001', 0, function () { var that = new util.Base64() var array = new Uint8Array([115,49,51]); - var result = that.encodeToString(array) + var flags = 0; + var result = that.encodeToString(array, flags) expect(result).assertEqual('czEz') }) @@ -1669,8 +1692,10 @@ describe('TextEncoderTest', function () { */ it('testEncodeToString002', 0, function () { var that = new util.Base64() - var array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - var result = that.encodeToString(array); + var array = new Uint8Array([66, 97, 115, 101, 54, 52, + 32, 78, 111, 100, 101, 46, 106, 115]); + var flags = 0; + var result = that.encodeToString(array, flags); expect(result).assertEqual('QmFzZTY0IE5vZGUuanM=') }) @@ -1682,8 +1707,10 @@ describe('TextEncoderTest', function () { */ it('testEncodeToString003', 0, function () { var that = new util.Base64() - var array = new Uint8Array([66,97,115,101,54,52,32,69,110,99,111,100,105,110,103,32,105,110,32,78,111,100,101,46,106,115]); - var result = that.encodeToString(array); + var array = new Uint8Array([66,97,115,101,54,52,32,69,110, + 99,111,100,105,110,103,32,105,110,32,78,111,100,101,46,106,115]); + var flags = 0; + var result = that.encodeToString(array, flags); expect(result).assertEqual('QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM=') }) @@ -1696,7 +1723,8 @@ describe('TextEncoderTest', function () { it('testEncodeToString004', 0, function () { var that = new util.Base64() var array = new Uint8Array([168, 174, 155, 255]); - var result = that.encodeToString(array); + var flags = 0; + var result = that.encodeToString(array, flags); expect(result).assertEqual('qK6b/w==') }) @@ -1709,499 +1737,120 @@ describe('TextEncoderTest', function () { it('testEncodeToString005', 0, function () { var that = new util.Base64() var array = new Uint8Array([66, 97, 115, 101, 54, 52]); - var result = that.encodeToString(array); + var flags = 0; + var result = that.encodeToString(array, flags); expect(result).assertEqual('QmFzZTY0') }) /** * @tc.name: testDecode001 - * @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @tc.desc: Decodes a Base64 encoded String or input u8 array into + * a newly-allocated u8 array using the Base64 encoding scheme. * @tc.require: AR000GFB2Q * @tc.author: bihu */ it('testDecode001', 0, function () { - var that = new util.Base64() - var buff = 'czEz'; - var rarray = new Uint8Array([115,49,51]); - var result = that.decode(buff); - for (var i = 0; i < 3; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }) - - /** - * @tc.name: testDecode002 - * @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecode002', 0, function () { - var that = new util.Base64() - var buff = 'QmFzZTY0IE5vZGUuanM='; - var rarray = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - var result = that.decode(buff); - for (var i = 0; i < 14; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }) - - /** - * @tc.name: testDecode003 - * @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecode003', 0, function () { - var that = new util.Base64() - var buff = 'QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM='; - var rarray = new Uint8Array([66,97,115,101,54,52,32,69,110,99,111,100,105,110,103,32,105,110,32,78,111,100,101,46,106,115]); - var result = that.decode(buff); - for (var i = 0; i < 26; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }) - - /** - * @tc.name: testDecode004 - * @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecode004', 0, function () { - var that = new util.Base64() - var buff = 'qK6b/w=='; - var rarray = new Uint8Array([168, 174, 155, 255]); - var result = that.decode(buff); - for (var i = 0; i < 4; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }) - - /** - * @tc.name: testDecode005 - * @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecode005', 0, function () { - var that = new util.Base64() - var buff = 'QmFzZTY0'; - var rarray = new Uint8Array([66, 97, 115, 101, 54, 52]); - var result = that.decode(buff); - for (var i = 0; i <6; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }) - - /** - * @tc.name: testDecode001 - * @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecode001', 0, function () { - var that = new util.Base64() - var array = new Uint8Array([99,122,69,122]); - var rarray = new Uint8Array([115,49,51]); - var result = that.decode(array); + var that = new util.TextDecoder('utf-8'); + var arr = new Uint8Array(3); for (var i = 0; i < 3; i++) { - expect(result[i]).assertEqual(rarray[i]); + arr[i] = 0x61 + i; } + var retStr = that.decode(arr); + var rel = 'abc'; + expect(retStr).assertEqual(rel); }) /** * @tc.name: testDecode002 - * @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @tc.desc: Decodes a Base64 encoded String or input u8 array into + * a newly-allocated u8 array using the Base64 encoding scheme. * @tc.require: AR000GFB2Q * @tc.author: bihu */ it('testDecode002', 0, function () { - var that = new util.Base64() - var array = new Uint8Array([81,109,70,122,90,84,89,48,73,69,53,118,90,71,85,117,97,110,77,61]); - var rarray = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - var result = that.decode(array); - for (var i = 0; i < 14; i++) { - expect(result[i]).assertEqual(rarray[i]); - } + var that = new util.TextDecoder('utf-16le') + var arr = new Uint8Array(6) + arr[0] = 0x61; + arr[1] = 0x00; + arr[2] = 0x62; + arr[3] = 0x00; + arr[4] = 0x63; + arr[5] = 0x00; + var retStr = that.decode(arr) + var rel = 'abc' + expect(retStr).assertEqual(rel) }) /** * @tc.name: testDecode003 - * @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @tc.desc: Decodes a Base64 encoded String or input u8 array into + * a newly-allocated u8 array using the Base64 encoding scheme. * @tc.require: AR000GFB2Q * @tc.author: bihu */ it('testDecode003', 0, function () { - var that = new util.Base64() - var array = new Uint8Array([81,109,70,122,90,84,89,48,73,69,86,117,89,50,57,107,97,87,53,110,73,71,108,117,73,69,53,118,90,71,85,117,97,110,77,61]); - var rarray = new Uint8Array([66,97,115,101,54,52,32,69,110,99,111,100,105,110,103,32,105,110,32,78,111,100,101,46,106,115]); - var result = that.decode(array); - for (var i = 0; i < 26; i++) { - expect(result[i]).assertEqual(rarray[i]); - } + var that = new util.TextDecoder('utf-16be'); + var arr = new Uint8Array(6); + arr[0] = 0x00; + arr[1] = 0x61; + arr[2] = 0x00; + arr[3] = 0x62; + arr[4] = 0x00; + arr[5] = 0x63; + var retStr = that.decode(arr); + var rel = 'abc' + expect(retStr).assertEqual(rel); }) /** * @tc.name: testDecode004 - * @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @tc.desc: Decodes a Base64 encoded String or input u8 array into + * a newly-allocated u8 array using the Base64 encoding scheme. * @tc.require: AR000GFB2Q * @tc.author: bihu */ it('testDecode004', 0, function () { - var that = new util.Base64() - var array = new Uint8Array([113,75,54,98,47,119,61,61]); - var rarray = new Uint8Array([168, 174, 155, 255]); - var result = that.decode(array); - for (var i = 0; i < 4; i++) { - expect(result[i]).assertEqual(rarray[i]); - } + var that = new util.TextDecoder('utf-8', { ignoreBOM :true }) + var arr = new Uint8Array(6) + arr[0] = 0xEF; + arr[1] = 0xBB; + arr[2] = 0xBF; + arr[3] = 0x61; + arr[4] = 0x62; + arr[5] = 0x63; + var retStr = that.decode(arr, {stream:true}) + var BOM = '\uFEFF' + var rel = 'abc' + var re = BOM + rel + expect(retStr).assertEqual(re); }) /** * @tc.name: testDecode005 - * @tc.desc: Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 array using the Base64 encoding scheme. + * @tc.desc: Decodes a Base64 encoded String or input u8 array into + * a newly-allocated u8 array using the Base64 encoding scheme. * @tc.require: AR000GFB2Q * @tc.author: bihu */ it('testDecode005', 0, function () { - var that = new util.Base64() - var array = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48]); - var rarray = new Uint8Array([66, 97, 115, 101, 54, 52]); - var result = that.decode(array); - for (var i = 0; i <6; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }) - - //base64 EncodeAsync test - /** - * @tc.name: testEncodeAsync001 - * @tc.desc: Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testEncodeAsync001', 0, async function () { - var that = await new util.Base64(); - var array = new Uint8Array([115,49,51]); - var rarray = new Uint8Array([99,122,69,122]); - that.encodeAsync(array).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) - }) - - /** - * @tc.name: testEncodeAsync002 - * @tc.desc: Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testEncodeAsync002', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - var rarray = new Uint8Array([81,109,70,122,90,84,89,48,73,69,53,118,90,71,85,117,97,110,77,61]); - that.encodeAsync(array).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) - }) - - /** - * @tc.name: testEncodeAsync003 - * @tc.desc: Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testEncodeAsync003', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([66,97,115,101,54,52,32,69,110,99,111,100,105,110,103,32,105,110,32,78,111,100,101,46,106,115]); - var rarray = new Uint8Array([81,109,70,122,90,84,89,48,73,69,86,117,89,50,57,107,97,87,53,110,73,71,108,117,73,69,53,118,90,71,85,117,97,110,77,61]); - that.encodeAsync(array).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) - }) - - /** - * @tc.name: testEncodeAsync004 - * @tc.desc: Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testEncodeAsync004', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([168, 174, 155, 255]); - var rarray = new Uint8Array([113,75,54,98,47,119,61,61]); - that.encodeAsync(array).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) - }) - - /** - * @tc.name: testEncodeAsync005 - * @tc.desc: Asynchronously encodes all bytes in the specified u8 array into the newly allocated u8 array using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testEncodeAsync005', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([66, 97, 115, 101, 54, 52]); - var rarray = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48]); - that.encodeAsync(array).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) - }) - - /** - * @tc.name: testEncodeToStringAsync001 - * @tc.desc: Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testEncodeToStringAsync001', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([115,49,51]); - that.encodeToStringAsync(array).then(val=>{ - expect(val).assertEqual('czEz') - }) - }) - - /** - * @tc.name: testEncodeToStringAsync002 - * @tc.desc: Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testEncodeToStringAsync002', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - that.encodeToStringAsync(array).then(val=>{ - expect(val).assertEqual('QmFzZTY0IE5vZGUuanM=') - }) - }) - - /** - * @tc.name: testEncodeToStringAsync003 - * @tc.desc: Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testEncodeToStringAsync003', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([81,109,70,122,90,84,89,48,73,69,86,117,89,50,57,107,97,87,53,110,73,71,108,117,73,69,53,118,90,71,85,117,97,110,77,61]); - that.encodeToStringAsync(array).then(val=>{ - expect(val).assertEqual('QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM=') - }) - }) - - /** - * @tc.name: testEncodeToStringAsync004 - * @tc.desc: Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testEncodeToStringAsync004', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([168, 174, 155, 255]); - that.encodeToStringAsync(array).then(val=>{ - expect(val).assertEqual('qK6b/w==') - }) - }) - - /** - * @tc.name: testEncodeToStringAsync005 - * @tc.desc: Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testEncodeToStringAsync005', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([66, 97, 115, 101, 54, 52]); - that.encodeToStringAsync(array).then(val=>{ - expect(val).assertEqual('QmFzZTY0') - }) - }) - - /** - * @tc.name: testDecodeAsync001 - * @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecodeAsync001', 0, async function () { - var that = new util.Base64() - var buff = 'czEz'; - var array = new Uint8Array([115,49,51]); - that.decodeAsync(buff).then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) - - /** - * @tc.name: testDecodeAsync002 - * @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecodeAsync002', 0, async function () { - var that = new util.Base64() - var buff = 'QmFzZTY0IE5vZGUuanM='; - var array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - that.decodeAsync(buff).then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) - - /** - * @tc.name: testDecodeAsync003 - * @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecodeAsync003', 0, async function () { - var that = new util.Base64() - var buff = 'QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM='; - var array = new Uint8Array([66,97,115,101,54,52,32,69,110,99,111,100,105,110,103,32,105,110,32,78,111,100,101,46,106,115]); - that.decodeAsync(buff).then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) - - /** - * @tc.name: testDecodeAsync004 - * @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecodeAsync004', 0, async function () { - var that = new util.Base64() - var buff = 'qK6b/w=='; - var array = new Uint8Array([168, 174, 155, 255]); - that.decodeAsync(buff).then(val=>{ - for (var i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]) - } - }) - }) - - /** - * @tc.name: testDecodeAsync005 - * @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecodeAsync005', 0, async function () { - var that = new util.Base64() - var buff = 'QmFzZTY0'; - var rarray = new Uint8Array([66, 97, 115, 101, 54, 52]); - that.decodeAsync(buff).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) - }) - - /** - * @tc.name: testDecodeAsync001 - * @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecodeAsync001', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([99,122,69,122]); - var rarray = new Uint8Array([115,49,51]); - that.decodeAsync(array).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) - }) - - /** - * @tc.name: testDecodeAsync002 - * @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecodeAsync002', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([81,109,70,122,90,84,89,48,73,69,53,118,90,71,85,117,97,110,77,61]); - var rarray = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - that.decodeAsync(array).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) - }) - - /** - * @tc.name: testDecodeAsync003 - * @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecodeAsync003', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([81,109,70,122,90,84,89,48,73,69,86,117,89,50,57,107,97,87,53,110,73,71,108,117,73,69,53,118,90,71,85,117,97,110,77,61]); - var rarray = new Uint8Array([66,97,115,101,54,52,32,69,110,99,111,100,105,110,103,32,105,110,32,78,111,100,101,46,106,115]); - that.decodeAsync(array).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) - }) - - /** - * @tc.name: testDecodeAsync004 - * @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecodeAsync004', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([113,75,54,98,47,119,61,61]); - var rarray = new Uint8Array([168, 174, 155, 255]); - that.decodeAsync(array).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) + var that = new util.TextDecoder('utf-16be'); + var arr = new Uint8Array(6); + arr[0] = 0x00; + arr[1] = 0x61; + arr[2] = 0x00; + arr[3] = 0x62; + arr[4] = 0x00; + arr[5] = 0x63; + var retStr = that.decode(arr); + var rel = 'abc' + expect(retStr).assertEqual(rel); }) - /** - * @tc.name: testDecodeAsync005 - * @tc.desc: Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 array into a newly allocated u8 array. - * @tc.require: AR000GFB2Q - * @tc.author: bihu - */ - it('testDecodeAsync005', 0, async function () { - var that = new util.Base64() - var array = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48]); - var rarray = new Uint8Array([66, 97, 115, 101, 54, 52]); - that.decodeAsync(array).then(val=>{ - for (var i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]) - } - }) - }) - }) +}) describe('RationalNumberFunTest', function () { - /** + + /** * @tc.name: testRationalNumberCreateRationalFromString001 * @tc.desc: Creates a RationalNumber object based on a given string. * @tc.require: AR000GFB5A @@ -2878,7 +2527,8 @@ describe('TextEncoderTest', function () { }) describe('LruBufferFunTest', function () { - /** + + /** * @tc.name: testLruBufferUpdateCapacity001 * @tc.desc: Updates the buffer capacity to a specified capacity. * @tc.require: AR000GFB59 @@ -3118,94 +2768,6 @@ describe('TextEncoderTest', function () { expect(temp5).assertEqual(22) }) - /** - * @tc.name: testLruBufferGetCreateCount001 - * @tc.desc: Obtains the number of times createDefault(Object) returned a value. - * @tc.require: AR000GFB59 - * @tc.author: lixingyang - */ - it('testLruBufferGetCreateCount001', 0, function () { - var that = new util.LruBuffer() - that.put(1,2) - that.put(2,10) - that.put('abcd',15) - that.get(3) - that.get(5) - that.get(10) - var result = that.getCreateCount() - expect(result).assertEqual(0) - }) - - /** - * @tc.name: testLruBufferGetCreateCount002 - * @tc.desc: Obtains the number of times createDefault(Object) returned a value. - * @tc.require: AR000GFB59 - * @tc.author: lixingyang - */ - it('testLruBufferGetCreateCount002', 0, function () { - var that = new util.LruBuffer() - that.put(1,2) - that.put(2,10) - that.put('abcd',15) - that.get(6) - that.get(8) - that.get(20) - var result = that.getCreateCount() - expect(result).assertEqual(0) - }) - - /** - * @tc.name: testLruBufferGetCreateCount003 - * @tc.desc: Obtains the number of times createDefault(Object) returned a value. - * @tc.require: AR000GFB59 - * @tc.author: lixingyang - */ - it('testLruBufferGetCreateCount003', 0, function () { - var that = new util.LruBuffer() - that.put(1,2) - that.put(2,10) - that.get('abc') - that.get('cndk') - var result = that.getCreateCount() - expect(result).assertEqual(0) - }) - - /** - * @tc.name: testLruBufferGetCreateCount004 - * @tc.desc: Obtains the number of times createDefault(Object) returned a value. - * @tc.require: AR000GFB59 - * @tc.author: lixingyang - */ - it('testLruBufferGetCreateCount004', 0, function () { - var that = new util.LruBuffer() - that.put(5,2) - that.put(10,10) - that.put('abcd','abcd') - that.get(3) - that.get(20) - that.get(12) - var result = that.getCreateCount() - expect(result).assertEqual(0) - }) - - /** - * @tc.name: testLruBufferGetCreateCount005 - * @tc.desc: Obtains the number of times createDefault(Object) returned a value. - * @tc.require: AR000GFB59 - * @tc.author: lixingyang - */ - it('testLruBufferGetCreateCount005', 0, function () { - var that = new util.LruBuffer() - that.put('xsjk','bcjds') - that.put('ajc',10) - that.put('abcd',15) - that.get(2) - that.get(10) - that.get(30) - var result = that.getCreateCount() - expect(result).assertEqual(0) - }) - /** * @tc.name: testLruBufferGetMissCount001 * @tc.desc: Obtains the number of times that the queried values are not matched. diff --git a/compileruntime/util_lib_standard/src/main/js/test/ExampleJsunit.test.js b/compileruntime/util_lib_standard/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 426966658ed8171651ffdf61b361c24fc0c90b60..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 diff --git a/compileruntime/util_lib_standard/src/main/resources/base/element/string.json b/compileruntime/util_lib_standard/src/main/resources/base/element/string.json index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..239a23e5b1c057bb46e2defa92cae47bade0afed 100644 --- a/compileruntime/util_lib_standard/src/main/resources/base/element/string.json +++ b/compileruntime/util_lib_standard/src/main/resources/base/element/string.json @@ -1,12 +1,12 @@ { "string": [ { - "name": "entry_MainAbility", - "value": "entry_MainAbility" + "name": "app_name", + "value": "OsAccountTest" }, { "name": "mainability_description", - "value": "JS_Empty Ability" + "value": "JS_Phone_Empty Feature Ability" } ] } \ No newline at end of file diff --git a/compileruntime/util_lib_standard/src/main/resources/base/media/icon.png b/compileruntime/util_lib_standard/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/compileruntime/util_lib_standard/src/main/resources/base/media/icon.png differ diff --git a/compileruntime/util_lib_standard/src/ohosTest/js/default/app.js b/compileruntime/util_lib_standard/src/ohosTest/js/default/app.js deleted file mode 100644 index 4952e62fd96d8dcf3eb348d293249c2a18176c85..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/ohosTest/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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'); - } -}; diff --git a/compileruntime/util_lib_standard/src/ohosTest/js/default/i18n/en-US.json b/compileruntime/util_lib_standard/src/ohosTest/js/default/i18n/en-US.json deleted file mode 100644 index 55561b83737c3c31d082fbfa11e5fc987a351104..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/ohosTest/js/default/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/compileruntime/util_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json b/compileruntime/util_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json deleted file mode 100644 index cce1af06761a42add0cac1a0567aa3237eda8cb4..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/ohosTest/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.css b/compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.css deleted file mode 100644 index 6fda792753f2e15f22b529c7b90a82185b2770bf..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.hml b/compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.js b/compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.js deleted file mode 100644 index 9b041d7007852ac57c688654fb8f42c2c9ac9a51..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/ohosTest/js/default/pages/index/index.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 diff --git a/compileruntime/util_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js b/compileruntime/util_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js deleted file mode 100644 index d043e7e9479ed2a8e2751397c67d43c2ee8f7a08..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/ohosTest/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 diff --git a/compileruntime/util_lib_standard/src/ohosTest/js/test/List.test.js b/compileruntime/util_lib_standard/src/ohosTest/js/test/List.test.js deleted file mode 100644 index 86ae9fa262b8d3fa27e4ac734dbd529d37d0b7cd..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/ohosTest/js/test/List.test.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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. - */ - -require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/compileruntime/util_lib_standard/src/ohosTest/resources/base/element/string.json b/compileruntime/util_lib_standard/src/ohosTest/resources/base/element/string.json deleted file mode 100644 index ee04e287523beb449e633f5be2900410f7be79af..0000000000000000000000000000000000000000 --- a/compileruntime/util_lib_standard/src/ohosTest/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "childprocess" - }, - { - "name": "mainability_description", - "value": "hap sample empty page" - } - ] -} diff --git a/compileruntime/worker_lib_standard/src/main/config.json b/compileruntime/worker_lib_standard/src/main/config.json index 18665aeb48d8098fa1232be5e0195d8145ada9e7..bcb6c0fff3288358a6e0ccc71d54789a26d37d4b 100644 --- a/compileruntime/worker_lib_standard/src/main/config.json +++ b/compileruntime/worker_lib_standard/src/main/config.json @@ -5,6 +5,10 @@ "version": { "code": 1000000, "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 } }, "deviceConfig": {}, diff --git a/compileruntime/worker_lib_standard/src/main/js/test/Worker.test.js b/compileruntime/worker_lib_standard/src/main/js/test/Worker.test.js index 0a3f9099b69d5a97f3cbc5458afb15c268ef46e4..e7d5ab906b7d6be551ba4f5744ed6036f885c94d 100644 --- a/compileruntime/worker_lib_standard/src/main/js/test/Worker.test.js +++ b/compileruntime/worker_lib_standard/src/main/js/test/Worker.test.js @@ -16,7 +16,7 @@ // @ts-nocheck import app from '@system.app' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -//import worker from "@ohos.worker"; +import worker from '@ohos.worker' var worker = globalThis.requireNapi('worker'); describe('workerTest', function () {