未验证 提交 821b3f11 编写于 作者: O openharmony_ci 提交者: Gitee

!9740 Standardize ArkTs files of xts testcase

Merge pull request !9740 from huyunhui/master
......@@ -18,16 +18,15 @@ import hilog from '@ohos.hilog';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
import window from '@ohos.window';
import { BusinessError } from '@ohos.base';
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()
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
......@@ -38,7 +37,7 @@ export default class TestAbility extends UIAbility {
onWindowStageCreate(windowStage: window.WindowStage) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('TestAbility/pages/Index', (err, data) => {
windowStage.loadContent('TestAbility/pages/Index', (err: BusinessError<void>, data: void) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
......
......@@ -32,9 +32,6 @@ struct Index {
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
......
/**
* Copyright (c) 2023 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, it, expect} from "@ohos/hypium"
export default function dynamicImport() {
describe("DynamicImportTest", async function () {
it('importHar', 0, async function () {
let lib = await import('har')
expect(lib.add(2, 3)).assertEqual(5)
})
it('importRelative', 0, async function () {
let lib = await import('./test')
expect(lib.add(2, 3)).assertEqual(5)
expect(lib.default).assertEqual('test')
})
it('importOhpm', 0, async function () {
let lib = await import('leap-year')
expect(lib.default(2000)).assertEqual(true)
})
it('importSystemInternal', 0, async function () {
let lib = await import('@ohos.hilog')
lib.default.info(0x0000, "testTag", 'dexter log: call ohos.hilog')
})
it('importSystemBuiltin', 0, async function () {
let lib = await import('@system.app')
lib.default.getInfo()
})
it('importAppNapi', 0, async function () {
let lib = await import('libentry.so')
expect(lib.default.add(2,3)).assertEqual(5)
})
})
}
......@@ -12,13 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import dynamicImport from './DynamicImport'
import staticImport from './StaticImport'
import workerImport from "./WorkerImport"
import pageImport from './PageImport'
export default function testsuite() {
dynamicImport()
staticImport()
workerImport()
pageImport()
......
......@@ -17,8 +17,8 @@ import {describe, it} from "@ohos/hypium"
import {Sleep} from './Util'
export default function pageImport() {
describe("PageImportTest", function () {
it('pageImportHar', 0, async function (){
describe("PageImportTest", () => {
it('pageImportHar', 0, async () => {
await Sleep(1000)
router.clear()
await router.pushUrl({url: "pages/PageImportHar"})
......@@ -26,7 +26,7 @@ export default function pageImport() {
router.back()
await Sleep(1000)
})
it('pageImportOhpm', 0, async function (){
it('pageImportOhpm', 0, async () => {
await Sleep(1000)
router.clear()
await router.pushUrl({url: "pages/PageImportOhpm"})
......@@ -34,7 +34,7 @@ export default function pageImport() {
router.back()
await Sleep(1000)
})
it('pageImportRelative', 0, async function (){
it('pageImportRelative', 0, async () => {
await Sleep(1000)
router.clear()
await router.pushUrl({url: "pages/PageImportRelative"})
......@@ -42,7 +42,7 @@ export default function pageImport() {
router.back()
await Sleep(1000)
})
it('pageImportAppNapi', 0, async function (){
it('pageImportAppNapi', 0, async () => {
await Sleep(1000)
router.clear()
await router.pushUrl({url: "pages/PageImportNapi"})
......@@ -50,7 +50,7 @@ export default function pageImport() {
router.back()
await Sleep(1000)
})
it('pageImportSystemNapi', 0, async function (){
it('pageImportSystemNapi', 0, async () => {
await Sleep(1000)
router.clear()
await router.pushUrl({url: "pages/PageImportSystem"})
......
......@@ -22,26 +22,26 @@ import app from "@system.app"
import testNapi from "libentry.so"
export default function staticImport() {
describe("StaticImportTest", function () {
it('importHar', 0, function () {
describe("StaticImportTest", () => {
it('importHar', 0, () => {
expect(add1(2, 3)).assertEqual(5)
})
it('importRelative', 0, function () {
it('importRelative', 0, () => {
expect(add2(2, 3)).assertEqual(5)
})
it('importOhpm', 0, function () {
it('importOhpm', 0, () => {
expect(isLeapYear1(2000)).assertEqual(true)
})
it('importSystemInternal', 0, function () {
it('importSystemInternal', 0, () => {
hilog.info(0x0000, "testTag", 'dexter log: call ohos.hilog')
})
it('importSystemBuiltin', 0, function () {
it('importSystemBuiltin', 0, () => {
app.getInfo()
})
it("harImportOhpm", 0, function () {
it("harImportOhpm", 0, () => {
expect(ohpmRes).assertEqual(true)
})
it("importAppNapi", 0, function() {
it("importAppNapi", 0,() => {
expect(testNapi.add(2, 3)).assertEqual(5)
})
})
......
......@@ -12,6 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export const Sleep = (ms)=> {
export const Sleep = (ms: number | undefined)=> {
return new Promise(resolve=>setTimeout(resolve, ms))
}
\ No newline at end of file
......@@ -17,52 +17,52 @@ import { describe, it, expect } from "@ohos/hypium"
import {Sleep} from './Util'
export default function workerImport() {
describe("WorkerImportTest", function () {
it('importHar', 0, async function () {
describe("WorkerImportTest", () => {
it('importHar', 0, async () => {
let workerImportHar = 'failed'
let threadWorker = new worker.ThreadWorker('entry/ets/workers/workerImportHar')
threadWorker.postMessage("ModuleTest host to worker")
threadWorker.onmessage = function () {
threadWorker.onmessage = () => {
workerImportHar = 'success';
}
await Sleep(2000)
expect(workerImportHar).assertEqual('success')
})
it('importOhpm', 0, async function () {
it('importOhpm', 0, async () => {
let workerImportOhpm = 'failed'
let threadWorker = new worker.ThreadWorker('entry/ets/workers/workerImportOhpm')
threadWorker.postMessage("ModuleTest host to worker")
threadWorker.onmessage = function () {
threadWorker.onmessage = () => {
workerImportOhpm = 'success';
}
await Sleep(2000)
expect(workerImportOhpm).assertEqual('success')
})
it('importRelative', 0, async function () {
it('importRelative', 0, async () => {
let workerImportRelative = 'failed'
let threadWorker = new worker.ThreadWorker('entry/ets/workers/workerImportRelative')
threadWorker.postMessage("ModuleTest host to worker")
threadWorker.onmessage = function () {
threadWorker.onmessage = () => {
workerImportRelative = 'success';
}
await Sleep(2000)
expect(workerImportRelative).assertEqual('success')
})
it('importSystemNapi', 0, async function () {
it('importSystemNapi', 0, async () => {
let workerImportSystem = 'failed'
let threadWorker = new worker.ThreadWorker('entry/ets/workers/workerImportSystem')
threadWorker.postMessage("ModuleTest host to worker")
threadWorker.onmessage = function () {
threadWorker.onmessage = () => {
workerImportSystem = 'success';
}
await Sleep(2000)
expect(workerImportSystem).assertEqual('success')
})
it('importAppNapi', 0, async function () {
it('importAppNapi', 0, async () => {
let workerImportNapi = 'failed'
let threadWorker = new worker.ThreadWorker('entry/ets/workers/workerImportNapi')
threadWorker.postMessage("ModuleTest host to worker")
threadWorker.onmessage = function () {
threadWorker.onmessage = () => {
workerImportNapi = 'success';
}
await Sleep(2000)
......
......@@ -16,7 +16,7 @@ import {ohpmRes} from 'har';
import worker from '@ohos.worker';
let workerPort = worker.workerPort;
workerPort.onmessage = function(): void {
workerPort.onmessage = () => {
if (ohpmRes) {
workerPort.postMessage('ModuleTest receive data from main thread');
}
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export var A = "I am har1";
export let A = "I am har1";
export { MainPage } from './src/main/ets/components/mainpage/MainPage';
export {ohpmRes} from './src/main/ets/ohpm';
function add(a: number, b: number) {
......
/**
* Copyright (c) 2023 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.
*/
{
"lockfileVersion": 1,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6",
"leap-year@^4.0.0": "leap-year@4.0.0",
"leap-year@4.0.0": "leap-year@4.0.0"
},
"packages": {
"@ohos/hypium@1.0.6": {
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
},
"leap-year@4.0.0": {
"resolved": "https://repo.harmonyos.com/ohpm/leap-year/-/leap-year-4.0.0.tgz",
"integrity": "sha512-+GveCBnhFmRjFf04Nj/2Z/w5lNC4bRXpecIRz5QkK+LnWBwuf9jAaNEfbybrU+e2ls8J6p+FZMjiq1aEh+gPAw=="
}
}
}
\ No newline at end of file
......@@ -18,16 +18,15 @@ import hilog from '@ohos.hilog';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
import window from '@ohos.window';
import { BusinessError } from '@ohos.base';
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()
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
let abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
......@@ -38,7 +37,7 @@ export default class TestAbility extends UIAbility {
onWindowStageCreate(windowStage: window.WindowStage) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
windowStage.loadContent('TestAbility/pages/Index', (err, data) => {
windowStage.loadContent('TestAbility/pages/Index', (err: BusinessError<void>, data: void) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
......
......@@ -32,9 +32,6 @@ struct Index {
.fontSize(20)
.fontWeight(FontWeight.Bold)
}.type(ButtonType.Capsule)
.margin({
top: 20
})
.backgroundColor('#0D9FFB')
.width('35%')
.height('5%')
......
......@@ -22,26 +22,26 @@ import app from "@system.app"
import testNapi from "libentry.so"
export default function staticImport() {
describe("StaticImportTest", function () {
it('importHar', 0, function () {
describe("StaticImportTest", () => {
it('importHar', 0, () => {
expect(add1(2, 3)).assertEqual(5)
})
it('importRelative', 0, function () {
it('importRelative', 0, () => {
expect(add2(2, 3)).assertEqual(5)
})
it('importOhpm', 0, function () {
it('importOhpm', 0, () => {
expect(isLeapYear1(2000)).assertEqual(true)
})
it('importSystemInternal', 0, function () {
it('importSystemInternal', 0, () => {
hilog.info(0x0000, "testTag", 'dexter log: call ohos.hilog')
})
it('importSystemBuiltin', 0, function () {
it('importSystemBuiltin', 0, () => {
app.getInfo()
})
it("harImportOhpm", 0, function () {
it("harImportOhpm", 0, () => {
expect(ohpmRes).assertEqual(true)
})
it("ImportAppNapi", 0, function () {
it("ImportAppNapi", 0, () => {
expect(testNapi.add(2, 3)).assertEqual(5)
})
})
......
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export var A = "I am har1";
export let A = "I am har1";
export { MainPage } from './src/main/ets/components/mainpage/MainPage';
export {ohpmRes} from './src/main/ets/ohpm';
function add(a: number, b: number) {
......
/**
* Copyright (c) 2023 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.
*/
{
"lockfileVersion": 1,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6",
"leap-year@^4.0.0": "leap-year@4.0.0",
"leap-year@4.0.0": "leap-year@4.0.0"
},
"packages": {
"@ohos/hypium@1.0.6": {
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
},
"leap-year@4.0.0": {
"resolved": "https://repo.harmonyos.com/ohpm/leap-year/-/leap-year-4.0.0.tgz",
"integrity": "sha512-+GveCBnhFmRjFf04Nj/2Z/w5lNC4bRXpecIRz5QkK+LnWBwuf9jAaNEfbybrU+e2ls8J6p+FZMjiq1aEh+gPAw=="
}
}
}
\ No newline at end of file
{
"description": "Configuration for esmodule_ohostest_hap Tests",
"driver": {
"type": "OHJSUnitTest",
"test-timeout": "1800000",
"bundle-name": "com.esmodule.acts",
"module-name": "entry_test",
"shell-timeout": "180000"
},
"kits": [
{
"test-file-name": [
"ActsEsmoduleOhostestLib.hap",
"ActsEsmoduleOhostestTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
/**
* Copyright (c) 2023 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.
*/
{
"lockfileVersion": 1,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6"
},
"packages": {
"@ohos/hypium@1.0.6": {
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册