Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
c931f334
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c931f334
编写于
3月 13, 2023
作者:
O
openharmony_ci
提交者:
Gitee
3月 13, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7773 validator新增camera模块,预置audio模块模板合入1018分支
Merge pull request !7773 from 田文哲/monthly_20221018
上级
a98dd79a
9dbc2f54
变更
53
展开全部
隐藏空白更改
内联
并排
Showing
53 changed file
with
3475 addition
and
2180 deletion
+3475
-2180
validator/acts_validator/signature/openharmony_sx.p7b
validator/acts_validator/signature/openharmony_sx.p7b
+0
-0
validator/acts_validator/src/main/ets/MainAbility/MainAbility.ts
...or/acts_validator/src/main/ets/MainAbility/MainAbility.ts
+1
-1
validator/acts_validator/src/main/ets/pages/ArkUI/ArkUI_index.ets
...r/acts_validator/src/main/ets/pages/ArkUI/ArkUI_index.ets
+86
-18
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasFont.ets
...or/acts_validator/src/main/ets/pages/ArkUI/CanvasFont.ets
+1
-1
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasImageSmoothingEnabled.ets
.../src/main/ets/pages/ArkUI/CanvasImageSmoothingEnabled.ets
+0
-75
validator/acts_validator/src/main/ets/pages/ArkUI/PinchGestureTest.ets
...s_validator/src/main/ets/pages/ArkUI/PinchGestureTest.ets
+1
-1
validator/acts_validator/src/main/ets/pages/ArkUI/RotationGestureTest.ets
...alidator/src/main/ets/pages/ArkUI/RotationGestureTest.ets
+1
-1
validator/acts_validator/src/main/ets/pages/Audio/Audio_index.ets
...r/acts_validator/src/main/ets/pages/Audio/Audio_index.ets
+342
-0
validator/acts_validator/src/main/ets/pages/Audio/ScrollListTest.ets
...cts_validator/src/main/ets/pages/Audio/ScrollListTest.ets
+52
-0
validator/acts_validator/src/main/ets/pages/Camera/CameraFormat.ets
...acts_validator/src/main/ets/pages/Camera/CameraFormat.ets
+117
-0
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation0.ets
...alidator/src/main/ets/pages/Camera/CameraOrientation0.ets
+96
-0
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation180.ets
...idator/src/main/ets/pages/Camera/CameraOrientation180.ets
+95
-0
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation270.ets
...idator/src/main/ets/pages/Camera/CameraOrientation270.ets
+95
-0
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation90.ets
...lidator/src/main/ets/pages/Camera/CameraOrientation90.ets
+95
-0
validator/acts_validator/src/main/ets/pages/Camera/CameraVideo.ets
.../acts_validator/src/main/ets/pages/Camera/CameraVideo.ets
+96
-0
validator/acts_validator/src/main/ets/pages/Camera/Camera_index.ets
...acts_validator/src/main/ets/pages/Camera/Camera_index.ets
+346
-0
validator/acts_validator/src/main/ets/pages/Experience/Experience_index.ets
...idator/src/main/ets/pages/Experience/Experience_index.ets
+340
-296
validator/acts_validator/src/main/ets/pages/Experience/ScrollListTest.ets
...alidator/src/main/ets/pages/Experience/ScrollListTest.ets
+51
-0
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback1.ets
...ain/ets/pages/MediaLibrary/startImagePreviewCallback1.ets
+0
-60
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback2.ets
...ain/ets/pages/MediaLibrary/startImagePreviewCallback2.ets
+0
-61
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback3.ets
...ain/ets/pages/MediaLibrary/startImagePreviewCallback3.ets
+0
-63
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback5.ets
...ain/ets/pages/MediaLibrary/startImagePreviewCallback5.ets
+0
-59
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback6.ets
...ain/ets/pages/MediaLibrary/startImagePreviewCallback6.ets
+0
-64
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback7.ets
...ain/ets/pages/MediaLibrary/startImagePreviewCallback7.ets
+0
-59
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewPromise3.ets
...main/ets/pages/MediaLibrary/startImagePreviewPromise3.ets
+0
-63
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectCallback1.ets
...main/ets/pages/MediaLibrary/startMediaSelectCallback1.ets
+0
-59
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectCallback2.ets
...main/ets/pages/MediaLibrary/startMediaSelectCallback2.ets
+0
-60
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectCallback3.ets
...main/ets/pages/MediaLibrary/startMediaSelectCallback3.ets
+0
-60
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectCallback4.ets
...main/ets/pages/MediaLibrary/startMediaSelectCallback4.ets
+0
-60
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectPromise1.ets
.../main/ets/pages/MediaLibrary/startMediaSelectPromise1.ets
+0
-58
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectPromise2.ets
.../main/ets/pages/MediaLibrary/startMediaSelectPromise2.ets
+0
-58
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectPromise3.ets
.../main/ets/pages/MediaLibrary/startMediaSelectPromise3.ets
+0
-58
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectPromise4.ets
.../main/ets/pages/MediaLibrary/startMediaSelectPromise4.ets
+0
-59
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetCallback1.ets
.../main/ets/pages/MediaLibrary/storeMediaAssetCallback1.ets
+0
-88
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetCallback2.ets
.../main/ets/pages/MediaLibrary/storeMediaAssetCallback2.ets
+0
-88
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetCallback3.ets
.../main/ets/pages/MediaLibrary/storeMediaAssetCallback3.ets
+0
-88
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetCallback4.ets
.../main/ets/pages/MediaLibrary/storeMediaAssetCallback4.ets
+0
-88
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetPromise1.ets
...c/main/ets/pages/MediaLibrary/storeMediaAssetPromise1.ets
+0
-87
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetPromise2.ets
...c/main/ets/pages/MediaLibrary/storeMediaAssetPromise2.ets
+0
-86
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetPromise3.ets
...c/main/ets/pages/MediaLibrary/storeMediaAssetPromise3.ets
+0
-86
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetPromise4.ets
...c/main/ets/pages/MediaLibrary/storeMediaAssetPromise4.ets
+0
-86
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetPromise5.ets
...c/main/ets/pages/MediaLibrary/storeMediaAssetPromise5.ets
+0
-86
validator/acts_validator/src/main/ets/pages/Player/Player_index.ets
...acts_validator/src/main/ets/pages/Player/Player_index.ets
+341
-0
validator/acts_validator/src/main/ets/pages/Player/ScrollListTest.ets
...ts_validator/src/main/ets/pages/Player/ScrollListTest.ets
+51
-0
validator/acts_validator/src/main/ets/pages/common/CameraOrientation.ets
...validator/src/main/ets/pages/common/CameraOrientation.ets
+165
-0
validator/acts_validator/src/main/ets/pages/index.ets
validator/acts_validator/src/main/ets/pages/index.ets
+330
-66
validator/acts_validator/src/main/ets/pages/model/CameraService.ts
.../acts_validator/src/main/ets/pages/model/CameraService.ts
+326
-0
validator/acts_validator/src/main/ets/pages/model/DateTimeUtil.ts
...r/acts_validator/src/main/ets/pages/model/DateTimeUtil.ts
+9
-1
validator/acts_validator/src/main/ets/pages/model/FlushData.ets
...tor/acts_validator/src/main/ets/pages/model/FlushData.ets
+139
-0
validator/acts_validator/src/main/ets/pages/model/MediaUtils.ts
...tor/acts_validator/src/main/ets/pages/model/MediaUtils.ts
+180
-0
validator/acts_validator/src/main/ets/pages/model/RecordModel.ts
...or/acts_validator/src/main/ets/pages/model/RecordModel.ts
+97
-0
validator/acts_validator/src/main/module.json
validator/acts_validator/src/main/module.json
+9
-6
validator/acts_validator/src/main/resources/base/profile/main_pages.json
...validator/src/main/resources/base/profile/main_pages.json
+13
-30
未找到文件。
validator/acts_validator/signature/openharmony_sx.p7b
浏览文件 @
c931f334
无法预览此类型文件
validator/acts_validator/src/main/ets/MainAbility/MainAbility.ts
浏览文件 @
c931f334
...
@@ -18,7 +18,7 @@ export default class MainAbility extends Ability {
...
@@ -18,7 +18,7 @@ export default class MainAbility extends Ability {
console
.
log
(
"
[Demo] MainAbility onWindowStageCreate
"
)
console
.
log
(
"
[Demo] MainAbility onWindowStageCreate
"
)
let
AtManager
=
abilityAccessCtrl
.
createAtManager
();
let
AtManager
=
abilityAccessCtrl
.
createAtManager
();
AtManager
.
requestPermissionsFromUser
(
this
.
context
,[
"
ohos.permission.READ_MEDIA
"
,
"
ohos.permission.WRITE_MEDIA
"
,
AtManager
.
requestPermissionsFromUser
(
this
.
context
,[
"
ohos.permission.READ_MEDIA
"
,
"
ohos.permission.WRITE_MEDIA
"
,
"
ohos.permission.CAPTURE_SCREEN
"
,
"
ohos.permission.INTERNET
"
]).
then
(()
=>
{})
"
ohos.permission.CAPTURE_SCREEN
"
,
"
ohos.permission.INTERNET
"
,
"
ohos.permission.CAMERA
"
]).
then
(()
=>
{})
windowStage
.
loadContent
(
"
pages/index
"
,
(
err
,
data
)
=>
{
windowStage
.
loadContent
(
"
pages/index
"
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
if
(
err
.
code
)
{
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
Failed to load the content. Cause:
'
+
JSON
.
stringify
(
err
));
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/ArkUI_index.ets
浏览文件 @
c931f334
...
@@ -18,24 +18,27 @@ import fileio from '@ohos.fileio';
...
@@ -18,24 +18,27 @@ import fileio from '@ohos.fileio';
import xml from '@ohos.xml';
import xml from '@ohos.xml';
import fileIO from '@ohos.fileio';
import fileIO from '@ohos.fileio';
import util from '@ohos.util';
import util from '@ohos.util';
import data_preferences from '@ohos.data.preferences';
const TAG = 'ParseXML';
const TAG = 'ParseXML';
let path = globalThis.dir;
let path = globalThis.dir;
let path1;
let path1 = path + '/ArkUI';
path1 = path + '/ArkUI';
let VarColor = [];
let ColorBackPath = path + '/ArkUIColorBack.txt';
let txtPath = path1 + 'ArkUIReport.txt';
let xmlPath =path1 + 'ArkUITest.xml';
@Entry
@Entry
@Component
@Component
struct IndexPage {
struct IndexPage {
@State BackColor: string = '#ff808080';
@State ClearAll : boolean = false;
@State ClearAll : boolean = false;
private current : number = undefined;
private current : number = undefined;
@State count : number = 0;
@State count : number = 0;
@State result : string = '';
@State result : string = '';
@State TEST : number = 0;
private TestCaseList = [
private TestCaseList = [
{title:'Scroll
List',uri:'pages/ArkUI/ScrollListTest'},
{title:'Scroll
ing
List',uri:'pages/ArkUI/ScrollListTest'},
{title:'TouchMove',uri:'pages/ArkUI/TouchMoveTest'},
{title:'TouchMove',uri:'pages/ArkUI/TouchMoveTest'},
{title:'PinchGesture',uri:'pages/ArkUI/PinchGestureTest'},
{title:'PinchGesture',uri:'pages/ArkUI/PinchGestureTest'},
{title:'RotationGesture',uri:'pages/ArkUI/RotationGestureTest'},
{title:'RotationGesture',uri:'pages/ArkUI/RotationGestureTest'},
...
@@ -58,30 +61,93 @@ struct IndexPage {
...
@@ -58,30 +61,93 @@ struct IndexPage {
{title:'CanvasShadowColor',uri:'pages/ArkUI/CanvasShadowColor'},
{title:'CanvasShadowColor',uri:'pages/ArkUI/CanvasShadowColor'},
{title:'CanvasShadowOffsetX',uri:'pages/ArkUI/CanvasShadowOffsetX'},
{title:'CanvasShadowOffsetX',uri:'pages/ArkUI/CanvasShadowOffsetX'},
{title:'CanvasShadowOffsetY',uri:'pages/ArkUI/CanvasShadowOffsetY'},
{title:'CanvasShadowOffsetY',uri:'pages/ArkUI/CanvasShadowOffsetY'},
{title:'CanvasImageSmoothingEnabled',uri:'pages/ArkUI/CanvasImageSmoothingEnabled'},
]
]
@State ColorObject : string[] = ['#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080',
@State ColorObject : string[] = VarColor;
'#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080',
async onPageShow(){
'#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080']
let Test = null;
onPageShow(){
let context =null;
context = globalThis.getContext();
let preferences;
let promise = data_preferences.getPreferences(context,'mystore');
await promise.then((object) => {
preferences = object;
});
promise = preferences.get('ArkUI', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'ArkUI'. Data: " + data);
});
if(Test != 1) {
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString();
fileio.writeSync(fd,log);
}
fileio.closeSync(fd);
}
promise = preferences.put('ArkUI', 1);
promise.then(() => {
console.info("Succeeded in putting value of 'ArkUI'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
this.TEST = Test;
let opt = fileio.openSync(ColorBackPath, 0o100 | 0o2002, 0o664);
let buff = new ArrayBuffer(40960);
fileio.readSync(opt,buff);
let ColorBack = String.fromCharCode.apply(null, new Uint8Array(buff));
let TestList = ColorBack.split(';');
for (let i = 0; i < Math.floor(TestList.length / 2); i++) {
VarColor[i] = TestList[i*2+1];
}
fileio.closeSync(opt);
if (this.count === 1){
if (this.count === 1){
this.result = router.getParams()['result'];
this.result = router.getParams()['result'];
let titles = router.getParams()['title'];
let titles = router.getParams()['title'];
let name1 = '刚刚点进了哪个用例:'+ titles;
let name1 = '刚刚点进了哪个用例:'+ titles;
let results = this.result;
let results = this.result;
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 11;
let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'Pass'){
if (this.result === 'Pass'){
this.ColorObject[this.current] = '#ff008000';
this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = ColorBack.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles)
filewrite(name1,results,titles)
}
}
else if (this.result === 'Fail'){
else if (this.result === 'Fail'){
this.ColorObject[this.current] = '#ffff0000';
this.ColorObject[this.current] = '#ffff0000';
let Log = (titles+';'+'#ffff0000'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = ColorBack.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles);
filewrite(name1,results,titles);
}
}
else if (this.result === 'None'){
else if (this.result === 'None'){
this.ColorObject[this.current] = this.ColorObject[this.current];
this.ColorObject[this.current] = this.ColorObject[this.current];
}
}
}
}
}
}
build(){
build(){
Column(){
Column(){
...
@@ -164,8 +230,7 @@ struct IndexPage {
...
@@ -164,8 +230,7 @@ struct IndexPage {
ListItem(){
ListItem(){
Row(){
Row(){
Text(item.title).fontSize(16).fontColor(Color.Black)
Text(item.title).fontSize(16).fontColor(Color.Black)
Text(this.BackColor.toString()).visibility(Visibility.None)
}.width('100%').height(50).alignItems(VerticalAlign.Center).backgroundColor(this.count===0&&this.TEST===0?'#ff808080':this.ColorObject[index])
}.width('100%').height(50).alignItems(VerticalAlign.Center).backgroundColor(this.ColorObject[index])
.onClick(( )=>{
.onClick(( )=>{
this.count = 1;
this.count = 1;
this.ClearAll=false;
this.ClearAll=false;
...
@@ -182,6 +247,11 @@ struct IndexPage {
...
@@ -182,6 +247,11 @@ struct IndexPage {
ClearText(){
ClearText(){
fileio.rmdirSync(path1);
fileio.rmdirSync(path1);
fileio.mkdirSync(path1);
fileio.mkdirSync(path1);
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString();
fileio.writeSync(fd,log);
}
}
}
ReadTextParseXml(){
ReadTextParseXml(){
let ReportPath = path1 + '/ArkUIReport.txt';
let ReportPath = path1 + '/ArkUIReport.txt';
...
@@ -252,7 +322,6 @@ struct IndexPage {
...
@@ -252,7 +322,6 @@ struct IndexPage {
let that = new util.TextDecoder('utf-8');
let that = new util.TextDecoder('utf-8');
let array = new Uint8Array(arrayBuffer);
let array = new Uint8Array(arrayBuffer);
let serializerStr = that.decode(array);
let serializerStr = that.decode(array);
let xmlPath = path1 + "/ArkUITest.xml";
console.info(xmlPath);
console.info(xmlPath);
try{
try{
console.error(TAG,"write xmlPath =" +xmlPath);
console.error(TAG,"write xmlPath =" +xmlPath);
...
@@ -268,8 +337,7 @@ struct IndexPage {
...
@@ -268,8 +337,7 @@ struct IndexPage {
}
}
}
}
function filewrite(name1,results,titles){
function filewrite(name1,results,titles){
let txtpath = path1 + '/ArkUIReport.txt';
let fd = fileio.openSync(txtPath, 0o100 | 0o2002, 0o664);
let fd = fileio.openSync(txtpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
let buf = new ArrayBuffer(4096);
let RD = fileio.readSync(fd,buf);
let RD = fileio.readSync(fd,buf);
console.info("RRRRRRRRRRd"+RD);
console.info("RRRRRRRRRRd"+RD);
...
@@ -283,13 +351,13 @@ function filewrite(name1,results,titles){
...
@@ -283,13 +351,13 @@ function filewrite(name1,results,titles){
}
}
else if (Index != -1){
else if (Index != -1){
let key = report.substring(Index,Index+number);
let key = report.substring(Index,Index+number);
let FD = fileio.openSync(txt
p
ath, 0o102, 0o666);
let FD = fileio.openSync(txt
P
ath, 0o102, 0o666);
report = report.replace(key,Log);
report = report.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let rd = fileio.readSync(FD,buffer);
let Report = report.substring(0,rd);
let Report = report.substring(0,rd);
fileio.closeSync(FD);
fileio.closeSync(FD);
let Fd = fileio.openSync(txt
p
ath, 0o102, 0o666);
let Fd = fileio.openSync(txt
P
ath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
fileio.writeSync(Fd,Report);
}
}
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasFont.ets
浏览文件 @
c931f334
...
@@ -20,7 +20,7 @@ struct SetCircle {
...
@@ -20,7 +20,7 @@ struct SetCircle {
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
@State FillColor: string = '#FF000000';
@State FillColor: string = '#FF000000';
@State name: string = 'CanvasF
illStyle
';
@State name: string = 'CanvasF
ont
';
@State StepTips: string = '操作步骤:点击不同的字体控件'+'\n'+'预期结果:原本默认字体会改变';
@State StepTips: string = '操作步骤:点击不同的字体控件'+'\n'+'预期结果:原本默认字体会改变';
@State Vue: boolean = false;
@State Vue: boolean = false;
async aboutToAppear(){
async aboutToAppear(){
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasImageSmoothingEnabled.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 {CustomContainer} from '../common/CanvasCustomContainer2';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
private img:ImageBitmap = new ImageBitmap("src/main/resources/base/media/flower.jpg");
@State FillColor: string = '#FF000000';
@State X: number = 0;
@State name: string = 'CanvasImageSmoothingEnabled';
@State StepTips: string = '操作步骤:点击不同的控件'+'\n'+'预期结果:切换平滑过渡效果';
@State Vue: boolean = false;
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('True').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300);
this.context.imageSmoothingEnabled = true;
this.context.drawImage( this.img,0,0,400,200);
this.Vue = true;
})
Text('False').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300);
this.context.imageSmoothingEnabled = false;
this.context.drawImage( this.img,0,0,400,200);
this.Vue = true;
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.imageSmoothingEnabled = false;
this.context.drawImage( this.img,0,0,200,200);
})
}.width('100%').height('60%')
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url: 'pages/ArkUI/ArkUI_index',
StepTips: this.StepTips,
content: this.specificNoParam,
FillColor: $FillColor,
X: $X,
name: $name,
Vue: $Vue,
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/ArkUI/PinchGestureTest.ets
浏览文件 @
c931f334
...
@@ -18,7 +18,7 @@ import FirstDialog from '../model/FirstDialog';
...
@@ -18,7 +18,7 @@ import FirstDialog from '../model/FirstDialog';
@Component
@Component
struct PinchGuestureTest {
struct PinchGuestureTest {
@State X: number = 1;
@State X: number = 1;
@State name: string = 'PinchG
u
esture';
@State name: string = 'PinchGesture';
@State StepTips: string = '操作步骤:用手指触摸捏合图片(至少2根手指,最大为5指)'+'\n'+'预期结果:图片能够被正常捏合放缩';
@State StepTips: string = '操作步骤:用手指触摸捏合图片(至少2根手指,最大为5指)'+'\n'+'预期结果:图片能够被正常捏合放缩';
@State Vue: boolean = false;
@State Vue: boolean = false;
async aboutToAppear(){
async aboutToAppear(){
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/RotationGestureTest.ets
浏览文件 @
c931f334
...
@@ -18,7 +18,7 @@ import FirstDialog from '../model/FirstDialog';
...
@@ -18,7 +18,7 @@ import FirstDialog from '../model/FirstDialog';
@Component
@Component
struct RotationGuestureTest {
struct RotationGuestureTest {
@State X: number = 0;
@State X: number = 0;
@State name: string = 'RotationG
u
esture';
@State name: string = 'RotationGesture';
@State StepTips: string = '操作步骤:用至少两根手指旋转图像(最多五根手指)'+'\n'+'预期结果:图片能够正常旋转';
@State StepTips: string = '操作步骤:用至少两根手指旋转图像(最多五根手指)'+'\n'+'预期结果:图片能够正常旋转';
@State Vue: boolean = false;
@State Vue: boolean = false;
async aboutToAppear(){
async aboutToAppear(){
...
...
validator/acts_validator/src/main/ets/pages/Audio/Audio_index.ets
0 → 100644
浏览文件 @
c931f334
/*
* 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 prompt from '@ohos.prompt';
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import xml from '@ohos.xml';
import fileIO from '@ohos.fileio';
import util from '@ohos.util';
import data_preferences from '@ohos.data.preferences';
const TAG = 'ParseXML';
let path = globalThis.dir;
let path1 = path + '/Audio';
let VarColor = [];
let ColorBackPath = path + '/AudioColorBack.txt';
let txtPath = path1 + 'AudioReport.txt';
let xmlPath =path1 + 'AudioTest.xml';
@Entry
@Component
struct IndexPage {
@State ClearAll : boolean = false;
private current : number = undefined;
@State count : number = 0;
@State result : string = '';
@State TEST : number = 0;
private TestCaseList = [
{title:'ScrollingList',uri:'pages/Audio/ScrollListTest'},
]
@State ColorObject : string[] = VarColor;
async onPageShow(){
let Test = null;
let context =null;
context = globalThis.getContext();
let preferences;
let promise = data_preferences.getPreferences(context,'mystore');
await promise.then((object) => {
preferences = object;
});
promise = preferences.get('Audio', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'Audio'. Data: " + data);
});
if(Test != 1) {
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString();
fileio.writeSync(fd,log);
}
fileio.closeSync(fd);
}
promise = preferences.put('Audio', 1);
promise.then(() => {
console.info("Succeeded in putting value of 'Audio'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
this.TEST = Test;
let opt = fileio.openSync(ColorBackPath, 0o100 | 0o2002, 0o664);
let buff = new ArrayBuffer(40960);
fileio.readSync(opt,buff);
let ColorBack = String.fromCharCode.apply(null, new Uint8Array(buff));
let TestList = ColorBack.split(';');
for (let i = 0; i < Math.floor(TestList.length / 2); i++) {
VarColor[i] = TestList[i*2+1];
}
fileio.closeSync(opt);
if (this.count === 1){
this.result = router.getParams()['result'];
let titles = router.getParams()['title'];
let name1 = '刚刚点进了哪个用例:'+ titles;
let results = this.result;
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 11;
let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'Pass'){
this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = ColorBack.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles)
}
else if (this.result === 'Fail'){
this.ColorObject[this.current] = '#ffff0000';
let Log = (titles+';'+'#ffff0000'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = ColorBack.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles);
}
else if (this.result === 'None'){
this.ColorObject[this.current] = this.ColorObject[this.current];
}
}
}
build(){
Column(){
Row() {
Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black)
.onClick(() => {
router.back();
})
Row(){
Text('Audio SubSystem')
.fontColor(Color.White)
.fontSize('22fp')
}.justifyContent(FlexAlign.SpaceAround).backgroundColor(Color.Black)
Row() {
Button(){
Image($r('app.media.ic_public_delete'))
.width('30vp')
.height('30vp')
}.backgroundColor(Color.Black)
.onClick(() => {
AlertDialog.show(
{
message: "是否删除所有记录",
primaryButton: {
value: 'Yes',
action: () => {
this.ClearAll = true;
this.ColorObject.forEach((value, index) => {
this.ColorObject[index] = '#ff808080';
});
this.ClearText();
prompt.showToast({
message: '结果已删除', duration: 1000
});
}
},
secondaryButton: {
value: 'No',
action: () => {
}
},
cancel: () => {
}
}
)
})
Button(){
Image($r('app.media.ic_public_save'))
.width('30vp')
.height('30vp')
.margin({ left: 30 })
}.backgroundColor(Color.Black)
.onClick(() => {
this.ReadTextParseXml();
AlertDialog.show({
message: "报告已生成,如需查看通过命令行输入'hdc_std file recv /data/app/el2/100/base/com.example.actsvalidator/haps/entry/files/Audio/AudioTest.xml -本地路径'",
confirm:{
value:'OK',
action:()=>{
prompt.showToast({
message: '报告已生成', duration: 1000
})
}
},
cancel: () => {
prompt.showToast({
message: '报告已生成', duration: 1000
});
}
})
})
}
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%').backgroundColor(Color.Black)
List({space:5}){
ForEach(this.TestCaseList,(item,index) => {
ListItem(){
Row(){
Text(item.title).fontSize(16).fontColor(Color.Black)
}.width('100%').height(50).alignItems(VerticalAlign.Center).backgroundColor(this.count===0&&this.TEST===0?'#ff808080':this.ColorObject[index])
.onClick(( )=>{
this.count = 1;
this.ClearAll=false;
this.current = index;
router.push({
url: item.uri,
})
})
}
},item => item.title)
}.width('100%').height('92%')
}.width('100%').height('100%').backgroundColor(Color.Black)
}
ClearText(){
fileio.rmdirSync(path1);
fileio.mkdirSync(path1);
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString();
fileio.writeSync(fd,log);
}
}
ReadTextParseXml(){
let ReportPath = path1 + '/AudioReport.txt';
let dir = fileio.opendirSync(path1);
console.info("ssssss"+dir);
while (dir) {
let OP = fileio.openSync(ReportPath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(40960);
let RD = fileio.readSync(OP,buf);
console.info("ddddd"+RD);
let report;
function ab2str(buf) {
return report = String.fromCharCode.apply(null,new Uint8Array(buf));
}
ab2str(buf);
let str1 = report.split(";");
let title = [];
let result = [];
for(let i=0; i<Math.floor(str1.length/2); i++){
title[i] = str1[i*2];
result[i] = str1[i*2+1];
}
let FailIndex = report.indexOf('Fail');
let FailNum = 0;
while (FailIndex != -1) {
console.log(FailIndex);
FailNum++;
FailIndex = report.indexOf('Fail',FailIndex + 1);
}
let failNum = (FailNum).toString();
let PassIndex = report.indexOf('Pass');
let PassNum = 0;
while (PassIndex != -1) {
console.log(PassIndex);
PassNum++;
PassIndex = report.indexOf('Pass',PassIndex + 1);
}
let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString();
let ignoreNum = (24-TestNum).toString();
let arrayBuffer = new ArrayBuffer(40960);
let bufView = new DataView(arrayBuffer);
let serializer = new xml.XmlSerializer(bufView);
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name","ActsAudioTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", ignoreNum);
serializer.setAttributes("tests", testNum);
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("result", String(result[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.endElement();
}
serializer.endElement();
let that = new util.TextDecoder('utf-8');
let array = new Uint8Array(arrayBuffer);
let serializerStr = that.decode(array);
console.info(xmlPath);
try{
console.error(TAG,"write xmlPath =" +xmlPath);
var xmlfd = fileIO.openSync(xmlPath, 0o102, 0o666);
fileIO.writeSync(xmlfd,serializerStr);
}catch(err){
console.error(TAG,"read xmlPath =" + xmlPath + "error:" + err);
}finally{
fileIO.closeSync(xmlfd);
}
return;
}
}
}
function filewrite(name1,results,titles){
let fd = fileio.openSync(txtPath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
let RD = fileio.readSync(fd,buf);
console.info("RRRRRRRRRRd"+RD);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 6;
let Index = report.indexOf(WriteTitle);
let Log = (titles+";"+results+";").toString();
if (Index == -1){
fileio.writeSync(fd,Log);
}
else if (Index != -1){
let key = report.substring(Index,Index+number);
let FD = fileio.openSync(txtPath, 0o102, 0o666);
report = report.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = report.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(txtPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/
MediaLibrary/startImagePreviewPromise1
.ets
→
validator/acts_validator/src/main/ets/pages/
Audio/ScrollListTest
.ets
浏览文件 @
c931f334
/*
/*
* 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");
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import {CustomContainer} from '../common/CustomContainer';
import FirstDialog from '../model/FirstDialog';
import FirstDialog from '../model/FirstDialog';
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct CustomContainerUser {
@State FillColor: string = '#FF000000';
private listArr: number[] = Array.from(new Array(50).keys());
@State name: string = 'startImagePreviewPromise1';
@State name: string = 'ScrollingList';
@State StepTips: string = '测试步骤:点击“点击预览”按钮' + '\n' + '预期结果:可以成功预览到一张图片';
@State StepTips: string = '操作步骤:滑动列表观察是否能正常滑动'+'\n'+'预期结果:列表滑动正常';
async aboutToAppear(){
@State Vue: boolean = false;
await FirstDialog.ChooseDialog(this.StepTips,this.name);
async aboutToAppear(){
}
await FirstDialog.ChooseDialog(this.StepTips,this.name);
@Builder specificNoParam() {
this.Vue = true;
Column() {
}
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
@Builder specificNoParam() {
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
Column() {
.onClick(() => {
List() {
let TAG = 'startImagePreviewPromise1';
ForEach(this.listArr,(item:any,index:number) => {
let images = [
ListItem() {
"datashare:///media/image/3",
Text('Item #' + (index + 1)).width('100%').height(50).fontSize(16).fontColor(Color.White).margin({left:'10vp'})
];
}
let index = 1;
},index => index)
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, index).then(() => {
}.height('100%').width('100%').divider({strokeWidth:1,color:Color.Grey})
console.log(TAG + "Succeeded in previewing the images.");
}.height('83%').width('100%')
}).catch((err) => {
}
console.log(TAG + "An error occurred when previewing the images." + JSON.stringify(err));
build() {
});
Column() {
})
CustomContainer({
}
title: this.name,
}.width('100%').height('80%').backgroundColor(Color.White)
Url: 'pages/Audio/Audio_index',
}
StepTips: this.StepTips,
build() {
content: this.specificNoParam.bind(this),
Column() {
name: $name,
CustomContainer({
Vue: $Vue,
title: this.name,
})
Url: 'pages/MediaLibrary/MediaLibrary_index',
}.width('100%').height('100%').backgroundColor(Color.Black)
StepTips: this.StepTips,
}
content: this.specificNoParam,
}
FillColor: $FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
validator/acts_validator/src/main/ets/pages/Camera/CameraFormat.ets
0 → 100644
浏览文件 @
c931f334
/*
* 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 camera from '@ohos.multimedia.camera'
import Logger from '../model/Logger'
import CameraService from '../model/CameraService'
import {CustomContainer} from '../common/CameraOrientation';
import FirstDialog from '../model/FirstDialog';
const CameraMode = {
MODE_PHOTO: 0, // 拍照模式
MODE_VIDEO: 1 // 录像模式
}
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'CameraFormat';
@State StepTips: string = '测试目的:用于测试相机预览和拍照旋转能力\n-左侧显示给定旋转角度后的预览窗口\n-右侧显示拍照后的图片\n-对于前置摄像头会有镜像效果'+'\n'+'预期结果:拍照图片与预览窗口的画面一致';
private tag: string = 'qlw'
private mXComponentController: XComponentController = new XComponentController()
@State surfaceId: number = 0;
private x: number = 0;
@State curModel: number = CameraMode.MODE_PHOTO
@State cameraDeviceIndex: number = 0
@State imageRotationValue: number = camera.ImageRotation.ROTATION_90
@State qualityLevelValue: number = camera.QualityLevel.QUALITY_LEVEL_LOW
@State photoUri: string = undefined
@State Vue: boolean = false
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
handleTakePicture = (photoUri: string) => {
this.photoUri = photoUri
Logger.info(this.tag, `takePicture end, photoUri: ${this.photoUri}`)
}
@Builder specificNoParam() {
Column() {
}
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Camera/Camera_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name: $name,
Vue: $Vue
}).height('30%').width('100%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 10, surfaceHeight: 10 })
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.curModel = CameraMode.MODE_PHOTO
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
})
.height('40%')
.width('40%')
Text('Camera Preview').fontSize('20fp')
Text('Camera').fontSize(20)
// Select(qualityLevel)
// .selected(2)
// .value('请选择')
// .font({ size: 20, weight: 20, family: 'serif', style: FontStyle.Normal })
// .selectedOptionFont({ size: 20, weight: 20, family: 'serif', style: FontStyle.Normal })
// .optionFont({ size: 20, weight: 40, family: 'serif', style: FontStyle.Normal })
// .onSelect((index: number, value: string) => {
// console.info("Select:" + index)
// console.info("Select qualityLevelValue:" + value)
// this.qualityLevelValue = Number(value)
// })
Button('NEXT', {
type: ButtonType.Normal,
stateEffect: true
}).borderRadius(8).backgroundColor(0x317aff).width('20%').onClick(() => {
CameraService.takePicture(this.imageRotationValue, this.qualityLevelValue)
CameraService.setTakePictureCallback(this.handleTakePicture.bind(this))
this.Vue = true
})
}.width('100%').height('70%').backgroundColor(Color.White)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
//@CustomDialog
//struct CustomDialogExample {
// @Link textValue: string
// @Link inputValue: string
// @Link qualityLevelValue: number
// @Link imageRotationValue: number
// @Link imageResolutionValue: string
// controller: CustomDialogController
// cancel: () => void
// confirm: () => void
//}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation0.ets
0 → 100644
浏览文件 @
c931f334
/*
* 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 camera from '@ohos.multimedia.camera'
import Logger from '../model/Logger'
import CameraService from '../model/CameraService'
import {CustomContainer} from '../common/CameraOrientation';
import FirstDialog from '../model/FirstDialog';
const CameraMode = {
MODE_PHOTO: 0, // 拍照模式
MODE_VIDEO: 1 // 录像模式
}
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'CameraOrientation0';
@State StepTips: string = '测试目的:用于测试相机预览和拍照旋转能力\n-左侧显示给定旋转角度后的预览窗口\n-右侧显示拍照后的图片\n-对于前置摄像头会有镜像效果'+'\n'+'预期结果:拍照图片与预览窗口的画面一致';
private tag: string = 'qlw'
private mXComponentController: XComponentController = new XComponentController()
@State surfaceId: number = 0;
@State curModel: number = CameraMode.MODE_PHOTO
@State cameraDeviceIndex: number = 0
@State imageRotationValue: number = camera.ImageRotation.ROTATION_90
@State qualityLevelValue: number = camera.QualityLevel.QUALITY_LEVEL_LOW
@State assetUri: string = undefined
@State Vue: boolean = false
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
handleTakePicture = (assetUri: string) => {
this.assetUri = assetUri
Logger.info(this.tag, `takePicture end, assetUri: ${this.assetUri}`)
}
@Builder specificNoParam() {
Column() {
}
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Camera/Camera_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name: $name,
Vue: $Vue
}).height('30%').width('100%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 10, surfaceHeight: 10 })
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.curModel = CameraMode.MODE_PHOTO
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
})
.height('40%')
.width('40%')
Text('Camera Preview').fontSize('20fp')
Image(this.assetUri || $r('app.media.img'))
.width('40%').height('40%').border({ width: 1 }).objectFit(ImageFit.Contain)
Text('Oriented Photo').fontSize('20fp')
Button('拍照', {
type: ButtonType.Normal,
stateEffect: true
}).borderRadius(8).backgroundColor(0x317aff).width('20%').onClick(() => {
CameraService.takePicture(this.imageRotationValue, this.qualityLevelValue)
CameraService.setTakePictureCallback(this.handleTakePicture.bind(this))
this.Vue = true
})
}.width('100%').height('70%').backgroundColor(Color.White)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation180.ets
0 → 100644
浏览文件 @
c931f334
/*
* 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 camera from '@ohos.multimedia.camera'
import Logger from '../model/Logger'
import CameraService from '../model/CameraService'
import {CustomContainer} from '../common/CameraOrientation';
import FirstDialog from '../model/FirstDialog';
const CameraMode = {
MODE_PHOTO: 0, // 拍照模式
MODE_VIDEO: 1 // 录像模式
}
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'CameraOrientation180';
@State StepTips: string = '测试目的:用于测试相机预览和拍照旋转能力\n-左侧显示给定旋转角度后的预览窗口\n-右侧显示拍照后的图片\n-对于前置摄像头会有镜像效果'+'\n'+'预期结果:拍照图片与预览窗口的画面一致';
private tag: string = 'qlw'
private mXComponentController: XComponentController = new XComponentController()
@State surfaceId: number = 0;
@State curModel: number = CameraMode.MODE_PHOTO
@State cameraDeviceIndex: number = 0
@State imageRotationValue: number = camera.ImageRotation.ROTATION_180
@State qualityLevelValue: number = camera.QualityLevel.QUALITY_LEVEL_LOW
@State assetUri: string = undefined
@State Vue: boolean = false
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
handleTakePicture = (assetUri: string) => {
this.assetUri = assetUri
Logger.info(this.tag, `takePicture end, assetUri: ${this.assetUri}`)
}
@Builder specificNoParam() {
Column() {
}
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Camera/Camera_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name,
Vue: $Vue,
}).height('30%').width('100%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 10, surfaceHeight: 10 })
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.curModel = CameraMode.MODE_PHOTO
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
})
.height('40%')
.width('40%')
Text('Camera Preview').fontSize('20fp')
Image(this.assetUri || $r('app.media.img'))
.width('40%').height('40%').border({ width: 1 }).objectFit(ImageFit.Contain)
Text('Oriented Photo').fontSize('20fp')
Button('拍照', {
type: ButtonType.Normal,
stateEffect: true
}).borderRadius(8).backgroundColor(0x317aff).width('20%').onClick(() => {
CameraService.takePicture(this.imageRotationValue, this.qualityLevelValue)
CameraService.setTakePictureCallback(this.handleTakePicture.bind(this))
this.Vue = true
})
}.width('100%').height('70%').backgroundColor(Color.White)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation270.ets
0 → 100644
浏览文件 @
c931f334
/*
* 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 camera from '@ohos.multimedia.camera'
import Logger from '../model/Logger'
import CameraService from '../model/CameraService'
import {CustomContainer} from '../common/CameraOrientation';
import FirstDialog from '../model/FirstDialog';
const CameraMode = {
MODE_PHOTO: 0, // 拍照模式
MODE_VIDEO: 1 // 录像模式
}
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'CameraOrientation270';
@State StepTips: string = '测试目的:用于测试相机预览和拍照旋转能力\n-左侧显示给定旋转角度后的预览窗口\n-右侧显示拍照后的图片\n-对于前置摄像头会有镜像效果'+'\n'+'预期结果:拍照图片与预览窗口的画面一致';
private tag: string = 'qlw'
private mXComponentController: XComponentController = new XComponentController()
@State surfaceId: number = 0;
@State curModel: number = CameraMode.MODE_PHOTO
@State cameraDeviceIndex: number = 0
@State imageRotationValue: number = camera.ImageRotation.ROTATION_270
@State qualityLevelValue: number = camera.QualityLevel.QUALITY_LEVEL_LOW
@State assetUri: string = undefined
@State Vue: boolean = false
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
handleTakePicture = (assetUri: string) => {
this.assetUri = assetUri
Logger.info(this.tag, `takePicture end, assetUri: ${this.assetUri}`)
}
@Builder specificNoParam() {
Column() {
}
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Camera/Camera_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name,
Vue: $Vue
}).height('30%').width('100%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 10, surfaceHeight: 10 })
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.curModel = CameraMode.MODE_PHOTO
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
})
.height('40%')
.width('40%')
Text('Camera Preview').fontSize('20fp')
Image(this.assetUri || $r('app.media.img'))
.width('40%').height('40%').border({ width: 1 }).objectFit(ImageFit.Contain)
Text('Oriented Photo').fontSize('20fp')
Button('拍照', {
type: ButtonType.Normal,
stateEffect: true
}).borderRadius(8).backgroundColor(0x317aff).width('20%').onClick(() => {
CameraService.takePicture(this.imageRotationValue, this.qualityLevelValue)
CameraService.setTakePictureCallback(this.handleTakePicture.bind(this))
this.Vue = true
})
}.width('100%').height('70%').backgroundColor(Color.White)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Camera/CameraOrientation90.ets
0 → 100644
浏览文件 @
c931f334
/*
* 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 camera from '@ohos.multimedia.camera'
import Logger from '../model/Logger'
import CameraService from '../model/CameraService'
import {CustomContainer} from '../common/CameraOrientation';
import FirstDialog from '../model/FirstDialog';
const CameraMode = {
MODE_PHOTO: 0, // 拍照模式
MODE_VIDEO: 1 // 录像模式
}
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'CameraOrientation90';
@State StepTips: string = '测试目的:用于测试相机预览和拍照旋转能力\n-左侧显示给定旋转角度后的预览窗口\n-右侧显示拍照后的图片\n-对于前置摄像头会有镜像效果'+'\n'+'预期结果:拍照图片与预览窗口的画面一致';
private tag: string = 'qlw'
private mXComponentController: XComponentController = new XComponentController()
@State surfaceId: number = 0;
@State curModel: number = CameraMode.MODE_PHOTO
@State cameraDeviceIndex: number = 0
@State imageRotationValue: number = camera.ImageRotation.ROTATION_0
@State qualityLevelValue: number = camera.QualityLevel.QUALITY_LEVEL_LOW
@State assetUri: string = undefined
@State Vue: boolean = false
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
handleTakePicture = (assetUri: string) => {
this.assetUri = assetUri
Logger.info(this.tag, `takePicture end, assetUri: ${this.assetUri}`)
}
@Builder specificNoParam() {
Column() {
}
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/Camera/Camera_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name,
Vue: $Vue
}).height('30%').width('100%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 10, surfaceHeight: 10 })
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.curModel = CameraMode.MODE_PHOTO
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
})
.height('40%')
.width('40%')
Text('Camera Preview').fontSize('20fp')
Image(this.assetUri || $r('app.media.img'))
.width('40%').height('40%').border({ width: 1 }).objectFit(ImageFit.Contain)
Text('Oriented Photo').fontSize('20fp')
Button('拍照', {
type: ButtonType.Normal,
stateEffect: true
}).borderRadius(8).backgroundColor(0x317aff).width('20%').onClick(() => {
CameraService.takePicture(this.imageRotationValue, this.qualityLevelValue)
CameraService.setTakePictureCallback(this.handleTakePicture.bind(this))
this.Vue = true
})
}.width('100%').height('70%').backgroundColor(Color.White)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/
MediaLibrary/startImagePreviewCallback4
.ets
→
validator/acts_validator/src/main/ets/pages/
Camera/CameraVideo
.ets
浏览文件 @
c931f334
/*
/*
* 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");
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import camera from '@ohos.multimedia.camera'
import {CustomContainer} from '../common/MediaCustomContainer';
import Logger from '../model/Logger'
import FirstDialog from '../model/FirstDialog';
import CameraService from '../model/CameraService'
@Entry
import {CustomContainer} from '../common/CameraOrientation';
@Component
import FirstDialog from '../model/FirstDialog';
struct SetCircle {
const CameraMode = {
@State FillColor: string = '#FF000000';
MODE_PHOTO: 0, // 拍照模式
@State name: string = 'startImagePreviewCallback4';
MODE_VIDEO: 1 // 录像模式
@State StepTips: string = '测试步骤:点击“点击预览”按钮'+'\n'+'预期结果:预览图片失败';
}
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
@Entry
}
@Component
@Builder specificNoParam() {
struct SetCircle {
Column() {
@State FillColor: string = '#FF000000';
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
@State name: string = 'CameraVideo';
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
@State StepTips: string = '测试目的:用于测试相机不同分辨率下的录像能力\n-上边显示录像的预览窗口\n-按下测试按钮后触发3s录像,回放的录像文件将在录像结束后显示在下边窗口\n-使用下拉框可以选择相机设备和分辨率'+'\n'+'预期结果:回放的录像视频与预览窗口的画面一致';
.onClick(() => {
private tag: string = 'qlw'
let TAG = 'startImagePreviewCallback4';
private mXComponentController: XComponentController = new XComponentController()
let images = [
@State surfaceId: number = 0;
"datashare:///media/image/9999",
private x: number = 0;
"datashare:///media/image/9998",
@State curModel: number = CameraMode.MODE_PHOTO
"datashare:///media/image/9997",
@State cameraDeviceIndex: number = 0
"datashare:///media/image/9996",
@State imageRotationValue: number = camera.ImageRotation.ROTATION_90
];
@State qualityLevelValue: number = camera.QualityLevel.QUALITY_LEVEL_LOW
let index = 2;
@State assetUri: string = undefined
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, index, (err) => {
@State Vue: boolean = false
if (err) {
async aboutToAppear(){
console.log(TAG + "An error occurred when previewing the images." + JSON.stringify(err));
await FirstDialog.ChooseDialog(this.StepTips,this.name);
return;
}
}
handleTakePicture = (assetUri: string) => {
console.log(TAG + "Succeeded in previewing the images.");
this.assetUri = assetUri
});
Logger.info(this.tag, `Video recorder end, assetUri: ${this.assetUri}`)
})
}
}
@Builder specificNoParam() {
}.width('100%').height('80%').backgroundColor(Color.White)
Column() {
}
}
build() {
}
Column() {
build() {
CustomContainer({
Column() {
title: this.name,
CustomContainer({
Url:'pages/MediaLibrary/MediaLibrary_index',
title: this.name,
StepTips:this.StepTips,
Url:'pages/Camera/Camera_index',
content: this.specificNoParam,
StepTips:this.StepTips,
FillColor:$FillColor,
content: this.specificNoParam,
name:$name
FillColor:$FillColor,
})
name: $name,
}.width('100%').height('100%').backgroundColor(Color.Black)
Vue: $Vue
}
}).height('30%').width('100%')
}
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 10, surfaceHeight: 10 })
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.curModel = CameraMode.MODE_PHOTO
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
})
.height('40%')
.width('40%')
Text('Camera Preview').fontSize('20fp')
// Video()
Text('Video playback').fontSize('20fp')
Button('Test', {
type: ButtonType.Normal,
stateEffect: true
}).borderRadius(8).backgroundColor(0x317aff).width('20%').onClick(() => {
CameraService.startVideo()
CameraService.setTakePictureCallback(this.handleTakePicture.bind(this))
this.Vue = true
})
}.width('100%').height('70%').backgroundColor(Color.White)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Camera/Camera_index.ets
0 → 100644
浏览文件 @
c931f334
/*
* 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 prompt from '@ohos.prompt';
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import xml from '@ohos.xml';
import fileIO from '@ohos.fileio';
import util from '@ohos.util';
import data_preferences from '@ohos.data.preferences';
const TAG = 'ParseXML';
let path = globalThis.dir;
let path1 = path + '/Camera';
let VarColor = [];
let ColorBackPath = path + '/CameraColorBack.txt';
let txtPath = path1 + 'CameraReport.txt';
let xmlPath = path1 + 'CameraTest.xml';
@Entry
@Component
struct IndexPage {
@State ClearAll : boolean = false;
private current : number = undefined;
@State count : number = 0;
@State result : string = '';
@State TEST : number = 0;
private TestCaseList = [
{title:'CameraOrientation0',uri:'pages/Camera/CameraOrientation0'},
{title:'CameraOrientation90',uri:'pages/Camera/CameraOrientation90'},
{title:'CameraOrientation180',uri:'pages/Camera/CameraOrientation180'},
{title:'CameraOrientation270',uri:'pages/Camera/CameraOrientation270'},
{title:'CameraFormat',uri:'pages/Camera/CameraFormat'},
{title:'CameraVideo',uri:'pages/Camera/CameraVideo'},
]
@State ColorObject : string[] = VarColor;
async onPageShow(){
let Test = null;
let context =null;
context = globalThis.getContext();
let preferences;
let promise = data_preferences.getPreferences(context,'mystore');
await promise.then((object) => {
preferences = object;
});
promise = preferences.get('Camera', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'Camera'. Data: " + data);
});
if(Test != 1) {
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString();
fileio.writeSync(fd,log);
}
fileio.closeSync(fd);
}
promise = preferences.put('Camera', 1);
promise.then(() => {
console.info("Succeeded in putting value of 'Camera'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
this.TEST = Test;
let opt = fileio.openSync(ColorBackPath, 0o100 | 0o2002, 0o664);
let buff = new ArrayBuffer(40960);
fileio.readSync(opt,buff);
let ColorBack = String.fromCharCode.apply(null, new Uint8Array(buff));
let TestList = ColorBack.split(';');
for (let i = 0; i < Math.floor(TestList.length / 2); i++) {
VarColor[i] = TestList[i*2+1];
}
fileio.closeSync(opt);
if (this.count === 1){
this.result = router.getParams()['result'];
let titles = router.getParams()['title'];
let name1 = '刚刚点进了哪个用例:'+ titles;
let results = this.result;
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 11;
let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'Pass'){
this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = ColorBack.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles)
}
else if (this.result === 'Fail'){
this.ColorObject[this.current] = '#ffff0000';
let Log = (titles+';'+'#ffff0000'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = ColorBack.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles);
}
else if (this.result === 'None'){
this.ColorObject[this.current] = this.ColorObject[this.current];
}
}
}
build(){
Column(){
Row() {
Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black)
.onClick(() => {
router.back();
})
Row(){
Text('Camera')
.fontColor(Color.White)
.fontSize('20fp')
}.justifyContent(FlexAlign.SpaceAround).backgroundColor(Color.Black)
Row() {
Button(){
Image($r('app.media.ic_public_delete'))
.width('30vp')
.height('30vp')
}.backgroundColor(Color.Black)
.onClick(() => {
AlertDialog.show(
{
message: "是否删除所有记录",
primaryButton: {
value: 'Yes',
action: () => {
this.ClearAll = true;
this.ColorObject.forEach((value, index) => {
this.ColorObject[index] = '#ff808080';
});
this.ClearText();
prompt.showToast({
message: '结果已删除', duration: 1000
});
}
},
secondaryButton: {
value: 'No',
action: () => {
}
},
cancel: () => {
}
}
)
})
Button(){
Image($r('app.media.ic_public_save'))
.width('30vp')
.height('30vp')
.margin({ left: 30 })
}.backgroundColor(Color.Black)
.onClick(() => {
this.ReadTextParseXml();
AlertDialog.show({
message: "报告已生成,如需查看通过命令行输入'hdc_std file recv /data/app/el2/100/base/com.example.actsvalidator/haps/entry/files/report1/CameraTest.xml -本地路径'",
confirm:{
value:'OK',
action:()=>{
prompt.showToast({
message: '报告已生成', duration: 1000
})
}
},
cancel: () => {
prompt.showToast({
message: '报告已生成', duration: 1000
})
}
})
})
}
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%').backgroundColor(Color.Black)
List({space:5}){
ForEach(this.TestCaseList,(item,index) => {
ListItem(){
Row(){
Text(item.title).fontSize(16).fontColor(Color.Black)
}.width('100%').height(50).alignItems(VerticalAlign.Center).backgroundColor(this.count===0&&this.TEST===0?'#ff808080':this.ColorObject[index])
.onClick(( )=>{
this.count = 1;
this.ClearAll=false;
this.current = index;
router.push({
url: item.uri,
})
})
}
},item => item.title)
}.width('100%').height('92%')
}.width('100%').height('100%').backgroundColor(Color.Black)
}
ClearText(){
fileio.rmdirSync(path1);
fileio.mkdirSync(path1);
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString();
fileio.writeSync(fd,log);
}
}
ReadTextParseXml(){
let ReportPath = path1 + '/CameraReport.txt';
let dir = fileio.opendirSync(path1);
console.info("ssssss"+dir);
while (dir) {
let OP = fileio.openSync(ReportPath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(40960);
let RD = fileio.readSync(OP,buf);
console.info("ddddd"+RD);
let report;
function ab2str(buf) {
return report = String.fromCharCode.apply(null,new Uint8Array(buf));
}
ab2str(buf);
let str1 = report.split(";");
let title = [];
let result = [];
for(let i=0; i<Math.floor(str1.length/2); i++){
title[i] = str1[i*2];
result[i] = str1[i*2+1];
}
let FailIndex = report.indexOf('Fail');
let FailNum = 0;
while (FailIndex != -1) {
console.log(FailIndex);
FailNum++;
FailIndex = report.indexOf('Fail',FailIndex + 1);
}
let failNum = (FailNum).toString();
let PassIndex = report.indexOf('Pass');
let PassNum = 0;
while (PassIndex != -1) {
console.log(PassIndex);
PassNum++;
PassIndex = report.indexOf('Pass',PassIndex + 1);
}
let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString();
let ignoreNum = (4-TestNum).toString();
let arrayBuffer = new ArrayBuffer(40960);
let bufView = new DataView(arrayBuffer);
let serializer = new xml.XmlSerializer(bufView);
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name", "ActsCameraTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", ignoreNum);
serializer.setAttributes("tests", testNum);
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("result", String(result[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.endElement();
}
serializer.endElement();
let that = new util.TextDecoder('utf-8');
let array = new Uint8Array(arrayBuffer);
let serializerStr = that.decode(array);
console.info(xmlPath);
try{
console.error(TAG,"write xmlPath =" +xmlPath);
var xmlfd = fileIO.openSync(xmlPath, 0o102, 0o666);
fileIO.writeSync(xmlfd,serializerStr);
}catch(err){
console.error(TAG,"read xmlPath =" + xmlPath + "error:" + err);
}finally{
fileIO.closeSync(xmlfd);
}
return;
}
}
}
function filewrite(name1,results,titles){
let fd = fileio.openSync(txtPath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
let RD = fileio.readSync(fd,buf);
console.info("RRRRRRRRRRd"+RD);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 6;
let Index = report.indexOf(WriteTitle);
let Log = (titles+";"+results+";").toString();
if (Index == -1){
fileio.writeSync(fd,Log);
}
else if (Index != -1){
let key = report.substring(Index,Index+number);
let FD = fileio.openSync(txtPath, 0o102, 0o666);
report = report.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = report.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(txtPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/
MediaLibrary/MediaLibrary
_index.ets
→
validator/acts_validator/src/main/ets/pages/
Experience/Experience
_index.ets
浏览文件 @
c931f334
此差异已折叠。
点击以展开。
validator/acts_validator/src/main/ets/pages/
MediaLibrary/startImagePreviewPromise2
.ets
→
validator/acts_validator/src/main/ets/pages/
Experience/ScrollListTest
.ets
浏览文件 @
c931f334
/*
/*
* 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");
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/CustomContainer';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
import FirstDialog from '../model/FirstDialog';
@Entry
@Entry
@Component
@Component
struct CustomContainerUser {
struct SetCircle {
private listArr: number[] = Array.from(new Array(50).keys());
@State FillColor: string = '#FF000000';
@State name: string = 'ScrollingList';
@State name: string = 'startImagePreviewPromise2';
@State StepTips: string = '操作步骤:滑动列表观察是否能正常滑动'+'\n'+'预期结果:列表滑动正常';
@State StepTips: string = '测试步骤:点击“点击预览”按钮' + '\n' + '预期结果:起始图片为第一张图片,一共可以预览到两张图片';
@State Vue: boolean = false;
async aboutToAppear(){
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
this.Vue = true;
@Builder specificNoParam() {
}
Column() {
@Builder specificNoParam() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column() {
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
List() {
.onClick(() => {
ForEach(this.listArr,(item:any,index:number) => {
let TAG = 'startImagePreviewPromise2';
ListItem() {
let images = [
Text('Item #' + (index + 1)).width('100%').height(50).fontSize(16).fontColor(Color.White).margin({left:'10vp'})
"datashare:///media/image/3",
}
"datashare:///media/image/4",
},index => index)
];
}.height('100%').width('100%').divider({strokeWidth:1,color:Color.Grey})
let index = 1;
}.height('83%').width('100%')
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, index).then(() => {
}
console.log(TAG + "Succeeded in previewing the images.");
build() {
}).catch((err) => {
Column() {
console.log(TAG + "An error occurred when previewing the images." + JSON.stringify(err));
CustomContainer({
});
title: this.name,
})
Url: 'pages/Experience/Experience_index',
}
StepTips: this.StepTips,
}.width('100%').height('80%').backgroundColor(Color.White)
content: this.specificNoParam.bind(this),
}
name: $name,
Vue: $Vue,
build() {
})
Column() {
}.width('100%').height('100%').backgroundColor(Color.Black)
CustomContainer({
}
title: this.name,
}
Url: 'pages/MediaLibrary/MediaLibrary_index',
StepTips: this.StepTips,
content: this.specificNoParam,
FillColor: $FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback1.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startImagePreviewCallback1';
@State StepTips: string = '测试步骤:点击“点击预览”按钮'+'\n'+'预期结果:可以预览到一张图片';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startImagePreviewCallback1';
let images = [
"datashare:///media/image/3",
];
let index = 1;
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, index, (err) => {
if (err) {
console.log(TAG + "An error occurred when previewing the images." + JSON.stringify(err));
return;
}
console.log(TAG + "Succeeded in previewing the images.");
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback2.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startImagePreviewCallback2';
@State StepTips: string = '测试步骤:点击“点击预览”按钮'+'\n'+'预期结果:起始图片为第一张图片,一共可以预览到两张图片';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startImagePreviewCallback2';
let images = [
"datashare:///media/image/3",
"datashare:///media/image/4",
];
let index = 1;
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, index, (err) => {
if (err) {
console.log(TAG + "An error occurred when previewing the images." + JSON.stringify(err));
return;
}
console.log(TAG + "Succeeded in previewing the images.");
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback3.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startImagePreviewCallback3';
@State StepTips: string = '测试步骤:点击“点击预览”按钮'+'\n'+'预期结果:起始图片为第三张图片,一共可以预览到四张图片';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startImagePreviewCallback3';
let images = [
"datashare:///media/image/3",
"datashare:///media/image/4",
"datashare:///media/image/5",
"datashare:///media/image/6",
];
let index = 2;
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, index, (err) => {
if (err) {
console.log(TAG + "An error occurred when previewing the images." + JSON.stringify(err));
return;
}
console.log(TAG + "Succeeded in previewing the images.");
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback5.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startImagePreviewCallback5';
@State StepTips: string = '测试步骤:点击“点击预览”按钮'+'\n'+'预期结果:成功预览一张图片';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startImagePreviewCallback5';
let images = [
"datashare:///media/image/3",
];
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, (err) => {
if (err) {
console.log(TAG + "startImagePreview_One An error occurred when previewing the images." + JSON.stringify(err));
return;
}
console.log(TAG + "startImagePreview_One Succeeded in previewing the images.");
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback6.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startImagePreviewCallback6';
@State StepTips: string = '测试步骤:点击“点击预览”按钮'+'\n'+'预期结果:成功预览五张图片';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startImagePreviewCallback6';
let images = [
"datashare:///media/image/3",
"datashare:///media/image/4",
"datashare:///media/image/5",
"datashare:///media/image/6",
"datashare:///media/image/2",
];
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, (err) => {
if (err) {
console.log(TAG + "startImagePreview_MultiPle An error occurred when previewing the images." + JSON.stringify(err));
return;
}
console.log(TAG + "startImagePreview_MultiPle Succeeded in previewing the images.");
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewCallback7.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startImagePreviewCallback7';
@State StepTips: string = '测试步骤:点击“点击预览”按钮'+'\n'+'预期结果:预览图片失败';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startImagePreviewCallback7';
let images = [
"datashare:///media/image/9999",
];
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, (err) => {
if (err) {
console.log(TAG + "startImagePreview_One An error occurred when previewing the images." + JSON.stringify(err));
return;
}
console.log(TAG + "startImagePreview_One Succeeded in previewing the images.");
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/startImagePreviewPromise3.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startImagePreviewPromise3';
@State StepTips: string = '测试步骤:点击“点击预览”按钮' + '\n' + '预期结果:起始图片为第二张图片,一共可以预览到三张图片';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startImagePreviewPromise3';
let images = [
"datashare:///media/image/3",
"datashare:///media/image/4",
"datashare:///media/image/5",
];
let index = 1;
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, index).then(() => {
console.log(TAG + "Succeeded in previewing the images.");
}).catch((err) => {
console.log(TAG + "An error occurred when previewing the images." + JSON.stringify(err));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url: 'pages/MediaLibrary/MediaLibrary_index',
StepTips: this.StepTips,
content: this.specificNoParam,
FillColor: $FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectCallback1.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startMediaSelectCallback1';
@State StepTips: string = '测试步骤:点击“点击选择”按钮'+'\n'+'预期结果:可以选择一张图片(单选)';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击选择').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startMediaSelectCallback1';
let option : mediaLibrary.MediaSelectOption = {
type : "image",
count : 1
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startMediaSelect(option, (err, value) => {
if (err) {
console.log(TAG + "An error occurred when selecting image resources." + JSON.stringify(err));
return;
}
console.log(TAG + "image resources selected." + JSON.stringify(value));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor, name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectCallback2.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startMediaSelectCallback2';
@State StepTips: string = '测试步骤:点击“点击选择”按钮'+'\n'+'预期结果:可以选择多张图片(多选)';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击选择').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startMediaSelectCallback2';
let option : mediaLibrary.MediaSelectOption = {
type : "image",
count : 2
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startMediaSelect(option, (err, value) => {
if (err) {
console.log(TAG + "An error occurred when selecting image resources." + JSON.stringify(err));
return;
}
console.log(TAG + "image resources selected." + JSON.stringify(value));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectCallback3.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startMediaSelectCallback3';
@State StepTips: string = '测试步骤:点击“点击选择”按钮'+'\n'+'预期结果:可以选择多个图片、视频文件';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击选择').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startMediaSelectCallback3';
let option : mediaLibrary.MediaSelectOption = {
type : "media",
count : 2
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startMediaSelect(option, (err, value) => {
if (err) {
console.log(TAG + "An error occurred when selecting image resources." + JSON.stringify(err));
return;
}
console.log(TAG + "image resources selected." + JSON.stringify(value));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectCallback4.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startMediaSelectCallback4';
@State StepTips: string = '测试步骤:点击“点击选择”按钮'+'\n'+'预期结果:可以选择多个视频资源';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击选择').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startMediaSelectCallback4';
let option : mediaLibrary.MediaSelectOption = {
type : "video",
count : 2
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startMediaSelect(option, (err, value) => {
if (err) {
console.log(TAG + "An error occurred when selecting image resources." + JSON.stringify(err));
return;
}
console.log(TAG + "image resources selected." + JSON.stringify(value));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectPromise1.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startMediaSelectPromise1';
@State StepTips: string = '测试步骤:点击“点击选择”按钮'+'\n'+'预期结果:可以选择单张图片';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击选择').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startMediaSelectPromise1';
let option : mediaLibrary.MediaSelectOption = {
type : "image",
count : 1
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startMediaSelect(option).then((value) => {
console.log(TAG + "Media resources selected." + JSON.stringify(value));
}).catch((err) => {
console.log(TAG + "An error occurred when selecting media resources." + JSON.stringify(err));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectPromise2.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startMediaSelectPromise2';
@State StepTips: string = '测试步骤:点击“点击选择”按钮'+'\n'+'预期结果:可以选择多张图片';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击选择').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startMediaSelectPromise2';
let option : mediaLibrary.MediaSelectOption = {
type : "image",
count : 2
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startMediaSelect(option).then((value) => {
console.log(TAG + "Media resources selected." + JSON.stringify(value));
}).catch((err) => {
console.log(TAG + "An error occurred when selecting media resources." + JSON.stringify(err));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectPromise3.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startMediaSelectPromise3';
@State StepTips: string = '测试步骤:点击“点击选择”按钮'+'\n'+'预期结果:可以选择多个图片、视频资源';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击选择').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startMediaSelect5_media2';
let option : mediaLibrary.MediaSelectOption = {
type : "media",
count : 2
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startMediaSelect(option).then((value) => {
console.log(TAG + "Media resources selected." + JSON.stringify(value));
}).catch((err) => {
console.log(TAG + "An error occurred when selecting media resources." + JSON.stringify(err));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/startMediaSelectPromise4.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'startMediaSelectPromise4';
@State StepTips: string = '测试步骤:点击“点击选择”按钮'+'\n'+'预期结果:可以选择单个视频';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击选择').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
.onClick(() => {
let TAG = 'startMediaSelect5_video2';
let option : mediaLibrary.MediaSelectOption = {
type : "video",
count : -1
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startMediaSelect(option).then((value) => {
console.log(TAG + "Media resources selected." + JSON.stringify(value));
}).catch((err) => {
console.log(TAG + "An error occurred when selecting media resources." + JSON.stringify(err));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetCallback1.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 featureAbility from '@ohos.ability.featureAbility';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'storeMediaAssetCallback1';
@State StepTips: string = '操作步骤:点击“点击保存”按钮'+'\n'+'预期结果:成功保存一张图片,资源内容为“hello world”';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam(){
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击保存').margin('2%').backgroundColor('#FFDDDDF8').fontSize(20).border({ width: 1 }).size({ width: '70%', height: '20%' })
.onClick(async () => {
let TAG = 'storeMediaAssetCallback1';
let data = await globalThis.abilityContext.getFilesDir();
let time = new Date().getTime();
console.log("data is"+ JSON.stringify(data));
data = 'data/storage/el2/base/haps/entry';
let JpgPath = data + "/files/"+time + ".jpg";
let srcFd =await fileio.open(JpgPath,0o102,0o0600);
await fileio.write(srcFd,"hello world");
await fileio.close(srcFd);
let option = {
src : JpgPath,
mimeType : "image/*",
relativePath : "Pictures/"
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).storeMediaAsset(option, (err, value) => {
if (err) {
console.log(TAG +"An error occurred when storing image resources." + JSON.stringify(err));
return;
}
AlertDialog.show(
{
title: '保存成功',
message: '查询到Pictures路径下新增一个.jpg格式的图片资源,资源内容为“hello world”',
confirm: {
value: 'OK',
action: () => {
console.info(TAG + 'Button-clicking callback')
}
},
cancel: () => {
console.info(TAG + 'Closed callbacks')
}
}
)
console.log(TAG + "image resources stored. "+ JSON.stringify(value));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetCallback2.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 featureAbility from '@ohos.ability.featureAbility';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'storeMediaAssetCallback2';
@State StepTips: string = '操作步骤:点击“点击保存”按钮'+'\n'+'预期结果:成功保存音频,资源内容为“hello world”';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam(){
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击保存').margin('2%').backgroundColor('#FFDDDDF8').fontSize(20).border({ width: 1 }).size({ width: '70%', height: '20%' })
.onClick(async () => {
let TAG = 'storeMediaAssetCallback2';
let data = await globalThis.abilityContext.getFilesDir();
let time = new Date().getTime();
console.log("data is"+ JSON.stringify(data));
data = 'data/storage/el2/base/haps/entry';
let PathMp3 = data + "/files/"+time + ".mp3";
let srcFd =await fileio.open(PathMp3,0o102,0o0600);
await fileio.write(srcFd,"hello world");
await fileio.close(srcFd);
let option = {
src : PathMp3,
mimeType : "audio/mp3",
relativePath : "Audios/"
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).storeMediaAsset(option, (err, value) => {
if (err) {
console.log(TAG + "An error occurred when storing audios resources."+ JSON.stringify(err));
return;
}
AlertDialog.show(
{
title: '保存成功',
message: '查询到Audios路径下新增一个.mp3格式的音频资源,资源内容为“hello world”',
confirm: {
value: 'OK',
action: () => {
console.info(TAG + 'Button-clicking callback')
}
},
cancel: () => {
console.info(TAG + 'Closed callbacks')
}
}
)
console.log(TAG + "audios resources stored. "+ JSON.stringify(value));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetCallback3.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 featureAbility from '@ohos.ability.featureAbility';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'storeMediaAssetCallback3';
@State StepTips: string = '操作步骤:点击“点击保存”按钮'+'\n'+'预期结果:成功保存视频,资源内容为“hello world”';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam(){
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击保存').margin('2%').backgroundColor('#FFDDDDF8').fontSize(20).border({ width: 1 }).size({ width: '70%', height: '20%' })
.onClick(async () => {
let TAG = 'storeMediaAssetCallback3';
let data = await globalThis.abilityContext.getFilesDir();
let time = new Date().getTime();
console.log("data is"+ JSON.stringify(data));
data = 'data/storage/el2/base/haps/entry';
let PathMp4 = data + "/files/"+time + ".mp4";
let srcFd =await fileio.open(PathMp4,0o102,0o0600);
await fileio.write(srcFd,"hello world");
await fileio.close(srcFd);
let option = {
src : PathMp4,
mimeType : "video/mp4",
relativePath : "Videos/"
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).storeMediaAsset(option, (err, value) => {
if (err) {
console.log(TAG + "An error occurred when storing videos resources."+ JSON.stringify(err));
return;
}
AlertDialog.show(
{
title: '保存成功',
message: '查询到Videos路径下新增一个.mp4格式的视频资源,资源内容为“hello world”',
confirm: {
value: 'OK',
action: () => {
console.info(TAG + 'Button-clicking callback')
}
},
cancel: () => {
console.info(TAG + 'Closed callbacks')
}
}
)
console.log(TAG + "videos resources stored. "+ JSON.stringify(value));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetCallback4.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 featureAbility from '@ohos.ability.featureAbility';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'storeMediaAssetCallback4';
@State StepTips: string = '操作步骤:点击“点击保存”按钮'+'\n'+'预期结果:成功保存文件,资源内容为“hello world”';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam(){
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击保存').margin('2%').backgroundColor('#FFDDDDF8').fontSize(20).border({ width: 1 }).size({ width: '70%', height: '20%' })
.onClick(async () => {
let TAG = 'storeMediaAssetCallback4';
let data = await globalThis.abilityContext.getFilesDir();
let time = new Date().getTime();
console.log("data is"+ JSON.stringify(data));
data = 'data/storage/el2/base/haps/entry';
let PathPdf = data + "/files/"+time + ".Pdf";
let srcFd =await fileio.open(PathPdf,0o102,0o0600);
await fileio.write(srcFd,"hello world");
await fileio.close(srcFd);
let option = {
src : PathPdf,
mimeType : "file/pdf",
relativePath : "Documents/"
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).storeMediaAsset(option, (err, value) => {
if (err) {
console.log(TAG + "An error occurred when storing files resources."+ JSON.stringify(err));
return;
}
AlertDialog.show(
{
title: '保存成功',
message: '查询到Documents路径下新增一个.Pdf格式的文件资源,资源内容为“hello world”',
confirm: {
value: 'OK',
action: () => {
console.info(TAG + 'Button-clicking1 callback')
}
},
cancel: () => {
console.info(TAG + 'Closed1 callbacks')
}
}
)
console.log(TAG + "files resources stored. "+ JSON.stringify(value));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetPromise1.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'storeMediaAssetPromise1';
@State StepTips: string = '操作步骤:点击“点击保存”按钮'+'\n'+'预期结果:成功保存图片,资源内容为“hello world”';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击保存').margin('2%').backgroundColor('#FFDDDDF8').fontSize(20).border({ width: 1 }).size({ width: '70%', height: '20%' })
.onClick(async () => {
let TAG = 'storeMediaAssetPromise1';
let context0 = featureAbility.getContext();
let data = await context0.getFilesDir();
let time = new Date().getTime();
console.log("data is"+ JSON.stringify(data));
data = 'data/storage/el2/base/haps/entry';
let JpgPath = data + "/files/"+time + ".jpg";
let srcFd =await fileio.open(JpgPath,0o102,0o0600);
await fileio.write(srcFd,"hello world");
await fileio.close(srcFd);
let option = {
src : JpgPath,
mimeType : "image/*",
relativePath : "Pictures/"
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).storeMediaAsset(option).then((value) => {
AlertDialog.show(
{
title: '保存成功',
message: '查询到Pictures路径下新增一个.jpg格式的图片资源,资源内容为“hello world”',
confirm: {
value: 'OK',
action: () => {
console.info(TAG + 'Button-clicking callback')
}
},
cancel: () => {
console.info(TAG + 'Closed callbacks')
}
}
)
console.log(TAG + "image resources stored. "+ JSON.stringify(value));
}).catch((err) => {
console.log(TAG + "An error occurred when storing image resources."+ JSON.stringify(err));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetPromise2.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'storeMediaAssetPromise2';
@State StepTips: string = '操作步骤:点击“点击保存”按钮'+'\n'+'预期结果:成功保存音频,资源内容为“hello world”';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击保存').margin('2%').backgroundColor('#FFDDDDF8').fontSize(20).border({ width: 1 }).size({ width: '70%', height: '20%' })
.onClick(async () => {
let TAG = 'storeMediaAssetPromise2';
let data = await globalThis.abilityContext.getFilesDir();
let time = new Date().getTime();
console.log("data is"+ JSON.stringify(data));
data = 'data/storage/el2/base/haps/entry';
let PathMp3 = data + "/files/"+time + ".mp3";
let srcFd =await fileio.open(PathMp3,0o102,0o0600);
await fileio.write(srcFd,"hello world");
await fileio.close(srcFd);
let option = {
src : PathMp3,
mimeType : "audio/mp3",
relativePath : "Audios/"
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).storeMediaAsset(option).then((value) => {
AlertDialog.show(
{
title: '保存成功',
message: '查询到Audios路径下新增一个.mp3格式的音频资源,资源内容为“hello world”',
confirm: {
value: 'OK',
action: () => {
console.info(TAG + 'Button-clicking callback')
}
},
cancel: () => {
console.info(TAG + 'Closed callbacks')
}
}
)
console.log(TAG + "audios resources stored. "+ JSON.stringify(value));
}).catch((err) => {
console.log(TAG + "An error occurred when storing audios resources."+ JSON.stringify(err));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetPromise3.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'storeMediaAssetPromise3';
@State StepTips: string = '操作步骤:点击“点击保存”按钮'+'\n'+'预期结果:成功保存视频,资源内容为“hello world”';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击保存').margin('2%').backgroundColor('#FFDDDDF8').fontSize(20).border({ width: 1 }).size({ width: '70%', height: '20%' })
.onClick(async () => {
let TAG = 'storeMediaAssetPromise3';
let data = await globalThis.abilityContext.getFilesDir();
let time = new Date().getTime();
console.log("data is"+ JSON.stringify(data));
data = 'data/storage/el2/base/haps/entry';
let PathMp4 = data + "/files/"+time + ".mp4";
let srcFd =await fileio.open(PathMp4,0o102,0o0600);
await fileio.write(srcFd,"hello world");
await fileio.close(srcFd);
let option = {
src : PathMp4,
mimeType : "video/mp4",
relativePath : "Videos/"
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).storeMediaAsset(option).then((value) => {
AlertDialog.show(
{
title: '保存成功',
message: '查询到Videos路径下新增一个.mp4格式的视频资源,资源内容为“hello world”',
confirm: {
value: 'OK',
action: () => {
console.info(TAG + ' Button-clicking callback')
}
},
cancel: () => {
console.info(TAG + ' Closed callbacks')
}
}
)
console.log(TAG + " videos resources stored. "+ JSON.stringify(value));
}).catch((err) => {
console.log(TAG + " An error occurred when storing videos resources."+ JSON.stringify(err));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetPromise4.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'storeMediaAssetPromise4';
@State StepTips: string = '操作步骤:点击“点击保存”按钮'+'\n'+'预期结果:成功保存文件,资源内容为“hello world”';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击保存').margin('2%').backgroundColor('#FFDDDDF8').fontSize(20).border({ width: 1 }).size({ width: '70%', height: '20%' })
.onClick(async () => {
let TAG = 'storeMediaAssetPromise4';
let data = await globalThis.abilityContext.getFilesDir();
let time = new Date().getTime();
console.log("data is"+ JSON.stringify(data));
data = 'data/storage/el2/base/haps/entry';
let PathPdf = data + "/files/"+time + ".Pdf";
let srcFd =await fileio.open(PathPdf,0o102,0o0600);
await fileio.write(srcFd,"hello world");
await fileio.close(srcFd);
let option = {
src : PathPdf,
mimeType : "file/pdf",
relativePath : "Documents/"
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).storeMediaAsset(option).then((value) => {
AlertDialog.show(
{
title: '保存成功',
message: '查询到Documents路径下新增一个.Pdf格式的文件资源,资源内容为“hello world”',
confirm: {
value: 'OK',
action: () => {
console.info(TAG + 'Button-clicking callback')
}
},
cancel: () => {
console.info(TAG + 'Closed callbacks')
}
}
)
console.log(TAG + "files resources stored. "+ JSON.stringify(value));
}).catch((err) => {
console.log(TAG + "An error occurred when storing files resources."+ JSON.stringify(err));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/MediaLibrary/storeMediaAssetPromise5.ets
已删除
100644 → 0
浏览文件 @
a98dd79a
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import fileio from '@ohos.fileio';
import featureAbility from '@ohos.ability.featureAbility';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
@Entry
@Component
struct SetCircle {
@State FillColor: string = '#FF000000';
@State name: string = 'storeMediaAssetPromise5';
@State StepTips: string = '操作步骤:点击“点击保存”按钮'+'\n'+'预期结果:保存图片失败';
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Text('点击保存').margin('2%').backgroundColor('#FFDDDDF8').fontSize(20).border({ width: 1 }).size({ width: '70%', height: '20%' })
.onClick(async () => {
let TAG = 'storeMediaAssetPromise5';
let data = await globalThis.abilityContext.getFilesDir();
let time = new Date().getTime();
console.log("data is"+ JSON.stringify(data));
data = 'data/storage/el2/base/haps/entry';
let JpgPath = data + "/files/"+time + ".jpg";
let srcFd =await fileio.open(JpgPath,0o102,0o0600);
await fileio.write(srcFd,"hello world");
await fileio.close(srcFd);
let option = {
src : JpgPath,
mimeType : "123",
relativePath : "Pictures/"
};
mediaLibrary.getMediaLibrary(globalThis.abilityContext).storeMediaAsset(option).then((value) => {
console.log(TAG + "image resources stored. "+ JSON.stringify(value));
}).catch((err) => {
AlertDialog.show(
{
title: '保存失败',
message: '媒体MIME类型错误',
confirm: {
value: 'OK',
action: () => {
console.info(TAG + 'Button-clicking callback')
}
},
cancel: () => {
console.info(TAG + 'Closed callbacks')
}
}
)
console.log(TAG + "An error occurred when storing image resources."+ JSON.stringify(err));
});
})
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
Column() {
CustomContainer({
title: this.name,
Url:'pages/MediaLibrary/MediaLibrary_index',
StepTips:this.StepTips,
content: this.specificNoParam,
FillColor:$FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/Player/Player_index.ets
0 → 100644
浏览文件 @
c931f334
/*
* 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 prompt from '@ohos.prompt';
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import xml from '@ohos.xml';
import fileIO from '@ohos.fileio';
import util from '@ohos.util';
import data_preferences from '@ohos.data.preferences';
const TAG = 'ParseXML';
let path = globalThis.dir;
let path1 = path + '/Player';
let VarColor = [];
let ColorBackPath = path + '/PlayerColorBack.txt';
let txtPath = path1 + 'PlayerReport.txt';
let xmlPath =path1 + 'PlayerTest.xml';
@Entry
@Component
struct IndexPage {
@State ClearAll : boolean = false;
private current : number = undefined;
@State count : number = 0;
@State result : string = '';
@State TEST : number = 0;
private TestCaseList = [
{title:'ScrollingList',uri:'pages/Player/ScrollListTest'},
]
@State ColorObject : string[] = VarColor;
async onPageShow(){
let Test = null;
let context =null;
context = globalThis.getContext();
let preferences;
let promise = data_preferences.getPreferences(context,'mystore');
await promise.then((object) => {
preferences = object;
});
promise = preferences.get('Player', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'Player'. Data: " + data);
});
if(Test != 1) {
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString();
fileio.writeSync(fd,log);
}
fileio.closeSync(fd);
}
promise = preferences.put('Player', 1);
promise.then(() => {
console.info("Succeeded in putting value of 'Player'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
this.TEST = Test;
let opt = fileio.openSync(ColorBackPath, 0o100 | 0o2002, 0o664);
let buff = new ArrayBuffer(40960);
fileio.readSync(opt,buff);
let ColorBack = String.fromCharCode.apply(null, new Uint8Array(buff));
let TestList = ColorBack.split(';');
for (let i = 0; i < Math.floor(TestList.length / 2); i++) {
VarColor[i] = TestList[i*2+1];
}
fileio.closeSync(opt);
if (this.count === 1){
this.result = router.getParams()['result'];
let titles = router.getParams()['title'];
let name1 = '刚刚点进了哪个用例:'+ titles;
let results = this.result;
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 11;
let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'Pass'){
this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = ColorBack.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles)
}
else if (this.result === 'Fail'){
this.ColorObject[this.current] = '#ffff0000';
let Log = (titles+';'+'#ffff0000'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = ColorBack.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles);
}
else if (this.result === 'None'){
this.ColorObject[this.current] = this.ColorObject[this.current];
}
}
}
build(){
Column(){
Row() {
Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black)
.onClick(() => {
router.back();
})
Row(){
Text('Player SubSystem')
.fontColor(Color.White)
.fontSize('22fp')
}.justifyContent(FlexAlign.SpaceAround).backgroundColor(Color.Black)
Row() {
Button(){
Image($r('app.media.ic_public_delete'))
.width('30vp')
.height('30vp')
}.backgroundColor(Color.Black)
.onClick(() => {
AlertDialog.show(
{
message: "是否删除所有记录",
primaryButton: {
value: 'Yes',
action: () => {
this.ClearAll = true;
this.ColorObject.forEach((value, index) => {
this.ColorObject[index] = '#ff808080';
});
this.ClearText();
prompt.showToast({
message: '结果已删除', duration: 1000
});
}
},
secondaryButton: {
value: 'No',
action: () => {
}
},
cancel: () => {
}
}
)
})
Button(){
Image($r('app.media.ic_public_save'))
.width('30vp')
.height('30vp')
.margin({ left: 30 })
}.backgroundColor(Color.Black)
.onClick(() => {
this.ReadTextParseXml();
AlertDialog.show({
message: "报告已生成,如需查看通过命令行输入'hdc_std file recv /data/app/el2/100/base/com.example.actsvalidator/haps/entry/files/Player/PlayerTest.xml -本地路径'",
confirm:{
value:'OK',
action:()=>{
prompt.showToast({
message: '报告已生成', duration: 1000
})
}
},
cancel: () => {
prompt.showToast({
message: '报告已生成', duration: 1000
});
}
})
})
}
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%').backgroundColor(Color.Black)
List({space:5}){
ForEach(this.TestCaseList,(item,index) => {
ListItem(){
Row(){
Text(item.title).fontSize(16).fontColor(Color.Black)
}.width('100%').height(50).alignItems(VerticalAlign.Center).backgroundColor(this.count===0&&this.TEST===0?'#ff808080':this.ColorObject[index])
.onClick(( )=>{
this.count = 1;
this.ClearAll=false;
this.current = index;
router.push({
url: item.uri,
})
})
}
},item => item.title)
}.width('100%').height('92%')
}.width('100%').height('100%').backgroundColor(Color.Black)
}
ClearText(){
fileio.rmdirSync(path1);
fileio.mkdirSync(path1);
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString();
fileio.writeSync(fd,log);
}
}
ReadTextParseXml(){
let ReportPath = path1 + '/PlayerReport.txt';
let dir = fileio.opendirSync(path1);
console.info("ssssss"+dir);
while (dir) {
let OP = fileio.openSync(ReportPath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(40960);
let RD = fileio.readSync(OP,buf);
console.info("ddddd"+RD);
let report;
function ab2str(buf) {
return report = String.fromCharCode.apply(null,new Uint8Array(buf));
}
ab2str(buf);
let str1 = report.split(";");
let title = [];
let result = [];
for(let i=0; i<Math.floor(str1.length/2); i++){
title[i] = str1[i*2];
result[i] = str1[i*2+1];
}
let FailIndex = report.indexOf('Fail');
let FailNum = 0;
while (FailIndex != -1) {
console.log(FailIndex);
FailNum++;
FailIndex = report.indexOf('Fail',FailIndex + 1);
}
let failNum = (FailNum).toString();
let PassIndex = report.indexOf('Pass');
let PassNum = 0;
while (PassIndex != -1) {
console.log(PassIndex);
PassNum++;
PassIndex = report.indexOf('Pass',PassIndex + 1);
}
let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString();
let ignoreNum = (24-TestNum).toString();
let arrayBuffer = new ArrayBuffer(40960);
let bufView = new DataView(arrayBuffer);
let serializer = new xml.XmlSerializer(bufView);
serializer.setDeclaration();
serializer.startElement("testsuite");
serializer.setAttributes("name","ActsPlayerTest");
serializer.setAttributes("time", " ");
serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0");
serializer.setAttributes("failures", failNum);
serializer.setAttributes("ignored", ignoreNum);
serializer.setAttributes("tests", testNum);
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("result", String(result[i]));
serializer.setAttributes("level", " ");
serializer.setAttributes("message", " ");
serializer.endElement();
}
serializer.endElement();
let that = new util.TextDecoder('utf-8');
let array = new Uint8Array(arrayBuffer);
let serializerStr = that.decode(array);
console.info(xmlPath);
try{
console.error(TAG,"write xmlPath =" +xmlPath);
var xmlfd = fileIO.openSync(xmlPath, 0o102, 0o666);
fileIO.writeSync(xmlfd,serializerStr);
}catch(err){
console.error(TAG,"read xmlPath =" + xmlPath + "error:" + err);
}finally{
fileIO.closeSync(xmlfd);
}
return;
}
}
}
function filewrite(name1,results,titles){
let fd = fileio.openSync(txtPath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
let RD = fileio.readSync(fd,buf);
console.info("RRRRRRRRRRd"+RD);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 6;
let Index = report.indexOf(WriteTitle);
let Log = (titles+";"+results+";").toString();
if (Index == -1){
fileio.writeSync(fd,Log);
}
else if (Index != -1){
let key = report.substring(Index,Index+number);
let FD = fileio.openSync(txtPath, 0o102, 0o666);
report = report.replace(key,Log);
let buffer = new ArrayBuffer(4096);
let rd = fileio.readSync(FD,buffer);
let Report = report.substring(0,rd);
fileio.closeSync(FD);
let Fd = fileio.openSync(txtPath, 0o102, 0o666);
fileio.writeSync(Fd,Report);
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/
MediaLibrary/startImagePreviewPromise4
.ets
→
validator/acts_validator/src/main/ets/pages/
Player/ScrollListTest
.ets
浏览文件 @
c931f334
/*
/*
* 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");
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary';
import {CustomContainer} from '../common/CustomContainer';
import {CustomContainer} from '../common/MediaCustomContainer';
import FirstDialog from '../model/FirstDialog';
import FirstDialog from '../model/FirstDialog';
@Entry
@Entry
@Component
@Component
struct CustomContainerUser {
struct SetCircle {
private listArr: number[] = Array.from(new Array(50).keys());
@State FillColor: string = '#FF000000';
@State name: string = 'ScrollingList';
@State name: string = 'startImagePreviewPromise4';
@State StepTips: string = '操作步骤:滑动列表观察是否能正常滑动'+'\n'+'预期结果:列表滑动正常';
@State StepTips: string = '测试步骤:点击“点击预览”按钮' + '\n' + '预期结果:预览图片失败';
@State Vue: boolean = false;
async aboutToAppear(){
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
await FirstDialog.ChooseDialog(this.StepTips,this.name);
}
this.Vue = true;
@Builder specificNoParam() {
}
Column() {
@Builder specificNoParam() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column() {
Text('点击预览').margin('5%').fontSize(20).border({ width: 1 }).size({ width: '75%', height: '30%' })
List() {
.onClick(() => {
ForEach(this.listArr,(item:any,index:number) => {
let TAG = 'startImagePreviewPromise4';
ListItem() {
let images = [
Text('Item #' + (index + 1)).width('100%').height(50).fontSize(16).fontColor(Color.White).margin({left:'10vp'})
"datashare:///media/image/9999",
}
"datashare:///media/image/9998",
},index => index)
"datashare:///media/image/9997",
}.height('100%').width('100%').divider({strokeWidth:1,color:Color.Grey})
];
}.height('83%').width('100%')
let index = 1;
}
mediaLibrary.getMediaLibrary(globalThis.abilityContext).startImagePreview(images, index).then(() => {
build() {
console.log(TAG + "Succeeded in previewing the images.");
Column() {
}).catch((err) => {
CustomContainer({
console.log(TAG + "An error occurred when previewing the images." + JSON.stringify(err));
title: this.name,
});
Url: 'pages/Player/Player_index',
})
StepTips: this.StepTips,
}
content: this.specificNoParam.bind(this),
}.width('100%').height('80%').backgroundColor(Color.White)
name: $name,
}
Vue: $Vue,
})
build() {
}.width('100%').height('100%').backgroundColor(Color.Black)
Column() {
}
CustomContainer({
}
title: this.name,
Url: 'pages/MediaLibrary/MediaLibrary_index',
StepTips: this.StepTips,
content: this.specificNoParam,
FillColor: $FillColor,
name:$name
})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
validator/acts_validator/src/main/ets/pages/common/CameraOrientation.ets
0 → 100644
浏览文件 @
c931f334
/*
* 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;
@Link Vue : boolean;
Url : string = '';
title : string = '';
StepTips: 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 + '/' + 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}`);
}
}
}
validator/acts_validator/src/main/ets/pages/index.ets
浏览文件 @
c931f334
此差异已折叠。
点击以展开。
validator/acts_validator/src/main/ets/pages/model/CameraService.ts
0 → 100644
浏览文件 @
c931f334
此差异已折叠。
点击以展开。
validator/acts_validator/src/main/ets/pages/model/DateTimeUtil.ts
浏览文件 @
c931f334
...
@@ -21,6 +21,10 @@ export default class DateTimeUtil {
...
@@ -21,6 +21,10 @@ export default class DateTimeUtil {
/**
/**
* 时分秒
* 时分秒
*/
*/
getTime
()
{
const
DATETIME
=
new
Date
()
return
this
.
concatTime
(
DATETIME
.
getHours
(),
DATETIME
.
getMinutes
(),
DATETIME
.
getSeconds
())
}
getHour
()
{
getHour
()
{
const
DATETIME
=
new
Date
()
const
DATETIME
=
new
Date
()
return
DATETIME
.
getHours
()
return
DATETIME
.
getHours
()
...
@@ -37,6 +41,10 @@ export default class DateTimeUtil {
...
@@ -37,6 +41,10 @@ export default class DateTimeUtil {
/**
/**
* 年月日
* 年月日
*/
*/
getDate
()
{
const
DATETIME
=
new
Date
()
return
this
.
concatDate
(
DATETIME
.
getFullYear
(),
DATETIME
.
getMonth
()
+
1
,
DATETIME
.
getDate
())
}
getFullYear
()
{
getFullYear
()
{
const
DATETIME
=
new
Date
()
const
DATETIME
=
new
Date
()
return
DATETIME
.
getFullYear
()
return
DATETIME
.
getFullYear
()
...
@@ -45,7 +53,7 @@ export default class DateTimeUtil {
...
@@ -45,7 +53,7 @@ export default class DateTimeUtil {
const
DATETIME
=
new
Date
()
const
DATETIME
=
new
Date
()
return
DATETIME
.
getMonth
()
+
1
return
DATETIME
.
getMonth
()
+
1
}
}
getDa
te
()
{
getDa
y
()
{
const
DATETIME
=
new
Date
()
const
DATETIME
=
new
Date
()
return
DATETIME
.
getDate
()
return
DATETIME
.
getDate
()
}
}
...
...
validator/acts_validator/src/main/ets/pages/model/FlushData.ets
0 → 100644
浏览文件 @
c931f334
/*
* 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 data_preferences from '@ohos.data.preferences';
export default class FlushData{
static ResetArkUI = async ()=>{
let Test = null;
let context =null;
context = globalThis.getContext();
let preferences;
let promise = data_preferences.getPreferences(context,'mystore');
await promise.then((object) => {
preferences = object;
});
promise = preferences.get('ArkUI', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'startup'. Data: " + data);
});
promise = preferences.put('ArkUI', 0);
promise.then(() => {
console.info("Succeeded in putting value of 'test'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
}
static ResetAudio = async ()=>{
let Test = null;
let context =null;
context = globalThis.getContext();
let preferences;
let promise = data_preferences.getPreferences(context,'mystore');
await promise.then((object) => {
preferences = object;
});
promise = preferences.get('Audio', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'Audio'. Data: " + data);
});
promise = preferences.put('Audio', 0);
promise.then(() => {
console.info("Succeeded in putting value of 'Audio'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
}
static ResetCamera = async ()=>{
let Test = null;
let context =null;
context = globalThis.getContext();
let preferences;
let promise = data_preferences.getPreferences(context,'mystore');
await promise.then((object) => {
preferences = object;
});
promise = preferences.get('Camera', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'startup'. Data: " + data);
});
promise = preferences.put('Camera', 0);
promise.then(() => {
console.info("Succeeded in putting value of 'test'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
}
static ResetPlayer = async ()=>{
let Test = null;
let context =null;
context = globalThis.getContext();
let preferences;
let promise = data_preferences.getPreferences(context,'mystore');
await promise.then((object) => {
preferences = object;
});
promise = preferences.get('Player', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'Player'. Data: " + data);
});
promise = preferences.put('Player', 0);
promise.then(() => {
console.info("Succeeded in putting value of 'Player'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
}
static ResetExperience = async ()=>{
let Test = null;
let context =null;
context = globalThis.getContext();
let preferences;
let promise = data_preferences.getPreferences(context,'mystore');
await promise.then((object) => {
preferences = object;
});
promise = preferences.get('Experience', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'Experience'. Data: " + data);
});
promise = preferences.put('Experience', 0);
promise.then(() => {
console.info("Succeeded in putting value of 'Experience'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/model/MediaUtils.ts
0 → 100644
浏览文件 @
c931f334
此差异已折叠。
点击以展开。
validator/acts_validator/src/main/ets/pages/model/RecordModel.ts
0 → 100644
浏览文件 @
c931f334
此差异已折叠。
点击以展开。
validator/acts_validator/src/main/module.json
浏览文件 @
c931f334
此差异已折叠。
点击以展开。
validator/acts_validator/src/main/resources/base/profile/main_pages.json
浏览文件 @
c931f334
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录