forked from mgz0227/legado-Harmony
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
629 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/node_modules | ||
/oh_modules | ||
/local.properties | ||
/.idea | ||
**/build | ||
/.hvigor | ||
.cxx | ||
/.clangd | ||
/.clang-format | ||
/.clang-tidy | ||
**/.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"app": { | ||
"bundleName": "io.legado.app", | ||
"vendor": "example", | ||
"versionCode": 1000000, | ||
"versionName": "1.0.0", | ||
"icon": "$media:app_icon", | ||
"label": "$string:app_name" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"string": [ | ||
{ | ||
"name": "app_name", | ||
"value": "Legado" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"app": { | ||
"signingConfigs": [], | ||
"compileSdkVersion": 9, | ||
"compatibleSdkVersion": 9, | ||
"products": [ | ||
{ | ||
"name": "default", | ||
"signingConfig": "default", | ||
} | ||
] | ||
}, | ||
"modules": [ | ||
{ | ||
"name": "entry", | ||
"srcPath": "./entry", | ||
"targets": [ | ||
{ | ||
"name": "default", | ||
"applyToProducts": [ | ||
"default" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/node_modules | ||
/oh_modules | ||
/.preview | ||
/build | ||
/.cxx | ||
/.test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"apiType": 'stageMode', | ||
"buildOption": { | ||
}, | ||
"targets": [ | ||
{ | ||
"name": "default", | ||
"runtimeOS": "HarmonyOS" | ||
}, | ||
{ | ||
"name": "ohosTest", | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently. | ||
export { hapTasks } from '@ohos/hvigor-ohos-plugin'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "entry", | ||
"version": "1.0.0", | ||
"description": "Please describe the basic information.", | ||
"main": "", | ||
"author": "", | ||
"license": "", | ||
"dependencies": {} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import UIAbility from '@ohos.app.ability.UIAbility'; | ||
import hilog from '@ohos.hilog'; | ||
import window from '@ohos.window'; | ||
|
||
export default class EntryAbility extends UIAbility { | ||
onCreate(want, launchParam) { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); | ||
} | ||
|
||
onDestroy() { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); | ||
} | ||
|
||
onWindowStageCreate(windowStage: window.WindowStage) { | ||
// Main window is created, set main page for this ability | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); | ||
|
||
windowStage.loadContent('pages/Index', (err, data) => { | ||
if (err.code) { | ||
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); | ||
return; | ||
} | ||
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); | ||
}); | ||
} | ||
|
||
onWindowStageDestroy() { | ||
// Main window is destroyed, release UI related resources | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); | ||
} | ||
|
||
onForeground() { | ||
// Ability has brought to foreground | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); | ||
} | ||
|
||
onBackground() { | ||
// Ability has back to background | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@Entry | ||
@Component | ||
struct Index { | ||
@State message: string = 'Hello World' | ||
|
||
build() { | ||
Row() { | ||
Column() { | ||
Text(this.message) | ||
.fontSize(50) | ||
.fontWeight(FontWeight.Bold) | ||
} | ||
.width('100%') | ||
} | ||
.height('100%') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"module": { | ||
"name": "entry", | ||
"type": "entry", | ||
"description": "$string:module_desc", | ||
"mainElement": "EntryAbility", | ||
"deviceTypes": [ | ||
"phone", | ||
"tablet" | ||
], | ||
"deliveryWithInstall": true, | ||
"installationFree": false, | ||
"pages": "$profile:main_pages", | ||
"abilities": [ | ||
{ | ||
"name": "EntryAbility", | ||
"srcEntry": "./ets/entryability/EntryAbility.ts", | ||
"description": "$string:EntryAbility_desc", | ||
"icon": "$media:icon", | ||
"label": "$string:EntryAbility_label", | ||
"startWindowIcon": "$media:icon", | ||
"startWindowBackground": "$color:start_window_background", | ||
"exported": true, | ||
"skills": [ | ||
{ | ||
"entities": [ | ||
"entity.system.home" | ||
], | ||
"actions": [ | ||
"action.system.home" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"color": [ | ||
{ | ||
"name": "start_window_background", | ||
"value": "#FFFFFF" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"string": [ | ||
{ | ||
"name": "module_desc", | ||
"value": "module description" | ||
}, | ||
{ | ||
"name": "EntryAbility_desc", | ||
"value": "description" | ||
}, | ||
{ | ||
"name": "EntryAbility_label", | ||
"value": "label" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"src": [ | ||
"pages/Index" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"string": [ | ||
{ | ||
"name": "module_desc", | ||
"value": "module description" | ||
}, | ||
{ | ||
"name": "EntryAbility_desc", | ||
"value": "description" | ||
}, | ||
{ | ||
"name": "EntryAbility_label", | ||
"value": "label" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"string": [ | ||
{ | ||
"name": "module_desc", | ||
"value": "模块描述" | ||
}, | ||
{ | ||
"name": "EntryAbility_desc", | ||
"value": "description" | ||
}, | ||
{ | ||
"name": "EntryAbility_label", | ||
"value": "label" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import hilog from '@ohos.hilog'; | ||
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' | ||
|
||
export default function abilityTest() { | ||
describe('ActsAbilityTest', function () { | ||
// Defines a test suite. Two parameters are supported: test suite name and test suite function. | ||
beforeAll(function () { | ||
// Presets an action, which is performed only once before all test cases of the test suite start. | ||
// This API supports only one parameter: preset action function. | ||
}) | ||
beforeEach(function () { | ||
// Presets an action, which is performed before each unit test case starts. | ||
// The number of execution times is the same as the number of test cases defined by **it**. | ||
// This API supports only one parameter: preset action function. | ||
}) | ||
afterEach(function () { | ||
// Presets a clear action, which is performed after each unit test case ends. | ||
// The number of execution times is the same as the number of test cases defined by **it**. | ||
// This API supports only one parameter: clear action function. | ||
}) | ||
afterAll(function () { | ||
// Presets a clear action, which is performed after all test cases of the test suite end. | ||
// This API supports only one parameter: clear action function. | ||
}) | ||
it('assertContain',0, function () { | ||
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function. | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'it begin'); | ||
let a = 'abc' | ||
let b = 'b' | ||
// Defines a variety of assertion methods, which are used to declare expected boolean conditions. | ||
expect(a).assertContain(b) | ||
expect(a).assertEqual(a) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import abilityTest from './Ability.test' | ||
|
||
export default function testsuite() { | ||
abilityTest() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import UIAbility from '@ohos.app.ability.UIAbility'; | ||
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; | ||
import hilog from '@ohos.hilog'; | ||
import { Hypium } from '@ohos/hypium'; | ||
import testsuite from '../test/List.test'; | ||
import window from '@ohos.window'; | ||
|
||
export default class TestAbility extends UIAbility { | ||
onCreate(want, launchParam) { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); | ||
var abilityDelegator: any | ||
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() | ||
var abilityDelegatorArguments: any | ||
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); | ||
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) | ||
} | ||
|
||
onDestroy() { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); | ||
} | ||
|
||
onWindowStageCreate(windowStage: window.WindowStage) { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); | ||
windowStage.loadContent('testability/pages/Index', (err, data) => { | ||
if (err.code) { | ||
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); | ||
return; | ||
} | ||
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', | ||
JSON.stringify(data) ?? ''); | ||
}); | ||
} | ||
|
||
onWindowStageDestroy() { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); | ||
} | ||
|
||
onForeground() { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); | ||
} | ||
|
||
onBackground() { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import hilog from '@ohos.hilog'; | ||
|
||
@Entry | ||
@Component | ||
struct Index { | ||
aboutToAppear() { | ||
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); | ||
} | ||
@State message: string = 'Hello World' | ||
build() { | ||
Row() { | ||
Column() { | ||
Text(this.message) | ||
.fontSize(50) | ||
.fontWeight(FontWeight.Bold) | ||
Button() { | ||
Text('next page') | ||
.fontSize(20) | ||
.fontWeight(FontWeight.Bold) | ||
}.type(ButtonType.Capsule) | ||
.margin({ | ||
top: 20 | ||
}) | ||
.backgroundColor('#0D9FFB') | ||
.width('35%') | ||
.height('5%') | ||
.onClick(()=>{ | ||
}) | ||
} | ||
.width('100%') | ||
} | ||
.height('100%') | ||
} | ||
} |
Oops, something went wrong.