2048-f
This commit is contained in:
2
MyApplication2/entry/.gitignore
vendored
Normal file
2
MyApplication2/entry/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/build
|
||||
/node_modules
|
26
MyApplication2/entry/build.gradle
Normal file
26
MyApplication2/entry/build.gradle
Normal 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']
|
||||
}
|
1
MyApplication2/entry/proguard-rules.pro
vendored
Normal file
1
MyApplication2/entry/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# config module specific ProGuard rules here.
|
64
MyApplication2/entry/src/main/config.json
Normal file
64
MyApplication2/entry/src/main/config.json
Normal 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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
8
MyApplication2/entry/src/main/ets/default/app.ets
Normal file
8
MyApplication2/entry/src/main/ets/default/app.ets
Normal file
@@ -0,0 +1,8 @@
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('Application onCreate')
|
||||
},
|
||||
onDestroy() {
|
||||
console.info('Application onDestroy')
|
||||
},
|
||||
}
|
13
MyApplication2/entry/src/main/ets/default/pages/index.ets
Normal file
13
MyApplication2/entry/src/main/ets/default/pages/index.ets
Normal 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%')
|
||||
}
|
||||
}
|
@@ -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();
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.xclexample.myapplication;
|
||||
|
||||
import ohos.aafwk.ability.AbilityPackage;
|
||||
|
||||
public class MyApplication extends AbilityPackage {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
super.onInitialize();
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "entry_MainAbility",
|
||||
"value": "entry_MainAbility"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "ETS_Empty Ability"
|
||||
}
|
||||
]
|
||||
}
|
BIN
MyApplication2/entry/src/main/resources/base/media/icon.png
Normal file
BIN
MyApplication2/entry/src/main/resources/base/media/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
BIN
MyApplication2/entry/src/main/resources/base/media/icon1.png
Normal file
BIN
MyApplication2/entry/src/main/resources/base/media/icon1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
BIN
MyApplication2/entry/src/main/resources/base/media/icon2.png
Normal file
BIN
MyApplication2/entry/src/main/resources/base/media/icon2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
11
MyApplication2/entry/src/ohosTest/ets/default/app.ets
Normal file
11
MyApplication2/entry/src/ohosTest/ets/default/app.ets
Normal file
@@ -0,0 +1,11 @@
|
||||
export default {
|
||||
onCreate() {
|
||||
console.info('Application onCreate')
|
||||
},
|
||||
onShow() {
|
||||
console.info('Application onShow')
|
||||
},
|
||||
onDestroy() {
|
||||
console.info('Application onDestroy')
|
||||
},
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"strings": {
|
||||
"hello": "Hello",
|
||||
"world": "World"
|
||||
},
|
||||
"Files": {
|
||||
}
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"strings": {
|
||||
"hello": "您好",
|
||||
"world": "世界"
|
||||
},
|
||||
"Files": {
|
||||
}
|
||||
}
|
@@ -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%')
|
||||
}
|
||||
}
|
||||
|
@@ -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')
|
||||
})
|
||||
})
|
||||
}
|
5
MyApplication2/entry/src/ohosTest/ets/test/List.test.ets
Normal file
5
MyApplication2/entry/src/ohosTest/ets/test/List.test.ets
Normal file
@@ -0,0 +1,5 @@
|
||||
import exampleJsunit from "../test/ExampleJsunit.test.ets"
|
||||
|
||||
export default function testsuite() {
|
||||
exampleJsunit()
|
||||
}
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "MyApplication"
|
||||
},
|
||||
{
|
||||
"name": "mainability_description",
|
||||
"value": "hap sample empty page"
|
||||
}
|
||||
]
|
||||
}
|
BIN
MyApplication2/entry/src/ohosTest/resources/base/media/icon.png
Normal file
BIN
MyApplication2/entry/src/ohosTest/resources/base/media/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
Reference in New Issue
Block a user