提交 282e30d9 编写于 作者: L lifansheng

Signed-off-by: lifansheng <lifansheng1@huawei.com>

 On branch OpenHarmony-3.0-LTS
 Your branch is up to date with 'origin/OpenHarmony-3.0-LTS'.
上级 81d995c2
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
"version": { "version": {
"code": 1000000, "code": 1000000,
"name": "1.0.0" "name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
...@@ -23,6 +27,7 @@ ...@@ -23,6 +27,7 @@
}, },
"abilities": [ "abilities": [
{ {
"visible": true,
"skills": [ "skills": [
{ {
"entities": [ "entities": [
...@@ -49,7 +54,7 @@ ...@@ -49,7 +54,7 @@
"name": "default", "name": "default",
"window": { "window": {
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": true "autoDesignWidth": false
} }
} }
] ]
......
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.childprocess;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.childprocess;
import ohos.aafwk.ability.AbilityPackage;
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License'); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info('AceApplication onCreate'); console.info('AceApplication onCreate');
......
...@@ -5,40 +5,5 @@ ...@@ -5,40 +5,5 @@
} }
.title { .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; font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
} }
<div class="container" onswipe="touchMove"> <div class="container">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{title}} {{ $t('strings.hello') }} {{ title }}
</text> </text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div> </div>
\ No newline at end of file
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License'); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import file from '@system.file' import file from '@system.file'
import app from '@system.app' import app from '@system.app'
import device from '@system.device' import device from '@system.device'
import router from '@system.router' import router from '@system.router'
import {Core} from 'deccjsunit/lite' import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
export default { export default {
data: { data: {
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
core.init() core.init()
require('../../../test/List.test') require('../../test/List.test')
core.execute() core.execute()
}, },
onReady() { onReady() {
......
...@@ -13,5 +13,4 @@ ...@@ -13,5 +13,4 @@
* limitations under the License. * limitations under the License.
*/ */
require('./ExampleJsunit.test.js')
require('./Process.test.js') require('./Process.test.js')
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "app_name",
"value": "entry_MainAbility" "value": "OsAccountTest"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Empty Ability" "value": "JS_Phone_Empty Feature Ability"
} }
] ]
} }
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
const instrumentLog = new InstrumentLog({
'id': 'report'
})
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.addService('report', instrumentLog)
core.init()
core.subscribeEvent('spec', instrumentLog)
core.subscribeEvent('suite', instrumentLog)
core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect(info.versionName).assertEqual('1.0')
expect(info.versionCode).assertEqual('3')
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./ExampleJsunit.test.js')
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "childprocess"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
\ No newline at end of file
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
"version": { "version": {
"code": 1000000, "code": 1000000,
"name": "1.0.0" "name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
...@@ -23,6 +27,7 @@ ...@@ -23,6 +27,7 @@
}, },
"abilities": [ "abilities": [
{ {
"visible": true,
"skills": [ "skills": [
{ {
"entities": [ "entities": [
...@@ -49,7 +54,7 @@ ...@@ -49,7 +54,7 @@
"name": "default", "name": "default",
"window": { "window": {
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": true "autoDesignWidth": false
} }
} }
] ]
......
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.url;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.url;
import ohos.aafwk.ability.AbilityPackage;
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License'); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info('AceApplication onCreate'); console.info('AceApplication onCreate');
......
...@@ -5,40 +5,5 @@ ...@@ -5,40 +5,5 @@
} }
.title { .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; font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
} }
...@@ -16,7 +16,8 @@ import file from '@system.file' ...@@ -16,7 +16,8 @@ import file from '@system.file'
import app from '@system.app' import app from '@system.app'
import device from '@system.device' import device from '@system.device'
import router from '@system.router' import router from '@system.router'
import {Core} from 'deccjsunit/lite' import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
export default { export default {
data: { data: {
...@@ -29,7 +30,7 @@ export default { ...@@ -29,7 +30,7 @@ export default {
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
core.init() core.init()
require('../../../test/List.test') require('../../test/List.test')
core.execute() core.execute()
}, },
onReady() { onReady() {
......
...@@ -13,4 +13,3 @@ ...@@ -13,4 +13,3 @@
* limitations under the License. * limitations under the License.
*/ */
require('./url.test.js') require('./url.test.js')
require('./ExampleJsunit.test.js')
/*
* 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
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "app_name",
"value": "entry_MainAbility" "value": "OsAccountTest"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Empty Ability" "value": "JS_Phone_Empty Feature Ability"
} }
] ]
} }
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect(info.versionName).assertEqual('1.0')
expect(info.versionCode).assertEqual('3')
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./ExampleJsunit.test.js')
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "URL"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
"version": { "version": {
"code": 1000000, "code": 1000000,
"name": "1.0.0" "name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
...@@ -23,6 +27,7 @@ ...@@ -23,6 +27,7 @@
}, },
"abilities": [ "abilities": [
{ {
"visible": true,
"skills": [ "skills": [
{ {
"entities": [ "entities": [
...@@ -49,7 +54,7 @@ ...@@ -49,7 +54,7 @@
"name": "default", "name": "default",
"window": { "window": {
"designWidth": 720, "designWidth": 720,
"autoDesignWidth": true "autoDesignWidth": false
} }
} }
] ]
......
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.childprocess;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.childprocess;
import ohos.aafwk.ability.AbilityPackage;
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.url;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.example.url;
import ohos.aafwk.ability.AbilityPackage;
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License'); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info('AceApplication onCreate'); console.info('AceApplication onCreate');
......
...@@ -5,40 +5,5 @@ ...@@ -5,40 +5,5 @@
} }
.title { .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; font-size: 100px;
color: #FFFFFF;
}
}
@media screen and (device-type: phone) and (orientation: landscape) {
.title {
font-size: 60px;
}
} }
<div class="container" onswipe="touchMove"> <div class="container">
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{title}} {{ $t('strings.hello') }} {{ title }}
</text> </text>
<input class="btn" type="button" value="{{ $t('strings.next') }}" onclick="onclick"></input>
</div> </div>
\ No newline at end of file
...@@ -12,12 +12,12 @@ ...@@ -12,12 +12,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import file from '@system.file' import file from '@system.file'
import app from '@system.app' import app from '@system.app'
import device from '@system.device' import device from '@system.device'
import router from '@system.router' import router from '@system.router'
import {Core} from 'deccjsunit/lite' import {Core, Constant, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
export default { export default {
data: { data: {
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
console.info('onShow finish') console.info('onShow finish')
const core = Core.getInstance() const core = Core.getInstance()
core.init() core.init()
require('../../../test/List.test') require('../../test/List.test')
core.execute() core.execute()
}, },
onReady() { onReady() {
......
...@@ -13,5 +13,4 @@ ...@@ -13,5 +13,4 @@
* limitations under the License. * limitations under the License.
*/ */
require('./ExampleJsunit.test.js')
require('./TextCodr.test.js') require('./TextCodr.test.js')
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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
{ {
"string": [ "string": [
{ {
"name": "entry_MainAbility", "name": "app_name",
"value": "entry_MainAbility" "value": "OsAccountTest"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Empty Ability" "value": "JS_Phone_Empty Feature Ability"
} }
] ]
} }
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('TestApplication onCreate');
},
onDestroy() {
console.info('TestApplication onDestroy');
}
};
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}
\ No newline at end of file
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}
\ No newline at end of file
.container {
flex-direction: column;
justify-content: center;
align-items: center;
}
.title {
font-size: 100px;
}
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file'
import app from '@system.app'
import device from '@system.device'
import router from '@system.router'
import {Core, ExpectExtend, ReportExtend, InstrumentLog} from 'deccjsunit/index'
export default {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
const reportExtend = new ReportExtend(file)
const instrumentLog = new InstrumentLog({
'id': 'report'
})
core.addService('expect', expectExtend)
core.addService('report', reportExtend)
core.addService('report', instrumentLog)
core.init()
core.subscribeEvent('spec', instrumentLog)
core.subscribeEvent('suite', instrumentLog)
core.subscribeEvent('task', instrumentLog)
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../../test/List.test')
core.execute()
},
onReady() {
},
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect(info.versionName).assertEqual('1.0')
expect(info.versionCode).assertEqual('3')
})
})
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
require('./ExampleJsunit.test.js')
\ No newline at end of file
{
"string": [
{
"name": "app_name",
"value": "childprocess"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
"version": { "version": {
"code": 1000000, "code": 1000000,
"name": "1.0.0" "name": "1.0.0"
},
"apiVersion": {
"compatible": 4,
"target": 5
} }
}, },
"deviceConfig": {}, "deviceConfig": {},
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
// @ts-nocheck // @ts-nocheck
import app from '@system.app' import app from '@system.app'
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' 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'); var worker = globalThis.requireNapi('worker');
describe('workerTest', function () { describe('workerTest', function () {
...@@ -25,7 +25,7 @@ describe('workerTest', function () { ...@@ -25,7 +25,7 @@ describe('workerTest', function () {
console.info('total case over') console.info('total case over')
}) })
function PromiseCase() { function promiseCase() {
let p = new Promise(function (resolve, reject) { let p = new Promise(function (resolve, reject) {
setTimeout(function () { setTimeout(function () {
resolve() resolve()
...@@ -71,7 +71,7 @@ describe('workerTest', function () { ...@@ -71,7 +71,7 @@ describe('workerTest', function () {
ss.postMessage("hello world") ss.postMessage("hello world")
while (!flag) { while (!flag) {
await PromiseCase() await promiseCase()
} }
expect(res).assertEqual("hello world worker") expect(res).assertEqual("hello world worker")
done() done()
...@@ -92,7 +92,7 @@ describe('workerTest', function () { ...@@ -92,7 +92,7 @@ describe('workerTest', function () {
ss.postMessage(12) ss.postMessage(12)
while (!flag) { while (!flag) {
await PromiseCase() await promiseCase()
} }
expect(res).assertEqual(25) expect(res).assertEqual(25)
done() done()
...@@ -113,7 +113,7 @@ describe('workerTest', function () { ...@@ -113,7 +113,7 @@ describe('workerTest', function () {
ss.postMessage({"message":"hello world"}) ss.postMessage({"message":"hello world"})
while (!flag) { while (!flag) {
await PromiseCase() await promiseCase()
} }
expect(res).assertEqual("hello world worker") expect(res).assertEqual("hello world worker")
done() done()
...@@ -133,7 +133,7 @@ describe('workerTest', function () { ...@@ -133,7 +133,7 @@ describe('workerTest', function () {
ss.postMessage("hello world") ss.postMessage("hello world")
while (!flag) { while (!flag) {
await PromiseCase() await promiseCase()
} }
expect(res).assertEqual("zhangsan") expect(res).assertEqual("zhangsan")
done() done()
...@@ -163,7 +163,7 @@ describe('workerTest', function () { ...@@ -163,7 +163,7 @@ describe('workerTest', function () {
ss.postMessage("hello world") ss.postMessage("hello world")
while (!flag) { while (!flag) {
await PromiseCase() await promiseCase()
} }
expect(res).assertEqual("Error: 123") expect(res).assertEqual("Error: 123")
done() done()
...@@ -181,7 +181,7 @@ describe('workerTest', function () { ...@@ -181,7 +181,7 @@ describe('workerTest', function () {
} }
ss.terminate() ss.terminate()
while (!flag) { while (!flag) {
await PromiseCase() await promiseCase()
} }
expect(res).assertEqual(1) expect(res).assertEqual(1)
done() done()
...@@ -203,7 +203,7 @@ describe('workerTest', function () { ...@@ -203,7 +203,7 @@ describe('workerTest', function () {
ss.terminate() ss.terminate()
while (!flag) { while (!flag) {
await PromiseCase() await promiseCase()
} }
expect(res).assertEqual(1) expect(res).assertEqual(1)
done() done()
...@@ -226,12 +226,12 @@ describe('workerTest', function () { ...@@ -226,12 +226,12 @@ describe('workerTest', function () {
ss.terminate() ss.terminate()
while (!flag) { while (!flag) {
await PromiseCase() await promiseCase()
} }
expect(res).assertEqual(1) expect(res).assertEqual(1)
ss.postMessage("hello world") ss.postMessage("hello world")
await PromiseCase() await promiseCase()
expect(res).assertEqual(1) expect(res).assertEqual(1)
done() done()
}) })
...@@ -508,7 +508,7 @@ describe('workerTest', function () { ...@@ -508,7 +508,7 @@ describe('workerTest', function () {
} }
ss.postMessage("abc") ss.postMessage("abc")
await PromiseCase() await promiseCase()
expect(res).assertEqual(0) expect(res).assertEqual(0)
done() done()
}) })
...@@ -525,11 +525,11 @@ describe('workerTest', function () { ...@@ -525,11 +525,11 @@ describe('workerTest', function () {
} }
ss1.postMessage("abc") ss1.postMessage("abc")
await PromiseCase() await promiseCase()
expect(res).assertEqual(0) expect(res).assertEqual(0)
ss2.postMessage("hello world") ss2.postMessage("hello world")
await PromiseCase() await promiseCase()
expect(res).assertEqual(0) expect(res).assertEqual(0)
done() done()
...@@ -547,7 +547,7 @@ describe('workerTest', function () { ...@@ -547,7 +547,7 @@ describe('workerTest', function () {
} }
ss1.postMessage("abc") ss1.postMessage("abc")
await PromiseCase() await promiseCase()
expect(res).assertEqual(0) expect(res).assertEqual(0)
ss2.addEventListener("zhangsan", ()=>{ ss2.addEventListener("zhangsan", ()=>{
...@@ -575,12 +575,54 @@ describe('workerTest', function () { ...@@ -575,12 +575,54 @@ describe('workerTest', function () {
ss.postMessage("abc") ss.postMessage("abc")
while (!flag) { while (!flag) {
await PromiseCase() await promiseCase()
} }
ss.postMessage("hello") ss.postMessage("hello")
await PromiseCase() await promiseCase()
expect(res).assertEqual(0) expect(res).assertEqual(0)
done() done()
}) })
// check onmessageerror is ok
it('worker_onmessageerror_test_001', 0, async function (done) {
var ss = new worker.Worker("workers/worker_008.js");
var res = 0
var flag = false;
ss.onexit = function () {
flag = true
}
ss.onmessageerror = function (e) {
res++;
}
ss.postMessage("abc")
while (!flag) {
await promiseCase()
}
expect(res).assertEqual(0)
done()
})
// check onmessageerror is ok
it('worker_onmessageerror_test_002', 0, async function (done) {
var ss = new worker.Worker("workers/worker_008.js");
var res = 0
var flag = false;
ss.onmessageerror = function (e) {
flag = true;
res++;
}
function foo() {
}
ss.postMessage(foo)
while (!flag) {
await promiseCase()
}
expect(res).assertEqual(1)
done()
})
}) })
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册