1
0
This commit is contained in:
2021-11-18 10:22:47 +08:00
parent 9b000db778
commit 3f2060c8b2
109 changed files with 1047 additions and 714 deletions

2
MyApplication2/entry/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
/build
/node_modules

View File

@@ -0,0 +1,26 @@
apply plugin: 'com.huawei.ohos.hap'
apply plugin: 'com.huawei.ohos.decctest'
//For instructions on signature configuration, see https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_debug_device-0000001053822404#section1112183053510
ohos {
compileSdkVersion 7
defaultConfig {
compatibleSdkVersion 7
}
buildTypes {
release {
proguardOpt {
proguardEnabled false
rulesFiles 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
testImplementation 'junit:junit:4.13.1'
ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.200'
}
decc {
supportType = ['html','xml']
}

View File

@@ -0,0 +1 @@
# config module specific ProGuard rules here.

View File

@@ -0,0 +1,64 @@
{
"app": {
"bundleName": "com.xclexample.myapplication",
"vendor": "xclexample",
"version": {
"code": 1000000,
"name": "1.0.0"
}
},
"deviceConfig": {},
"module": {
"package": "com.xclexample.myapplication",
"name": ".MyApplication",
"mainAbility": "com.xclexample.myapplication.MainAbility",
"deviceType": [
"phone",
"tablet",
"car"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"visible": true,
"name": "com.xclexample.myapplication.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index"
],
"name": "default",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}

View File

@@ -0,0 +1,8 @@
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}

View File

@@ -0,0 +1,13 @@
@Entry
@Component
struct Index {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}

View File

@@ -0,0 +1,16 @@
package com.xclexample.myapplication;
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();
}
}

View File

@@ -0,0 +1,10 @@
package com.xclexample.myapplication;
import ohos.aafwk.ability.AbilityPackage;
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}

View File

@@ -0,0 +1,12 @@
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "mainability_description",
"value": "ETS_Empty Ability"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -0,0 +1,11 @@
export default {
onCreate() {
console.info('Application onCreate')
},
onShow() {
console.info('Application onShow')
},
onDestroy() {
console.info('Application onDestroy')
},
}

View File

@@ -0,0 +1,8 @@
{
"strings": {
"hello": "Hello",
"world": "World"
},
"Files": {
}
}

View File

@@ -0,0 +1,8 @@
{
"strings": {
"hello": "您好",
"world": "世界"
},
"Files": {
}
}

View File

@@ -0,0 +1,51 @@
import {Core, ExpectExtend, InstrumentLog} from "deccjsunit/index"
import testsuite from "../../../test/List.test.ets"
import app from '@system.app'
import featureAbility from "@ohos.ability.featureAbility"
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance()
const instrumentLog = new InstrumentLog({
'id': 'report', 'unity': 'true'
})
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
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(Want.parameters)
testsuite()
core.execute()
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('Hello World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}

View File

@@ -0,0 +1,12 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import app from '@system.app'
export default function exampleJsunit() {
describe('appInfoTest', function () {
it('app_info_test_001', 0, function () {
var info = app.getInfo()
expect("1.0").assertEqual('1.0')
expect(info.versionCode).assertEqual('3')
})
})
}

View File

@@ -0,0 +1,5 @@
import exampleJsunit from "../test/ExampleJsunit.test.ets"
export default function testsuite() {
exampleJsunit()
}

View File

@@ -0,0 +1,14 @@
package com.xclexample.myapplication;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class ExampleOhosTest {
@Test
public void testBundleName() {
final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
assertEquals("com.xclexample.myapplication", actualBundleName);
}
}

View File

@@ -0,0 +1,12 @@
{
"string": [
{
"name": "app_name",
"value": "MyApplication"
},
{
"name": "mainability_description",
"value": "hap sample empty page"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB