提交 325b6de9 编写于 作者: F FondMemoryVVV

Merge branch 'master' of gitee.com:openharmony/xts_acts

......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack ACTS_DoAbilityForeground_0100_Event====>");
setTimeout(()=>{
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack ACTS_DoAbilityForeground_0300_Event====>");
globalThis.abilityContext.terminateSelf().then(()=>{
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack Event====>");
}
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack Event====>");
}
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from "@ohos.commonevent"
import commonEvent from "@ohos.commonEvent"
function PublishCallBackOne() {
console.debug("====>Publish CallBack AACommand_Debugapp====>");
console.debug("====>close this context====>====>");
......
......@@ -15,7 +15,7 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import commonEvent from "@ohos.commonevent"
import commonEvent from "@ohos.commonEvent"
var subscriberInfo_startdebugapp = {
events: ["AACommand_Debugapp"],
......
......@@ -14,7 +14,7 @@
*/
import Ability from '@ohos.application.Ability'
import commonEvent from "@ohos.commonevent"
import commonEvent from "@ohos.commonEvent"
function PublishCallBackOne() {
console.debug("====>Publish CallBack AACommand_Debugapp====>");
console.debug("====>close this context====>====>");
......
......@@ -15,7 +15,7 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import commonEvent from "@ohos.commonevent"
import commonEvent from "@ohos.commonEvent"
var subscriberInfo_startdebugapp = {
events: ["AACommand_Debugapp"],
......
......@@ -14,7 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import appManager from '@ohos.application.AppManager';
import appManager from '@ohos.application.appManager';
const DELAY = 3000
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
export default function abilityTest() {
......
......@@ -14,7 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import appManager from '@ohos.application.AppManager';
import appManager from '@ohos.application.appManager';
const DELAY = 3000
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
export default function abilityTest() {
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBack() {
console.debug("====>Publish CallBack ====>");
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack ACTS_Start_CommonEvent====>");
console.debug("====>close this context====>3====>");
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack ACTS_Start_CommonEvent====>");
console.debug("====>close this context====>4====>");
......
......@@ -14,7 +14,7 @@
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
var subscriberInfo_MainAbility = {
events: ["ACTS_StartAbility_CommonEvent"]
};
......
......@@ -14,7 +14,7 @@
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne2() {
console.debug("====>Publish CallBack ACTS_StartAbility2_CommonEvent====>");
globalThis.ability2Context.terminateSelf();
......
......@@ -14,7 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
const START_ABILITY_TIMEOUT = 5000;
var GetAppContext1 = {
......
......@@ -14,7 +14,7 @@
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne2() {
console.debug("====>Publish CallBack ACTS_StartAbility2_CommonEvent====>");
globalThis.ability2Context.terminateSelf();
......
......@@ -14,7 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
const START_ABILITY_TIMEOUT = 5000;
var GetAppContext1 = {
......
......@@ -14,7 +14,7 @@
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne2() {
console.debug("====>Publish CallBack ACTS_StartAbility2_CommonEvent====>");
globalThis.ability2Context.terminateSelf();
......
......@@ -14,7 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
const START_ABILITY_TIMEOUT = 5000;
var GetAppContext1 = {
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack GetCurrentTopAbility2====>");
console.debug("====>close this context====>3====>");
......
......@@ -16,7 +16,7 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import abilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import commonEvent from "@ohos.commonevent"
import commonEvent from "@ohos.commonEvent"
var subscriberInfo_MainAbility2 = {
events: ["GetCurrentTopAbilityB"],
......
......@@ -13,7 +13,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function publishCallBackOne() {
console.debug("====>Publish CallBack GetCurrentTopAbility");
}
......
......@@ -15,7 +15,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import abilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import commonEvent from "@ohos.commonevent"
import commonEvent from "@ohos.commonEvent"
var subscriberInfo_MainAbility2 = {
events: ["GetCurrentTopAbility"],
......
......@@ -14,7 +14,7 @@
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index'
import appManager from '@ohos.application.AppManager';
import appManager from '@ohos.application.appManager';
export default function abilityTest() {
describe('ACTS_ExecuteShellCommandTest', function () {
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack ACTS_Start_CommonEvent====>");
console.debug("====>close this context====>3====>");
......
......@@ -14,7 +14,7 @@
* limitations under the License.
*/
import Ability from '@ohos.application.Ability'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
function PublishCallBackOne() {
console.debug("====>Publish CallBack ACTS_Start_CommonEvent====>");
console.debug("====>close this context====>4====>");
......
......@@ -14,7 +14,7 @@
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import commonEvent from '@ohos.commonevent'
import commonEvent from '@ohos.commonEvent'
var subscriberInfo_MainAbility = {
events: ["ACTS_Start_CommonEvent"]
};
......
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "180000",
"package": "com.example.accessibilityconfig",
"shell-timeout": "180000"
"type": "OHJSUnitTest",
"test-timeout": "240000",
"bundle-name": "com.example.accessibilityconfig",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 70000
},
"kits": [
{
......
/*
* Copyright (c) 2022 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 Ability from '@ohos.application.Ability'
export default class MainAbility extends Ability {
......@@ -18,7 +32,7 @@ export default class MainAbility extends Ability {
//globalThis.windowStage = windowStage
//globalThis.abilityStorage = this.storage
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null)
windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
}
onWindowStageDestroy() {
......
/*
* Copyright (c) 2022 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 router from '@ohos.router';
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
aboutToAppear(){
console.info("start run testcase!!!!");
}
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 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 Ability from '@ohos.application.Ability'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate')
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
console.log('TestAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'TestAbility/pages/index', null)
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
console.log('TestAbility onWindowStageDestroy')
}
onForeground() {
console.log('TestAbility onForeground')
}
onBackground() {
console.log('TestAbility onBackground')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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 router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('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%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 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 TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ")
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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 {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import testsuite from "../../test/List.test"
@Entry
@Component
struct Index {
@State message: string = 'Hello World';
aboutToAppear(){
console.info("start run testcase!!!!");
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters));
globalThis.abilityWant.parameters.timeout = 70000;
configService.setConfig(globalThis.abilityWant.parameters);
testsuite(globalThis.abilityContext);
core.execute();
}
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
......@@ -12,10 +12,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
import config from '@ohos.accessibility.config'
export default function abilityTest(abilityContext) {
export default function abilityTest() {
describe('AccessibilityConfigTest', function () {
beforeEach(async function (done) {
......
......@@ -14,6 +14,6 @@
*/
import abilityTest from './AccessibilityConfig.test.ets'
export default function testsuite(abilityContext) {
abilityTest(abilityContext)
export default function testsuite() {
abilityTest()
}
\ No newline at end of file
......@@ -13,8 +13,8 @@
"uiSyntax": "ets",
"pages": "$profile:main_pages",
"abilities": [{
"name": "com.example.accessibilityconfig.MainAbility",
"srcEntrance": "./ets/MainAbility/MainAbility.ts",
"name": "TestAbility",
"srcEntrance": "./ets/TestAbility/TestAbility.ts",
"description": "$string:phone_entry_main",
"icon": "$media:icon",
"label": "$string:entry_label",
......
{
"src": [
"pages/index/index"
"TestAbility/pages/index"
]
}
\ No newline at end of file
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"type": "OHJSUnitTest",
"test-timeout": "180000",
"package": "ohos.acts.bundle.stage.test",
"shell-timeout": "600000"
"bundle-name": "ohos.acts.bundle.stage.test",
"module-name": "phone",
"shell-timeout": "600000",
"testcase-timeout": 70000
},
"kits": [
{
......
......@@ -16,7 +16,7 @@ export default class MainAbility extends Ability {
// Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate")
globalThis.abilityContext = this.context
windowStage.setUIContent(this.context, "pages/index/index", null)
windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
}
onWindowStageDestroy() {
......
......@@ -12,10 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import router from '@ohos.router';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"
import testsuite from "../../test/List.test.ets"
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
@Entry
......@@ -24,22 +25,12 @@ struct Index {
aboutToAppear(){
console.info("start run testcase!!!!")
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
const reportExtend = new ReportExtend(file)
core.addService('report', reportExtend)
core.init()
core.subscribeEvent('task', reportExtend)
const configService = core.getDefaultService('config')
console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters))
globalThis.abilityWant.parameters.timeout = 70000;
configService.setConfig(globalThis.abilityWant.parameters)
testsuite(globalThis.abilityContext)
core.execute()
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
build() {
......
import Ability from '@ohos.application.Ability'
export default class TestAbility extends Ability {
onCreate(want, launchParam) {
console.log('TestAbility onCreate')
}
onDestroy() {
console.log('TestAbility onDestroy')
}
onWindowStageCreate(windowStage) {
console.log('TestAbility onWindowStageCreate')
windowStage.setUIContent(this.context, 'TestAbility/pages/index', null)
globalThis.abilityContext = this.context;
}
onWindowStageDestroy() {
console.log('TestAbility onWindowStageDestroy')
}
onForeground() {
console.log('TestAbility onForeground')
}
onBackground() {
console.log('TestAbility onBackground')
}
};
\ No newline at end of file
/*
* Copyright (c) 2022 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 router from '@ohos.router';
@Entry
@Component
struct Index {
aboutToAppear() {
console.info('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%')
}
}
\ No newline at end of file
import TestRunner from '@ohos.application.testRunner'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s it',
'-s level', '-s testType', '-s size', '-s timeout'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams = `${targetParams} ${key} ${parameters[key]}`
}
}
return targetParams.trim()
}
async function onAbilityCreateCallback() {
console.log("onAbilityCreateCallback");
}
async function addAbilityMonitorCallback(err: any) {
console.info("addAbilityMonitorCallback : " + JSON.stringify(err))
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
console.info("OpenHarmonyTestRunner OnPrepare ")
}
async onRun() {
console.log('OpenHarmonyTestRunner onRun run')
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a ohos.acts.bundle.stage.test.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters)
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + d.stdResult);
console.info('executeShellCommand : data : ' + d.exitCode);
})
console.info('OpenHarmonyTestRunner onRun end')
}
};
\ No newline at end of file
......@@ -14,7 +14,7 @@
*/
import bundle from '@ohos.bundle';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
const MODULE_NAME = "phone"
const MODULE_NAME_TEST = "phone1"
......@@ -26,7 +26,7 @@ const METADATA_NAME1 = "ohos.ability.form1"
const METADATA_NAME2 = "ohos.ability.form2"
const METADATA_NAME3 = "ohos.ability.form3"
const METADATA_NAME_TEST = "ohos.test.form"
const PROFILE_JSON_STRING = "{\"src\":[\"pages/index/index\",\"pages/second/second\"]}"
const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainAbility/pages/second/second\"]}"
export default function getProfileByAbility() {
describe('getProfileByAbility', function () {
......
......@@ -14,7 +14,7 @@
*/
import bundle from '@ohos.bundle';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index"
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
const MODULE_NAME = "phone"
const MODULE_NAME_TEST = "phone1"
......@@ -26,7 +26,7 @@ const METADATA_NAME1 = "ohos.extension.form1"
const METADATA_NAME2 = "ohos.extension.form2"
const METADATA_NAME3 = "ohos.extension.form3"
const METADATA_NAME_TEST = "ohos.test.form"
const PROFILE_JSON_STRING = "{\"src\":[\"pages/index/index\",\"pages/second/second\"]}"
const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainAbility/pages/second/second\"]}"
export default function getProfileByExtensionAbility() {
describe('getProfileByExtensionAbility', function () {
......
......@@ -16,7 +16,7 @@
import getProfileByAbility from './GetProfileByAbility.test.ets';
import getProfileByExtensionAbility from './GetProfileByExtensionAbility.test.ets';
export default function testsuite(context) {
export default function testsuite() {
getProfileByAbility();
getProfileByExtensionAbility();
}
\ No newline at end of file
{
"src": [
"pages/index/index",
"pages/second/second"
"MainAbility/pages/index/index",
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
{
"src": [
"pages/index/index",
"pages/second/second"
"MainAbility/pages/index/index",
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
{
"src": [
"pages/index/index",
"pages/second/second"
"MainAbility/pages/index/index",
"MainAbility/pages/second/second"
]
}
\ No newline at end of file
......@@ -23,7 +23,10 @@ ohos_js_hap_suite("ActsBundleNativeTest") {
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsBundleNativeTest"
shared_libraries = [ "./entry/src/main/cpp:bundlendk" ]
shared_libraries = [
"./entry/src/main/cpp:bundlendk",
":libcppsharedso",
]
}
ohos_prebuilt_shared_library("libcppsharedso") {
......
......@@ -23,7 +23,9 @@ ohos_js_hap_suite("ActsRpcJsTest") {
hap_name = "ActsRpcHapTest"
}
ohos_js_assets("rpc_js_assets") {
source_dir = "./src/main/js/default"
js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
}
ohos_resources("rpc_js_resources") {
sources = [ "./src/main/resources" ]
......
{
"description": "Configuration for rpc Tests",
"driver": {
"type": "JSUnitTest",
"type": "OHJSUnitTest",
"test-timeout": "600000",
"package": "com.ohos.rpctest",
"abilityName": "com.ohos.rpctest.MainAbility",
"shell-timeout": "600000"
"shell-timeout": "600000",
"testcase-timeout": 60000,
"bundle-name":"com.ohos.rpctest",
"package-name": "com.ohos.rpctest"
},
"kits": [
{
......
......@@ -13,6 +13,7 @@
},
"deviceConfig": {},
"module": {
"reqPermissions": [
{
"name": "ohos.permission.DISTRIBUTED_DATASYNC"
......@@ -26,6 +27,8 @@
],
"package": "com.ohos.rpctest",
"name": "com.ohos.rpctest.MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "",
"deviceType": [
"phone"
],
......@@ -46,14 +49,31 @@
]
}
],
"name": "com.ohos.rpctest.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
"type": "page",
"visible":true,
"launchType": "standard"
}
"orientation": "unspecified",
"formsEnabled": false,
"name": ".MainAbility",
"srcLanguage": "js",
"srcPath": "MainAbility",
"icon": "$media:icon",
"description": "$string:MainAbility_desc",
"label": "$string:MainAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
},
{
"orientation": "unspecified",
"formsEnabled": false,
"name": ".TestAbility",
"srcLanguage": "js",
"srcPath": "TestAbility",
"icon": "$media:icon",
"description": "$string:TestAbility_desc",
"label": "$string:TestAbility_label",
"type": "page",
"visible": true,
"launchType": "standard"
}
],
"js": [
{
......@@ -65,7 +85,21 @@
"designWidth": 720,
"autoDesignWidth": false
}
},
{
"pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
],
"testRunner": {
"name": "OpenHarmonyTestRunner",
"srcPath": "TestRunner"
}
}
}
\ No newline at end of file
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Copyright (c) 2022 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
......@@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('AceApplication onCreate');
......
......@@ -13,7 +13,6 @@
* limitations under the License.
*/
import {Core} from 'deccjsunit/index'
const injectRef = Object.getPrototypeOf(global) || global
injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')
......@@ -27,12 +26,6 @@ export default {
},
onShow() {
console.info('onShow finish')
const core = Core.getInstance()
core.init()
const configService = core.getDefaultService('config')
configService.setConfig(this)
require('../../test/List.test')
core.execute()
},
onReady() {
},
......
/*
* Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
export default {
onCreate() {
console.info("TestApplication onCreate")
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
},
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
/*
* Copyright (c) 2022 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.
*/
.container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
.title {
font-size: 60px;
text-align: center;
width: 100%;
height: 40%;
margin: 10px;
}
@media screen and (orientation: landscape) {
.title {
font-size: 60px;
}
}
@media screen and (device-type: tablet) and (orientation: landscape) {
.title {
font-size: 100px;
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 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.
*/
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
/*
* Copyright (c) 2022 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 {
data: {
title: ""
},
onInit() {
this.title = this.$t('strings.world');
}
}
/*
* Copyright (c) 2022 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
function translateParamsToString(parameters) {
const keySet = new Set([
'-s class', '-s notClass', '-s suite', '-s itName',
'-s level', '-s testType', '-s size', '-s timeout',
'-s package', '-s dryRun'
])
let targetParams = '';
for (const key in parameters) {
if (keySet.has(key)) {
targetParams += ' ' + key + ' ' + parameters[key]
}
}
return targetParams.trim()
}
export default {
onPrepare() {
console.info('OpenHarmonyTestRunner OnPrepare')
},
onRun() {
console.log('OpenHarmonyTestRunner onRun run')
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility'
var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName
cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters)
var debug = abilityDelegatorArguments.parameters["-D"]
console.info('debug value : '+debug)
if (debug == 'true')
{
cmd += ' -D'
}
console.info('cmd : '+cmd)
abilityDelegator.executeShellCommand(cmd, (err, data) => {
console.info('executeShellCommand : err : ' + JSON.stringify(err));
console.info('executeShellCommand : data : ' + data.stdResult);
console.info('executeShellCommand : data : ' + data.exitCode);
})
}
};
\ No newline at end of file
......@@ -13,5 +13,8 @@
* limitations under the License.
*/
require('./RpcJsunit.test.js')
require('./RpcClientJsunit.test.js')
\ No newline at end of file
import actsRpcClientJsTest from './RpcClientJsunit.test.js'
export default function testsuite() {
actsRpcClientJsTest()
}
......@@ -7,6 +7,22 @@
{
"name": "mainability_description",
"value": "JS_Phone_Empty Rpc"
}
},
{
"name": "MainAbility_desc",
"value": "description"
},
{
"name": "MainAbility_label",
"value": "label"
},
{
"name": "TestAbility_desc",
"value": "description"
},
{
"name": "TestAbility_label",
"value": "label"
}
]
}
\ No newline at end of file
......@@ -30,7 +30,7 @@ hcpptest_suite("ActsDMSTest") {
"//foundation/communication/ipc/interfaces/innerkits/c/ipc/include",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/registry",
"//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr",
"//foundation/distributedschedule/dmsfwk_lite/include",
"//foundation/ability/dmsfwk_lite/include",
"//foundation/distributedschedule/samgr_lite/interfaces/innerkits",
"${aafwk_lite_path}/interfaces/innerkits/abilitymgr_lite",
......@@ -44,7 +44,7 @@ hcpptest_suite("ActsDMSTest") {
deps = [
"${appexecfwk_lite_path}/frameworks/bundle_lite:bundle",
"//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
"//foundation/distributedschedule/dmsfwk_lite:dtbschedmgr",
"//foundation/ability/dmsfwk_lite:dtbschedmgr",
"//foundation/distributedschedule/samgr_lite/samgr:samgr",
"//third_party/bounds_checking_function:libsec_shared",
]
......
......@@ -29,3 +29,8 @@ group("distributeddatamgr") {
]
}
}
group("pasteboard") {
testonly = true
deps = [ "Pasteboardjsapitest:ActsPasteBoardJSApiTest" ]
}
......@@ -17,6 +17,7 @@ group("graphic") {
if (is_standard_system) {
deps = [
"effectKit:EffectKitTest",
"graphicnapidrawingtest:GraphicNapiDrawingTest",
"webGL:webGL_hap_test",
"windowStage:ActsWindowStageTest",
"windowstandard:window_hap_test",
......
# Copyright (C) 2022 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("//test/xts/tools/build/suite.gni")
module_output_path = "hit/GraphicNapiDrawingTest"
###############################################################################
ohos_moduletest_suite("GraphicNapiDrawingTest") {
module_out_path = module_output_path
sources = [
"NativeDrawingBitmapTest.cpp",
"NativeDrawingBrushTest.cpp",
"NativeDrawingCanvasTest.cpp",
"NativeDrawingColorTest.cpp",
"NativeDrawingPathTest.cpp",
"NativeDrawingPenTest.cpp",
"OH_Drawing_FontCollectionTest.cpp",
"OH_Drawing_TypographyTest.cpp",
]
cflags = [
"-Wall",
"-Werror",
]
include_dirs = [
"//foundation/graphic/graphic_2d/rosen/modules/2d_engine",
"//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/include",
"//foundation/graphic/graphic_2d/rosen/modules/2d_graphics/src",
"//third_party/googletest/googletest/include",
]
deps = [
"//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog",
"//foundation/graphic/graphic_2d/rosen/modules/2d_graphics:2d_graphics",
"//third_party/googletest:gtest_main",
"//utils/native/base:utils",
]
}
/*
* Copyright (c) 2022 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, Hardware
* 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.
*/
#include "gtest/gtest.h"
#include "c/drawing_bitmap.h"
#include "c/drawing_types.h"
using namespace testing;
using namespace testing::ext;
namespace OHOS {
namespace Rosen {
namespace Drawing {
class NativeDrawingBitmapTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
};
void NativeDrawingBitmapTest::SetUpTestCase() {}
void NativeDrawingBitmapTest::TearDownTestCase() {}
void NativeDrawingBitmapTest::SetUp() {}
void NativeDrawingBitmapTest::TearDown() {}
/*
* @tc.name: NativeDrawingBitmapTest_bitmap001
* @tc.desc: test for create drawing_bitmap and destroy drawing_bitmap.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingBitmapTest, NativeDrawingBitmapTest_bitmap001, TestSize.Level1)
{
OH_Drawing_Bitmap* bitmap = OH_Drawing_BitmapCreate();
EXPECT_EQ(bitmap == nullptr, false);
OH_Drawing_BitmapDestroy(bitmap);
}
/*
* @tc.name: NativeDrawingBitmapTest_bitmap002
* @tc.desc: test for drawing_bitmap build.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingBitmapTest, NativeDrawingBitmapTest_bitmap002, TestSize.Level1)
{
OH_Drawing_Bitmap* bitmap1 = OH_Drawing_BitmapCreate();
const unsigned int width = 500;
const unsigned int height = 500;
OH_Drawing_BitmapFormat bitmapFormat { COLOR_FORMAT_ALPHA_8, ALPHA_FORMAT_PREMUL };
OH_Drawing_BitmapBuild(bitmap1, width, height, &bitmapFormat);
EXPECT_EQ(width, OH_Drawing_BitmapGetWidth(bitmap1));
EXPECT_EQ(height, OH_Drawing_BitmapGetHeight(bitmap1));
OH_Drawing_BitmapDestroy(bitmap1);
}
/*
* @tc.name: NativeDrawingBitmapTest_bitmap003
* @tc.desc: test for drawing_bitmap build.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingBitmapTest, NativeDrawingBitmapTest_bitmap003, TestSize.Level1)
{
OH_Drawing_Bitmap* bitmap2 = OH_Drawing_BitmapCreate();
const unsigned int width = 0;
const unsigned int height = 0;
OH_Drawing_BitmapFormat bitmapFormat { COLOR_FORMAT_RGB_565, ALPHA_FORMAT_OPAQUE };
OH_Drawing_BitmapBuild(bitmap2, width, height, &bitmapFormat);
EXPECT_EQ(width, OH_Drawing_BitmapGetWidth(bitmap2));
EXPECT_EQ(height, OH_Drawing_BitmapGetHeight(bitmap2));
OH_Drawing_BitmapDestroy(bitmap2);
}
/*
* @tc.name: NativeDrawingBitmapTest_bitmap004
* @tc.desc: test for drawing_bitmap build.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingBitmapTest, NativeDrawingBitmapTest_bitmap004, TestSize.Level1)
{
OH_Drawing_Bitmap* bitmap4 = OH_Drawing_BitmapCreate();
const unsigned int width = 500;
const unsigned int height = 500;
OH_Drawing_BitmapFormat bitmapFormat { COLOR_FORMAT_ARGB_4444, ALPHA_FORMAT_UNPREMUL };
OH_Drawing_BitmapBuild(bitmap4, width, height, &bitmapFormat);
EXPECT_EQ(width, OH_Drawing_BitmapGetWidth(bitmap4));
EXPECT_EQ(height, OH_Drawing_BitmapGetHeight(bitmap4));
EXPECT_EQ(OH_Drawing_BitmapGetPixels(bitmap4) == nullptr, false);
OH_Drawing_BitmapDestroy(bitmap4);
}
/*
* @tc.name: NativeDrawingBitmapTest_bitmap005
* @tc.desc: test for drawing_bitmap build.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingBitmapTest, NativeDrawingBitmapTest_bitmap005, TestSize.Level1)
{
OH_Drawing_Bitmap* bitmap5 = OH_Drawing_BitmapCreate();
const unsigned int width = 500;
const unsigned int height = 500;
OH_Drawing_BitmapFormat bitmapFormat { COLOR_FORMAT_RGBA_8888, ALPHA_FORMAT_UNPREMUL };
OH_Drawing_BitmapBuild(bitmap5, width, height, &bitmapFormat);
EXPECT_EQ(width, OH_Drawing_BitmapGetWidth(bitmap5));
EXPECT_EQ(height, OH_Drawing_BitmapGetHeight(bitmap5));
OH_Drawing_BitmapDestroy(bitmap5);
}
} // namespace Drawing
} // namespace Rosen
} // namespace OHOS
\ No newline at end of file
/*
* Copyright (c) 2022 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, Hardware
* 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.
*/
#include "gtest/gtest.h"
#include "c/drawing_brush.h"
#include "c/drawing_color.h"
using namespace testing;
using namespace testing::ext;
namespace OHOS {
namespace Rosen {
namespace Drawing {
class NativeDrawingBrushTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
};
void NativeDrawingBrushTest::SetUpTestCase() {}
void NativeDrawingBrushTest::TearDownTestCase() {}
void NativeDrawingBrushTest::SetUp() {}
void NativeDrawingBrushTest::TearDown() {}
/*
* @tc.name: NativeDrawingBrushTest_brush001
* @tc.desc: test for create brush and destroy brush.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingBrushTest, NativeDrawingBrushTest_brush001, TestSize.Level1)
{
OH_Drawing_Brush* brush = OH_Drawing_BrushCreate();
EXPECT_EQ(brush == nullptr, false);
OH_Drawing_BrushDestroy(brush);
}
/*
* @tc.name: NativeDrawingBrushTest_brush002
* @tc.desc: test for the set methods of brush.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingBrushTest, NativeDrawingBrushTest_brush002, TestSize.Level1)
{
OH_Drawing_Brush* brush1 = OH_Drawing_BrushCreate();
OH_Drawing_BrushSetAntiAlias(brush1, false);
EXPECT_EQ(OH_Drawing_BrushIsAntiAlias(brush1), false);
OH_Drawing_BrushSetColor(brush1, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0x00, 0x00));
EXPECT_EQ(OH_Drawing_BrushGetColor(brush1), 0xFFFF0000);
}
} // namespace Drawing
} // namespace Rosen
} // namespace OHOS
\ No newline at end of file
/*
* Copyright (c) 2022 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, Hardware
* 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.
*/
#include "gtest/gtest.h"
#include "c/drawing_bitmap.h"
#include "c/drawing_brush.h"
#include "c/drawing_canvas.h"
#include "c/drawing_color.h"
#include "c/drawing_path.h"
#include "c/drawing_pen.h"
using namespace testing;
using namespace testing::ext;
namespace OHOS {
namespace Rosen {
namespace Drawing {
class NativeDrawingCanvasTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
};
void NativeDrawingCanvasTest::SetUpTestCase() {}
void NativeDrawingCanvasTest::TearDownTestCase() {}
void NativeDrawingCanvasTest::SetUp() {}
void NativeDrawingCanvasTest::TearDown() {}
/*
* @tc.name: NativeDrawingCanvasTest_canvas001
* @tc.desc: test for create canvas and destroy canvas.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas001, TestSize.Level1)
{
OH_Drawing_Canvas* canvas = OH_Drawing_CanvasCreate();
EXPECT_EQ(canvas == nullptr, false);
OH_Drawing_CanvasDestroy(canvas);
}
/*
* @tc.name: NativeDrawingCanvasTest_canvas002
* @tc.desc: test for OH_Drawing_CanvasBind.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas002, TestSize.Level1)
{
OH_Drawing_Canvas* canvas1 = OH_Drawing_CanvasCreate();
OH_Drawing_Bitmap* bitmap = OH_Drawing_BitmapCreate();
OH_Drawing_CanvasBind(canvas1, bitmap);
}
/*
* @tc.name: NativeDrawingCanvasTest_canvas003
* @tc.desc: test for OH_Drawing_CanvasAttachPen & OH_Drawing_CanvasDetachPen.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas003, TestSize.Level1)
{
OH_Drawing_Canvas* canvas2 = OH_Drawing_CanvasCreate();
OH_Drawing_Pen* pen = OH_Drawing_PenCreate();
OH_Drawing_CanvasAttachPen(canvas2, pen);
OH_Drawing_CanvasDetachPen(canvas2);
}
/*
* @tc.name: NativeDrawingCanvasTest_canvas004
* @tc.desc: test for OH_Drawing_CanvasAttachBrush & OH_Drawing_CanvasDetachBrush.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas004, TestSize.Level1)
{
OH_Drawing_Canvas* canvas3 = OH_Drawing_CanvasCreate();
OH_Drawing_Brush* brush = OH_Drawing_BrushCreate();
OH_Drawing_CanvasAttachBrush(canvas3, brush);
OH_Drawing_CanvasDetachBrush(canvas3);
}
/*
* @tc.name: NativeDrawingCanvasTest_canvas005
* @tc.desc: test for OH_Drawing_CanvasDrawLine.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas005, TestSize.Level1)
{
OH_Drawing_Canvas* canvas4 = OH_Drawing_CanvasCreate();
OH_Drawing_CanvasDrawLine(canvas4, 0, 0, 20, 20);
OH_Drawing_CanvasDrawLine(canvas4, -15.2f, -1, 0, 20);
}
/*
* @tc.name: NativeDrawingCanvasTest_canvas006
* @tc.desc: test for OH_Drawing_CanvasDrawPath.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas006, TestSize.Level1)
{
OH_Drawing_Canvas* canvas5 = OH_Drawing_CanvasCreate();
OH_Drawing_Path* path = OH_Drawing_PathCreate();
OH_Drawing_CanvasDrawPath(canvas5, path);
}
/*
* @tc.name: NativeDrawingCanvasTest_canvas007
* @tc.desc: test for OH_Drawing_CanvasSave & OH_Drawing_CanvasRestore.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas007, TestSize.Level1)
{
OH_Drawing_Canvas* canvas6 = OH_Drawing_CanvasCreate();
OH_Drawing_Path* path = OH_Drawing_PathCreate();
OH_Drawing_CanvasDrawPath(canvas6, path);
OH_Drawing_CanvasSave(canvas6);
OH_Drawing_CanvasRestore(canvas6);
}
/*
* @tc.name: NativeDrawingCanvasTest_canvas008
* @tc.desc: test for OH_Drawing_CanvasClear.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingCanvasTest, NativeDrawingCanvasTest_canvas008, TestSize.Level1)
{
OH_Drawing_Canvas* canvas7 = OH_Drawing_CanvasCreate();
OH_Drawing_CanvasClear(canvas7, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0x00, 0x00));
}
} // namespace Drawing
} // namespace Rosen
} // namespace OHOS
\ No newline at end of file
/*
* Copyright (c) 2022 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, Hardware
* 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.
*/
#include "gtest/gtest.h"
#include "c/drawing_brush.h"
#include "c/drawing_color.h"
using namespace testing;
using namespace testing::ext;
namespace OHOS {
namespace Rosen {
namespace Drawing {
class NativeDrawingColorTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
};
void NativeDrawingColorTest::SetUpTestCase() {}
void NativeDrawingColorTest::TearDownTestCase() {}
void NativeDrawingColorTest::SetUp() {}
void NativeDrawingColorTest::TearDown() {}
/*
* @tc.name: NativeDrawingColorTest_color001
* @tc.desc: test for ColorSetArgb.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingColorTest, NativeDrawingColorTest_color001, TestSize.Level1)
{
OH_Drawing_Brush* brush1 = OH_Drawing_BrushCreate();
OH_Drawing_BrushSetAntiAlias(brush1, false);
EXPECT_EQ(OH_Drawing_BrushIsAntiAlias(brush1), false);
OH_Drawing_BrushSetColor(brush1, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0x00, 0x00));
EXPECT_EQ(OH_Drawing_BrushGetColor(brush1), 0xFFFF0000);
}
} // namespace Drawing
} // namespace Rosen
} // namespace OHOS
\ No newline at end of file
/*
* Copyright (c) 2022 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, Hardware
* 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.
*/
#include "gtest/gtest.h"
#include "c/drawing_path.h"
using namespace testing;
using namespace testing::ext;
namespace OHOS {
namespace Rosen {
namespace Drawing {
class NativeDrawingPathTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
};
void NativeDrawingPathTest::SetUpTestCase() {}
void NativeDrawingPathTest::TearDownTestCase() {}
void NativeDrawingPathTest::SetUp() {}
void NativeDrawingPathTest::TearDown() {}
/*
* @tc.name: NativeDrawingPathTest_path001
* @tc.desc: test for create drawing_path.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path001, TestSize.Level1)
{
OH_Drawing_Path* path = OH_Drawing_PathCreate();
EXPECT_EQ(path == nullptr, false);
OH_Drawing_PathDestroy(path);
}
/*
* @tc.name: NativeDrawingPathTest_path002
* @tc.desc: test for PathMoveTo func.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path002, TestSize.Level1)
{
OH_Drawing_Path* path1 = OH_Drawing_PathCreate();
OH_Drawing_PathMoveTo(path1, 20, 20);
OH_Drawing_PathMoveTo(path1, -1, 20.6f);
OH_Drawing_PathDestroy(path1);
}
/*
* @tc.name: NativeDrawingPathTest_path004
* @tc.desc: test for PathLineTo func.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path003, TestSize.Level1)
{
OH_Drawing_Path* path2 = OH_Drawing_PathCreate();
OH_Drawing_PathLineTo(path2, 50, 40);
OH_Drawing_PathLineTo(path2, -50, 10.2f);
OH_Drawing_PathDestroy(path2);
}
/*
* @tc.name: NativeDrawingPathTest_path005
* @tc.desc: test for PathReset func.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path004, TestSize.Level1)
{
OH_Drawing_Path* path3 = OH_Drawing_PathCreate();
OH_Drawing_PathMoveTo(path3, 20, 20);
OH_Drawing_PathReset(path3);
OH_Drawing_PathDestroy(path3);
}
/*
* @tc.name: NativeDrawingPathTest_path006
* @tc.desc: test for PathArcTo func.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path005, TestSize.Level1)
{
OH_Drawing_Path* path4 = OH_Drawing_PathCreate();
OH_Drawing_PathArcTo(path4, 10, 10, 20, 0, 0, 90);
OH_Drawing_PathArcTo(path4, -10, 10, 10, -10, 0, 90);
OH_Drawing_PathDestroy(path4);
}
/*
* @tc.name: NativeDrawingPathTest_path007
* @tc.desc: test for PathQuadTo func.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path006, TestSize.Level1)
{
OH_Drawing_Path* path5 = OH_Drawing_PathCreate();
OH_Drawing_PathQuadTo(path5, 0, 0, 30, 30);
OH_Drawing_PathQuadTo(path5, -20.5f, -20.5f, 30, 0);
OH_Drawing_PathDestroy(path5);
}
/*
* @tc.name: NativeDrawingPathTest_path008
* @tc.desc: test for PathCubicTo func.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path007, TestSize.Level1)
{
OH_Drawing_Path* path6 = OH_Drawing_PathCreate();
OH_Drawing_PathCubicTo(path6, 30, 40, 60, 0, 50, 20);
OH_Drawing_PathCubicTo(path6, -30, 40, 60, -30.6f, 50, -20);
OH_Drawing_PathDestroy(path6);
}
/*
* @tc.name: NativeDrawingPathTest_path009
* @tc.desc: test for PathClose func.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_path009, TestSize.Level1)
{
OH_Drawing_Path* path7 = OH_Drawing_PathCreate();
OH_Drawing_PathLineTo(path7, 50, 40);
OH_Drawing_PathClose(path7);
OH_Drawing_PathDestroy(path7);
}
} // namespace Drawing
} // namespace Rosen
} // namespace OHOS
\ No newline at end of file
/*
* Copyright (c) 2022 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, Hardware
* 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.
*/
#include "gtest/gtest.h"
#include "c/drawing_color.h"
#include "c/drawing_pen.h"
using namespace testing;
using namespace testing::ext;
namespace OHOS {
namespace Rosen {
namespace Drawing {
class NativeDrawingPenTest : public testing::Test {
public:
static void SetUpTestCase();
static void TearDownTestCase();
void SetUp() override;
void TearDown() override;
};
void NativeDrawingPenTest::SetUpTestCase() {}
void NativeDrawingPenTest::TearDownTestCase() {}
void NativeDrawingPenTest::SetUp() {}
void NativeDrawingPenTest::TearDown() {}
/*
* @tc.name: NativeDrawingPenTest_pen001
* @tc.desc: test for create drawing_pen.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen001, TestSize.Level1)
{
OH_Drawing_Pen* pen = OH_Drawing_PenCreate();
EXPECT_EQ(pen == nullptr, false);
OH_Drawing_PenDestroy(pen);
}
/*
* @tc.name: NativeDrawingPenTest_pen002
* @tc.desc: test for the get and set methods about AntiAlias for a pen.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen002, TestSize.Level1)
{
OH_Drawing_Pen* pen1 = OH_Drawing_PenCreate();
OH_Drawing_PenSetAntiAlias(pen1, true);
EXPECT_EQ(OH_Drawing_PenIsAntiAlias(pen1), true);
OH_Drawing_PenSetAntiAlias(pen1, false);
EXPECT_EQ(OH_Drawing_PenIsAntiAlias(pen1), false);
OH_Drawing_PenDestroy(pen1);
}
/*
* @tc.name: NativeDrawingPenTest_pen003
* @tc.desc: test for the get and set methods about the color for a pen.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen003, TestSize.Level1)
{
OH_Drawing_Pen* pen2 = OH_Drawing_PenCreate();
OH_Drawing_PenSetColor(pen2, OH_Drawing_ColorSetArgb(0xFF, 0xFF, 0x00, 0x00));
EXPECT_EQ(OH_Drawing_PenGetColor(pen2), 0xFFFF0000);
OH_Drawing_PenDestroy(pen2);
}
/*
* @tc.name: NativeDrawingPenTest_pen004
* @tc.desc: test for the get and set methods about the width for a pen.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen004, TestSize.Level1)
{
OH_Drawing_Pen* pen3 = OH_Drawing_PenCreate();
OH_Drawing_PenSetWidth(pen3, 10);
EXPECT_EQ(OH_Drawing_PenGetWidth(pen3), 10);
OH_Drawing_PenDestroy(pen3);
}
/*
* @tc.name: NativeDrawingPenTest_pen005
* @tc.desc: test for the get and set methods about the miterLimit for a pen.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen005, TestSize.Level1)
{
OH_Drawing_Pen* pen4 = OH_Drawing_PenCreate();
OH_Drawing_PenSetMiterLimit(pen4, 5);
EXPECT_EQ(OH_Drawing_PenGetMiterLimit(pen4), 5);
OH_Drawing_PenDestroy(pen4);
}
/*
* @tc.name: NativeDrawingPenTest_pen006
* @tc.desc: test for the get and set methods about the line cap style for a pen.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen006, TestSize.Level1)
{
OH_Drawing_Pen* pen5 = OH_Drawing_PenCreate();
OH_Drawing_PenSetCap(pen5, OH_Drawing_PenLineCapStyle::LINE_SQUARE_CAP);
EXPECT_EQ(OH_Drawing_PenGetCap(pen5), OH_Drawing_PenLineCapStyle::LINE_SQUARE_CAP);
OH_Drawing_PenSetCap(pen5, OH_Drawing_PenLineCapStyle::LINE_FLAT_CAP);
EXPECT_EQ(OH_Drawing_PenGetCap(pen5), OH_Drawing_PenLineCapStyle::LINE_FLAT_CAP);
OH_Drawing_PenSetCap(pen5, OH_Drawing_PenLineCapStyle::LINE_ROUND_CAP);
EXPECT_EQ(OH_Drawing_PenGetCap(pen5), OH_Drawing_PenLineCapStyle::LINE_ROUND_CAP);
OH_Drawing_PenDestroy(pen5);
}
/*
* @tc.name: NativeDrawingPenTest_pen007
* @tc.desc: test for the get and set methods about the line join style for a pen.
* @tc.type: FUNC
* @tc.require: AR000GTO5R
*/
HWTEST_F(NativeDrawingPenTest, NativeDrawingPenTest_pen007, TestSize.Level1)
{
OH_Drawing_Pen* pen6 = OH_Drawing_PenCreate();
OH_Drawing_PenSetJoin(pen6, OH_Drawing_PenLineJoinStyle::LINE_ROUND_JOIN);
EXPECT_EQ(OH_Drawing_PenGetJoin(pen6), OH_Drawing_PenLineJoinStyle::LINE_ROUND_JOIN);
OH_Drawing_PenSetJoin(pen6, OH_Drawing_PenLineJoinStyle::LINE_MITER_JOIN);
EXPECT_EQ(OH_Drawing_PenGetJoin(pen6), OH_Drawing_PenLineJoinStyle::LINE_MITER_JOIN);
OH_Drawing_PenSetJoin(pen6, OH_Drawing_PenLineJoinStyle::LINE_BEVEL_JOIN);
EXPECT_EQ(OH_Drawing_PenGetJoin(pen6), OH_Drawing_PenLineJoinStyle::LINE_BEVEL_JOIN);
OH_Drawing_PenDestroy(pen6);
}
} // namespace Drawing
} // namespace Rosen
} // namespace OHOS
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册