提交 5bd3328b 编写于 作者: T tianwenzhe

change

Signed-off-by: Ntian-wenzhe411 <tianwenzhe2@huawei.com>
上级 b5ead519
......@@ -18,7 +18,8 @@ export default class MainAbility extends Ability {
console.log("[Demo] MainAbility onWindowStageCreate")
let AtManager = abilityAccessCtrl.createAtManager();
AtManager.requestPermissionsFromUser(this.context,["ohos.permission.READ_MEDIA","ohos.permission.WRITE_MEDIA",
"ohos.permission.CAPTURE_SCREEN","ohos.permission.INTERNET","ohos.permission.CAMERA"]).then(() => {})
"ohos.permission.CAPTURE_SCREEN","ohos.permission.INTERNET","ohos.permission.CAMERA",
"ohos.permission.MICROPHONE", "ohos.permission.START_INVISIBLE_ABILITY"]).then(() => {})
windowStage.loadContent("pages/index", (err, data) => {
if (err.code) {
console.error('Failed to load the content. Cause:' + JSON.stringify(err));
......
......@@ -26,8 +26,8 @@ let path1 = path + '/ArkUI';
let VarColor = [];
let ColorBackPath = path + '/ArkUIColorBack.txt';
let txtPath = path1 + 'ArkUIReport.txt';
let xmlPath =path1 + 'ArkUITest.xml';
let txtPath = path1 + '/ArkUIReport.txt';
let xmlPath =path1 + '/ArkUITest.xml';
@Entry
@Component
......@@ -298,23 +298,23 @@ struct IndexPage {
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name","ActsArkUITest");
serializer.setAttributes("time", " ");
serializer.setAttributes("time", "");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", ignoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", testNum);
serializer.setAttributes("message", " ");
serializer.setAttributes("message", "");
serializer.setAttributes("modulename", "ActsArkUITest");
for (let i = 0; i < title.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title[i]));
serializer.setAttributes("status", " ");
serializer.setAttributes("time", " ");
serializer.setAttributes("classname", " ");
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("result", String(result[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.endElement();
}
serializer.endElement();
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022-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
......@@ -27,8 +27,8 @@ let path1 = path + '/Audio';
let VarColor = [];
let ColorBackPath = path + '/AudioColorBack.txt';
let txtPath = path1 + 'AudioReport.txt';
let xmlPath =path1 + 'AudioTest.xml';
let txtPath = path1 + '/AudioReport.txt';
let xmlPath =path1 + '/AudioTest.xml';
@Entry
@Component
......@@ -277,23 +277,23 @@ struct IndexPage {
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name","ActsAudioTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("time", "");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", ignoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", testNum);
serializer.setAttributes("message", " ");
serializer.setAttributes("message", "");
serializer.setAttributes("modulename", "ActsAudioTest");
for (let i = 0; i < title.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title[i]));
serializer.setAttributes("status", " ");
serializer.setAttributes("time", " ");
serializer.setAttributes("classname", " ");
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("result", String(result[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.endElement();
}
serializer.endElement();
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022-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
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022-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
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022-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
......@@ -27,8 +27,8 @@ let path1 = path + '/Camera';
let VarColor = [];
let ColorBackPath = path + '/CameraColorBack.txt';
let txtPath = path1 + 'CameraReport.txt';
let xmlPath = path1 + 'CameraTest.xml';
let txtPath = path1 + '/CameraReport.txt';
let xmlPath = path1 + '/CameraTest.xml';
@Entry
@Component
......@@ -282,23 +282,23 @@ struct IndexPage {
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsCameraTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("time", "");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", ignoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", testNum);
serializer.setAttributes("message", " ");
serializer.setAttributes("message", "");
serializer.setAttributes("modulename", "ActsCameraTest");
for (let i = 0; i < title.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title[i]));
serializer.setAttributes("status", " ");
serializer.setAttributes("time", " ");
serializer.setAttributes("classname", " ");
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("result", String(result[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.endElement();
}
serializer.endElement();
......
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/ExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let Xpath = path + '/DeskFps.log'
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'DeskFps';
@State StepTips: string = '操作步骤:根据操作提示滑动系统桌面测试帧率'+'\n'+'预期结果:帧率高于54帧测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State Fps: string = '0';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n')
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n'
+ `2.双击执行DeskFps.bat`+ '\n' + '\n' +`3.左右滑动系统桌面连续10s以上` + '\n' + '\n'
+ '4.回到DeskFps测试项点击停止键' + '\n' + '\n' + `5.若测试最高帧率大于54帧则通过测试`
+ '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
abilityName: "com.ohos.launcher.MainAbility",
}
abilityContext.startAbility(str).then((data) => {
}).catch((error) => {
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(':');
let end = report.indexOf('|');
this.Fps = report.substring(head+1,end);
let num = Number(this.Fps)
if(num >= 54 ) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n' + `测试结果:` + this.Fps + '帧' )
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
Fps: $Fps
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
......@@ -27,8 +27,8 @@ let path1 = path + '/Experience';
let VarColor = [];
let ColorBackPath = path + '/ExperienceColorBack.txt';
let txtPath = path1 + 'ExperienceReport.txt';
let xmlPath =path1 + 'ExperienceTest.xml';
let txtPath = path1 + '/ExperienceReport.txt';
let xmlPath =path1 + '/ExperienceTest.xml';
@Entry
@Component
......@@ -39,7 +39,8 @@ struct IndexPage {
@State result : string = '';
@State TEST : number = 0;
private TestCaseList = [
{title:'ScrollingList',uri:'pages/Experience/ScrollListTest'},
{title:'DeskFps',uri:'pages/Experience/DeskFps'},
{title:'PhotoFps',uri:'pages/Experience/PhotoFps'},
]
@State ColorObject : string[] = VarColor;
async onPageShow(){
......@@ -277,23 +278,23 @@ struct IndexPage {
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name","ActsExperienceTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("time", "");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", ignoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", testNum);
serializer.setAttributes("message", " ");
serializer.setAttributes("message", "");
serializer.setAttributes("modulename", "ActsExperienceTest");
for (let i = 0; i < title.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title[i]));
serializer.setAttributes("status", " ");
serializer.setAttributes("time", " ");
serializer.setAttributes("classname", " ");
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("result", String(result[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.endElement();
}
serializer.endElement();
......
/*
* Copyright (c) 2022-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 fileio from '@ohos.fileio';
import {CustomContainer} from '../common/ExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir;
let Xpath = path + '/PhotoFps.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'PhotoFps';
@State StepTips: string = '操作步骤:根据操作提示滑动图库测试帧率'+'\n'+'预期结果:帧率高于或等于54帧测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State Fps: string = '0';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`根据以下操作步骤完成测试`+ '\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n')
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.在图库中预置500张图片`+ '\n' + '\n' +`2.点击开始键进入图库`+ '\n' + '\n'
+ `3.双击执行PhotoFps.bat`+ '\n' + '\n' +`4.滑动图库缩略图界面连续10s以上` + '\n' + '\n'
+ '5.回到PhotoFps测试项点击停止键' + '\n' + '\n' + `6.若测试最高帧率大于或等于54帧则通过测试`
+ '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
Column(){
Button(`开始`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.StartEnable = !this.StartEnable;
let bundleName=new String("com.ohos.photos").toString();
let abilityName=new String("com.ohos.photos.MainAbility").toString();
let str = {
"bundleName": bundleName,
"abilityName": abilityName,
"parameters": ""
}
globalThis.abilityContext.startAbility(str, (err, data) => {
if(err) {
return;
}
})
})
}
Column(){
Button(`结束`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let head = report.indexOf(':');
let end = report.indexOf('|');
this.Fps = report.substring(head+1,end);
let num = Number(this.Fps)
if(num >= 54) {
this.Vue = true;
}
})
}
}
Row(){
Text('\n' + '\n' + '\n' + '\n'+ '\n' + '\n' + '\n' + '\n' + `测试结果:` + this.Fps + '帧' )
.fontColor(Color.White).fontSize('24fp')
}
}
}
}.width('100%').height('80%').backgroundColor(Color.Black)
.justifyContent(FlexAlign.SpaceEvenly)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Experience/Experience_index',
StepTips:this.StepTips,
content: this.specificNoParam,
name:$name,
Vue: $Vue,
StartEnable: $StartEnable,
Fps: $Fps
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022-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
......@@ -27,8 +27,8 @@ let path1 = path + '/Player';
let VarColor = [];
let ColorBackPath = path + '/PlayerColorBack.txt';
let txtPath = path1 + 'PlayerReport.txt';
let xmlPath =path1 + 'PlayerTest.xml';
let txtPath = path1 + '/PlayerReport.txt';
let xmlPath =path1 + '/PlayerTest.xml';
@Entry
@Component
......@@ -277,23 +277,23 @@ struct IndexPage {
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name","ActsPlayerTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("time", "");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", ignoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", testNum);
serializer.setAttributes("message", " ");
serializer.setAttributes("message", "");
serializer.setAttributes("modulename", "ActsPlayerTest");
for (let i = 0; i < title.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title[i]));
serializer.setAttributes("status", " ");
serializer.setAttributes("time", " ");
serializer.setAttributes("classname", " ");
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("result", String(result[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.endElement();
}
serializer.endElement();
......
......@@ -125,7 +125,7 @@ export struct CustomContainer {
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/' + displayName;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
......
......@@ -126,7 +126,7 @@ export struct CustomContainer {
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/' + displayName;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
......
......@@ -128,7 +128,7 @@ export struct CustomContainer {
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/' + displayName;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
......
......@@ -122,7 +122,7 @@ export struct CustomContainer {
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/' + displayName;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
......
......@@ -124,7 +124,7 @@ export struct CustomContainer {
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/' + displayName;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
......
......@@ -125,7 +125,7 @@ export struct CustomContainer {
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/' + displayName;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
......
......@@ -122,7 +122,7 @@ export struct CustomContainer {
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/' + displayName;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
......
......@@ -126,7 +126,7 @@ export struct CustomContainer {
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/' + displayName;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
......
/*
* 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 fileio from '@ohos.fileio';
import prompt from '@ohos.prompt';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
let path = globalThis.dir;
const TAG = '[Screenshot]';
@Component
export struct CustomContainer {
@Link FillColor: string;
@Link name: string;
Url : string = '';
title : string = '';
StepTips: string = '';
@BuilderParam content: () => void;
@Builder
PassBtn(text: Resource, isFullScreen: boolean) {
Button() {
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'Pass', title : this.name,
}
})
this.getScreen(isFullScreen);
prompt.showToast({
message: '通过', duration: 1000
});
})
}
@Builder
FailBtn(text: Resource, isFullScreen: boolean) {
Button(){
Image($r('app.media.ic_public_fail')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'Fail',title : this.name,
}
})
this.getScreen(isFullScreen);
prompt.showToast({
message: '失败', duration: 1000
});
})
}
build() {
Column() {
Row() {
Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'None',}
})
})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content();
Blank()
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true);
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(() =>{
AlertDialog.show(
{
title:'操作提示',
message: this.StepTips,
confirm:{
value:'OK',
action:()=>{
}
}
}
)
})
this.FailBtn($r('app.string.btn_fullscreen'), true);
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`);
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
};
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release();
try {
await fileio.write(fd, arrayBuffer);
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`);
}
await fileio.close(fd);
Logger.info(TAG, `write done`);
}
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
screenRect: { left: 0, top: 0, width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
displayId: 0
};
if (isFullScreen) {
screenshotOptions = {
rotation: 0
}
}
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`);
}
Logger.info(TAG, 'save callback');
this.savePicture(data, getContext(this) as any);
})
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`);
}
}
}
/*
* 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 prompt from '@ohos.prompt';
import fileio from '@ohos.fileio';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
let path = globalThis.dir;
const TAG = '[Screenshot]';
@Component
export struct CustomContainer {
@Link name : string;
title : string = '';
StepTips: string = '';
Url : string = '';
@Link StartEnable : boolean
@Link Vue : boolean;
@Link Fps : string;
@BuilderParam content: () => void;
@Builder
PassBtn(text: Resource, isFullScreen: boolean) {
if(this.Vue == false){
Button({stateEffect:this.Vue}) {
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey).opacity(0.4)
.onClick(()=>{
})
}
else{
Button({stateEffect:this.Vue}) {
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'Pass', title : this.name,
}
})
this.getScreen(isFullScreen);
prompt.showToast({
message: '通过', duration: 1000
});
})
}
}
@Builder
FailBtn(text: Resource, isFullScreen: boolean) {
Button(){
Image($r('app.media.ic_public_fail')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'Fail',title : this.name,
}
})
this.getScreen(isFullScreen);
prompt.showToast({
message: '失败', duration: 1000
});
})
}
build() {
Column() {
Row() {
Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black)
.onClick(()=>{
router.back({
url:this.Url,
params: {result : 'None',}
})
})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content();
Blank()
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true);
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(() =>{
AlertDialog.show({
title:'操作提示',
message: this.StepTips,
confirm:{
value:'OK',
action:()=>{
}
}
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true);
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`);
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
};
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
};
let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release();
try {
await fileio.write(fd, arrayBuffer);
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`);
}
await fileio.close(fd);
Logger.info(TAG, `write done`);
}
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
screenRect: { left: 0, top: 0, width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
displayId: 0
};
if (isFullScreen) {
screenshotOptions = {
rotation: 0
}
}
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`);
}
Logger.info(TAG, 'save callback');
this.savePicture(data, getContext(this) as any);
})
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`);
}
}
}
......@@ -29,6 +29,7 @@ let path2 = path + '/Audio';
let path3 = path + '/Camera';
let path4 = path + '/Player';
let path5 = path + '/Experience';
let picturePath = path + '/screenshot';
let ArkUIColorBackPath = path + '/ArkUIColorBack.txt';
let AudioColorBackPath = path + '/AudioColorBack.txt';
let CameraColorBackPath = path + '/CameraColorBack.txt';
......@@ -81,6 +82,7 @@ struct IndexPage {
fileio.mkdirSync(path3);
fileio.mkdirSync(path4);
fileio.mkdirSync(path5);
fileio.mkdirSync(picturePath);
let promise = preferences.put('index', 1);
promise.then(() => {
......@@ -198,6 +200,8 @@ struct IndexPage {
fileio.unlinkSync(CameraColorBackPath);
fileio.unlinkSync(PlayerColorBackPath);
fileio.unlinkSync(ExperienceColorBackPath);
fileio.rmdirSync(picturePath);
fileio.mkdirSync(picturePath);
fileio.openSync(TimePath, 0o100 | 0o2002, 0o664);
fileio.openSync(xmlPath, 0o100 | 0o2002, 0o664);
fileio.openSync(path11, 0o100 | 0o2002, 0o664);
......@@ -438,33 +442,33 @@ struct IndexPage {
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("tests", testNum);
serializer.setAttributes("ignored", ignoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("unavailable", "0");
serializer.setAttributes("productinfo", "{ }");
serializer.setAttributes("modules", " ");
serializer.setAttributes("runmodules", " ");
serializer.setAttributes("modules", "");
serializer.setAttributes("runmodules", "");
/*
* ArkUI
*/
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsArkUITest");
serializer.setAttributes("time", " ");
serializer.setAttributes("time", "");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", ArkuiFailNum);
serializer.setAttributes("ignored", ArkUIIgnoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", ArkuiTestNum);
serializer.setAttributes("message", " ");
serializer.setAttributes("message", "");
serializer.setAttributes("modulename", "ActsArkUITest");
for (let i = 0; i < title1.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title1[i]));
serializer.setAttributes("status", " ");
serializer.setAttributes("time", " ");
serializer.setAttributes("classname", " ");
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("result", String(result1[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.endElement();
}
serializer.endElement();
......@@ -473,23 +477,23 @@ struct IndexPage {
*/
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsAudioTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("time", "");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", audioFailNum);
serializer.setAttributes("ignored", AudioIgnoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", audioTestNum);
serializer.setAttributes("message", " ");
serializer.setAttributes("message", "");
serializer.setAttributes("modulename", "ActsAudioTest");
for (let i = 0; i < title2.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title2[i]));
serializer.setAttributes("status", " ");
serializer.setAttributes("time", " ");
serializer.setAttributes("classname", " ");
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("result", String(result2[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.endElement();
}
serializer.endElement();
......@@ -498,23 +502,23 @@ struct IndexPage {
*/
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsCameraTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("time", "");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", cameraFailNum);
serializer.setAttributes("ignored", CameraIgnoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", cameraTestNum);
serializer.setAttributes("message", " ");
serializer.setAttributes("message", "");
serializer.setAttributes("modulename", "ActsCameraTest");
for (let i = 0; i < title2.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title3[i]));
serializer.setAttributes("status", " ");
serializer.setAttributes("time", " ");
serializer.setAttributes("classname", " ");
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("result", String(result3[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.endElement();
}
serializer.endElement();
......@@ -523,23 +527,23 @@ struct IndexPage {
*/
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsPlayerTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("time", "");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", playerFailNum);
serializer.setAttributes("ignored", PlayerIgnoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", playerTestNum);
serializer.setAttributes("message", " ");
serializer.setAttributes("message", "");
serializer.setAttributes("modulename", "ActsPlayerTest");
for (let i = 0; i < title2.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title4[i]));
serializer.setAttributes("status", " ");
serializer.setAttributes("time", " ");
serializer.setAttributes("classname", " ");
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("result", String(result4[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.endElement();
}
serializer.endElement();
......@@ -548,23 +552,23 @@ struct IndexPage {
*/
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsExperienceTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("time", "");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", experienceFailNum);
serializer.setAttributes("ignored", ExperienceIgnoreNum);
serializer.setAttributes("ignored", "0");
serializer.setAttributes("tests", experienceTestNum);
serializer.setAttributes("message", " ");
serializer.setAttributes("message", "");
serializer.setAttributes("modulename", "ActsExperienceTest");
for (let i = 0; i < title2.length; i++) {
serializer.startElement("testcase");
serializer.setAttributes("name", String(title5[i]));
serializer.setAttributes("status", " ");
serializer.setAttributes("time", " ");
serializer.setAttributes("classname", " ");
serializer.setAttributes("status", "");
serializer.setAttributes("time", "");
serializer.setAttributes("classname", "");
serializer.setAttributes("result", String(result5[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.setAttributes("level", "");
serializer.setAttributes("message", "");
serializer.endElement();
}
serializer.endElement();
......
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Copyright (c) 2022-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
......
......@@ -53,6 +53,12 @@
},
{
"name": "ohos.permission.CAMERA"
},
{
"name": "ohos.permission.MICROPHONE"
},
{
"name": "ohos.permission.START_INVISIBLE_ABILITY"
}
]
}
......
......@@ -38,6 +38,7 @@
"pages/Player/Player_index",
"pages/Player/ScrollListTest",
"pages/Experience/Experience_index",
"pages/Experience/ScrollListTest"
"pages/Experience/PhotoFps",
"pages/Experience/DeskFps"
]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册