提交 16ac9a5c 编写于 作者: G guoenquan

modify webGL use case

Signed-off-by: Nguoenquan <guoenquan1@huawei-partners.com>
上级 5e6727d2
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
...@@ -16,16 +16,18 @@ import("//test/xts/tools/build/suite.gni") ...@@ -16,16 +16,18 @@ import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("webGL_hap_test") { ohos_js_hap_suite("webGL_hap_test") {
hap_profile = "./src/main/config.json" hap_profile = "./src/main/config.json"
deps = [ deps = [
":window_js_assets", ":webGL_js_assets",
":window_resources", ":webGL_resources",
] ]
certificate_profile = "./signature/openharmony_sx.p7b" certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsWebGLHapTest" hap_name = "ActsWebGLHapTest"
} }
ohos_js_assets("window_js_assets") { ohos_js_assets("webGL_js_assets") {
source_dir = "./src/main/js/default" js2abc = true
hap_profile = "./src/main/config.json"
source_dir = "./src/main/js"
} }
ohos_resources("window_resources") { ohos_resources("webGL_resources") {
sources = [ "./src/main/resources" ] sources = [ "./src/main/resources" ]
hap_profile = "./src/main/config.json" hap_profile = "./src/main/config.json"
} }
{ {
"description": "Configuration for hjunit demo Tests", "description": "Configuration for hjunit demo Tests",
"driver": { "driver": {
"type": "JSUnitTest", "type": "OHJSUnitTest",
"test-timeout": "1200000", "test-timeout": "1200000",
"package": "com.test.webGL", "shell-timeout": "800000",
"shell-timeout": "60000" "bundle-name": "com.test.webGL",
"package-name": "com.test.webGL",
"testcase-timeout": "300000"
}, },
"kits": [ "kits": [
{ {
...@@ -17,7 +19,8 @@ ...@@ -17,7 +19,8 @@
{ {
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "run-command": [
"hilog -Q pidoff" "power-shell wakeup",
"power-shell setmode 602"
] ]
} }
] ]
......
...@@ -26,38 +26,70 @@ ...@@ -26,38 +26,70 @@
"moduleType": "entry" "moduleType": "entry"
}, },
"abilities": [ "abilities": [
{ {
"visible": true, "skills": [
"skills": [ {
{ "entities": [
"entities": [ "entity.system.home"
"entity.system.home" ],
], "actions": [
"actions": [ "action.system.home"
"action.system.home" ]
] }
} ],
"orientation": "unspecified",
"formsEnabled": false,
"name": "com.test.webGL.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"
}
], ],
"name": "com.test.webGL.MainAbility", "js": [
"icon": "$media:icon", {
"description": "$string:mainability_description", "pages": [
"label": "$string:app_name", "pages/index/index"
"type": "page", ],
"launchType": "standard", "name": "default",
"isVisible": "true" "window": {
} "designWidth": 720,
], "autoDesignWidth": false
"js": [ }
{ },
"pages": [ {
"pages/index/index" "pages": [
"pages/index/index"
],
"name": ".TestAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
], ],
"name": "default", "testRunner": {
"window": { "name": "OpenHarmonyTestRunner",
"designWidth": 720, "srcPath": "TestRunner"
"autoDesignWidth": false },
} "mainAbility": ".MainAbility",
} "srcPath": ""
]
} }
} }
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
export default { export default {
onCreate() { onCreate() {
console.info('AceApplication onCreate'); console.info('AceApplication onCreate');
}, },
onDestroy() { onDestroy() {
console.info('AceApplication onDestroy'); console.info('AceApplication onDestroy');
} }
}; };
...@@ -2,6 +2,4 @@ ...@@ -2,6 +2,4 @@
<text class="title"> <text class="title">
{{ $t('strings.hello') }} {{ title }} {{ $t('strings.hello') }} {{ title }}
</text> </text>
<canvas ref="canvas1" id="canvas1" style="width: 400px;height:200px;background-color:brown;"></canvas>
<canvas ref="canvas2" id="canvas2" style="width: 400px;height:200px;background-color:royalblue;"></canvas>
</div> </div>
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {Core,ExpectExtend} from 'deccjsunit/index'
export default { export default {
data: { data: {
...@@ -20,22 +19,5 @@ export default { ...@@ -20,22 +19,5 @@ export default {
}, },
onInit() { onInit() {
this.title = this.$t('strings.world'); this.title = this.$t('strings.world');
},
onShow(){
global.el = this.$refs.canvas1;
global.el2 = this.$refs.canvas2;
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id':'extend'
})
core.addService('expect',expectExtend)
core.init()
const configService = core.getDefaultService('config')
this.timeout = 60000
configService.setConfig(this)
require('../../test/List.test.js')
core.execute()
} }
} }
export default {
onCreate() {
console.info('TestApplication onCreate');
},
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
.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 (device-type: phone) 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
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
<canvas ref='canvas1' id='canvas1' style='width:400px;height:200px;background-color:brown;'></canvas>
<canvas ref='canvas2' id='canvas2' style='width:400px;height:200px;background-color:royalblue;'></canvas>
</div>
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../../../test/List.test'
export default {
data:{
title:""
},
onInit(){
this.title = this.$t('strings.world');
},
onShow(){
global.el = this.$refs.canvas1;
global.el2 = this.$refs.canvas2;
var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
console.info('start run testcase!!!')
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
}
/*
* 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);
})
}
};
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import webgl1Test_webgl1 from './WebGL.test01.js'
require('./WebGL.test01.js') import webgl1Test_webgl2 from './WebGL.test02.js'
require('./WebGL.test02.js') import webgl1Test_webgl3 from './WebGL.test03.js'
require('./WebGL.test03.js') import webgl1Test_webgl4 from './WebGL.test04.js'
require('./WebGL.test04.js') import webgl1Test_webgl5 from './WebGL.test05.js'
require('./WebGL.test05.js') import webgl1Test_webgl6 from './WebGL.test06.js'
require('./WebGL.test06.js') import webgl1Test_webgl7 from './WebGL.test07.js'
require('./WebGL.test07.js') import webgl1Test_webgl8 from './WebGL.test08.js'
require('./WebGL.test08.js') import webgl1Test_webgl9 from './WebGL.test09.js'
require('./WebGL.test09.js') import webgl1Test_webgl10 from './WebGL.test10.js'
require('./WebGL.test10.js') import webgl1Test_webgl11 from './WebGL.test11.js'
require('./WebGL.test11.js') import webgl1Test_webgl12 from './WebGL.test12.js'
require('./WebGL.test12.js') import webgl1Test_webgl13 from './WebGL.test13.js'
require('./WebGL.test13.js') import webgl1Test_webgl14 from './WebGL.test14.js'
require('./WebGL.test14.js') import webgl1Test_webgl15 from './WebGL.test15.js'
require('./WebGL.test15.js')
\ No newline at end of file export default function testsuite(){
webgl1Test_webgl1()
webgl1Test_webgl2()
webgl1Test_webgl3()
webgl1Test_webgl4()
webgl1Test_webgl5()
webgl1Test_webgl6()
webgl1Test_webgl7()
webgl1Test_webgl8()
webgl1Test_webgl9()
webgl1Test_webgl10()
webgl1Test_webgl11()
webgl1Test_webgl12()
webgl1Test_webgl13()
webgl1Test_webgl14()
webgl1Test_webgl15()
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
...@@ -2,11 +2,27 @@ ...@@ -2,11 +2,27 @@
"string": [ "string": [
{ {
"name": "app_name", "name": "app_name",
"value": "webGL" "value": "window"
}, },
{ {
"name": "mainability_description", "name": "mainability_description",
"value": "JS_Phone_Empty Feature Ability" "value": "JS_Phone_Empty Feature Ability"
} },
{
"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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册