提交 2cda281e 编写于 作者: T tianwenzhe

change color state

Signed-off-by: Ntian-wenzhe411 <tianwenzhe2@huawei.com>
上级 bbabf558
import Ability from '@ohos.app.ability.UIAbility'
import Ability from '@ohos.app.ability.UIAbility';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import {FloatWindowFun} from '../pages/model/FloatWindowFun';
export default class MainAbility extends Ability {
onCreate(want, launchParam) {
......@@ -7,6 +8,7 @@ export default class MainAbility extends Ability {
console.log("[Demo] MainAbility onCreate")
globalThis.abilityWant = want;
globalThis.abilityContext = this.context;
globalThis.showFloatingWindow = false;
}
onDestroy() {
......@@ -17,15 +19,16 @@ export default class MainAbility extends Ability {
console.log("[Demo] MainAbility onWindowStageCreate")
let AtManager = abilityAccessCtrl.createAtManager();
AtManager.requestPermissionsFromUser(this.context,['ohos.permission.READ_MEDIA', 'ohos.permission.WRITE_MEDIA',
'ohos.permission.CAPTURE_SCREEN', 'ohos.permission.INTERNET', 'ohos.permission.CAMERA',
'ohos.permission.MICROPHONE', 'ohos.permission.START_INVISIBLE_ABILITY']).then( () => {} );
windowStage.loadContent('pages/index', (err, data) => {
AtManager.requestPermissionsFromUser(this.context,["ohos.permission.READ_MEDIA","ohos.permission.WRITE_MEDIA",
"ohos.permission.CAPTURE_SCREEN","ohos.permission.INTERNET","ohos.permission.CAMERA",
"ohos.permission.MICROPHONE", "ohos.permission.START_INVISIBLE_ABILITY",
"ohos.permission.SYSTEM_FLOAT_WINDOW"]).then(() => {})
windowStage.loadContent("pages/index", (err, data) => {
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));
return;
}
console.info( 'Succeeded in loading the content. Data: ' + JSON.stringify(data) );
console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
});
}
......@@ -34,6 +37,7 @@ export default class MainAbility extends Ability {
}
onForeground() {
FloatWindowFun.initAllFun();
console.log("[Demo] MainAbility onForeground")
}
......
......@@ -62,7 +62,9 @@ struct IndexPage {
{title:'CanvasShadowOffsetX',uri:'pages/ArkUI/CanvasShadowOffsetX'},
{title:'CanvasShadowOffsetY',uri:'pages/ArkUI/CanvasShadowOffsetY'},
]
@State ColorObject : string[] = VarColor;
@State ColorObject : Object[] = VarColor;
@State ColorTrue : Object[] = [];
@State ColorTrue2 : Object[] = [];
async onPageShow(){
let Test = null;
let context =null;
......@@ -82,7 +84,7 @@ struct IndexPage {
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();
let log = (this.TestCaseList[i].title+';'+'none '+';').toString();
fileio.writeSync(fd,log);
}
fileio.closeSync(fd);
......@@ -113,12 +115,12 @@ struct IndexPage {
let name1 = '刚刚点进了哪个用例:'+ titles;
let results = this.result;
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 11;
let number = WriteTitle.length + 7;
let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'true '){
this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';');
this.ColorObject[this.current] = 'true ';
let Log = (titles+';'+'true '+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
......@@ -131,8 +133,8 @@ struct IndexPage {
filewrite(name1,results,titles);
}
else if (this.result === 'false'){
this.ColorObject[this.current] = '#ffff0000';
let Log = (titles+';'+'#ffff0000'+';');
this.ColorObject[this.current] = 'false';
let Log = (titles+';'+'false'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
......@@ -148,6 +150,22 @@ struct IndexPage {
this.ColorObject[this.current] = this.ColorObject[this.current];
}
}
for (let i = 0; i < TestList.length; i++){
if (this.ColorObject[i] === 'true '){
this.ColorTrue[i] = 0x263526
this.ColorTrue2[i] = 0x0CB60C
}
else if (this.ColorObject[i] === 'false'){
this.ColorTrue[i] = 0x380303
this.ColorTrue2[i] = 0xd60a0a
}
else {
this.ColorTrue[i] = 0x000000
this.ColorTrue2[i] = 0x000000
}
}
}
build(){
Column(){
......@@ -178,7 +196,7 @@ struct IndexPage {
action: () => {
this.ClearAll = true;
this.ColorObject.forEach((value, index) => {
this.ColorObject[index] = '#ff808080';
this.ColorObject[index] = 'none ';
});
this.ClearText();
prompt.showToast({
......@@ -225,12 +243,13 @@ struct IndexPage {
})
}
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%').backgroundColor(Color.Black)
List({space:5}){
List({}){
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])
Text(item.title).fontSize(20).fontColor(Color.White)
}.width('100%').height(50).alignItems(VerticalAlign.Center)
.linearGradient(this.count===0&&this.TEST===0?{angle: 90,colors: [[0x000000, 0.0],[0x000000, 1.0]]}:{ angle: 90,colors: [[this.ColorTrue[index], 0.0], [this.ColorTrue2[index], 0.618]]})
.onClick(( )=>{
this.count = 1;
this.ClearAll=false;
......@@ -241,7 +260,7 @@ struct IndexPage {
})
}
},item => item.title)
}.width('100%').height('92%')
}.width('100%').height('92%').divider({strokeWidth:1,color:Color.Grey})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
ClearText(){
......@@ -249,7 +268,7 @@ struct IndexPage {
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();
let log = (this.TestCaseList[i].title+';'+'none '+';').toString();
fileio.writeSync(fd,log);
}
}
......
......@@ -28,9 +28,9 @@ struct LongPressGestureExample {
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.flower")).height('60%').width('70%')
Image($r("app.media.img")).height('60%').width('60%')
}
.height('250vp').width('350vp').padding(20)
.height('350vp').width('350vp').padding(20)
.gesture(
LongPressGesture({ repeat: true })
.onAction((event: GestureEvent) => {
......
......@@ -29,9 +29,9 @@ struct PanGestureExample {
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.flower")).height('60%').width('70%')
Image($r("app.media.img")).height('60%').width('60%')
}
.height('250vp').width('350vp').padding(20)
.height('350vp').width('350vp').padding(20)
.margin(80).translate({ x: this.X, y: this.Y, z: 5 })
.gesture(
PanGesture({})
......
......@@ -28,9 +28,9 @@ struct PinchGuestureTest {
@Builder specificNoParam() {
Column(){
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.flower")).height('60%').width('70%')
Image($r("app.media.img")).height('60%').width('60%')
}
.height('250vp').width('350vp').padding(20)
.height('350vp').width('350vp').padding(20)
.scale({ x: this.X, y: this.X, z: this.X })
.gesture(
PinchGesture()
......
......@@ -28,9 +28,9 @@ struct RotationGuestureTest {
@Builder specificNoParam() {
Column(){
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.flower")).height('60%').width('70%')
Image($r("app.media.img")).height('60%').width('60%')
}
.height('250vp').width('350vp').padding(20)
.height('350vp').width('350vp').padding(20)
.rotate({ x:1, y:1, z:1, angle: this.X })
.margin(80)
.gesture(
......
......@@ -29,9 +29,9 @@ struct SwipeGestureTest {
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.flower")).height('60%').width('70%')
Image($r("app.media.img")).height('60%').width('60%')
}
.height('250vp').width('350vp').padding(20)
.height('350vp').width('350vp').padding(20)
.rotate({x: 0, y: 0, z: 1, angle: this.X})
.gesture(
SwipeGesture({fingers: 1, direction: SwipeDirection.Vertical})
......
......@@ -28,9 +28,9 @@ struct TapGestureExample {
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.flower")).height('60%').width('70%')
Image($r("app.media.img")).height('60%').width('60%')
}
.height('250vp').width('350vp').padding(20)
.height('350vp').width('350vp').padding(20)
.gesture(
TapGesture({ count: 2 })
.onAction(() => {
......
......@@ -45,7 +45,9 @@ struct IndexPage {
{title:'AudioOutputRoutingTest(TypeC)',uri:'pages/Audio/AudioOutputRoutingTypeC'},
{title:'AudioOutputRoutingTest(BT)',uri:'pages/Audio/AudioOutputRoutingBT'},
]
@State ColorObject : string[] = VarColor;
@State ColorObject : Object[] = VarColor;
@State ColorTrue : Object[] = [];
@State ColorTrue2 : Object[] = [];
async onPageShow(){
let Test = null;
let context =null;
......@@ -65,7 +67,7 @@ struct IndexPage {
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();
let log = (this.TestCaseList[i].title+';'+'none '+';').toString();
fileio.writeSync(fd,log);
}
fileio.closeSync(fd);
......@@ -96,12 +98,12 @@ struct IndexPage {
let name1 = '刚刚点进了哪个用例:'+ titles;
let results = this.result;
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 11;
let number = WriteTitle.length + 7;
let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'true '){
this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';');
this.ColorObject[this.current] = 'true ';
let Log = (titles+';'+'true '+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
......@@ -114,8 +116,8 @@ struct IndexPage {
filewrite(name1,results,titles)
}
else if (this.result === 'false'){
this.ColorObject[this.current] = '#ffff0000';
let Log = (titles+';'+'#ffff0000'+';');
this.ColorObject[this.current] = 'false';
let Log = (titles+';'+'false'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
......@@ -127,10 +129,25 @@ struct IndexPage {
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles);
}
else if (this.result === 'None'){
else {
this.ColorObject[this.current] = this.ColorObject[this.current];
}
}
for (let i = 0; i < TestList.length; i++){
if (this.ColorObject[i] === 'true '){
this.ColorTrue[i] = 0x263526
this.ColorTrue2[i] = 0x0CB60C
}
else if (this.ColorObject[i] === 'false'){
this.ColorTrue[i] = 0x380303
this.ColorTrue2[i] = 0xd60a0a
}
else {
this.ColorTrue[i] = 0x000000
this.ColorTrue2[i] = 0x000000
}
}
}
build(){
Column(){
......@@ -161,7 +178,7 @@ struct IndexPage {
action: () => {
this.ClearAll = true;
this.ColorObject.forEach((value, index) => {
this.ColorObject[index] = '#ff808080';
this.ColorObject[index] = 'none ';
});
this.ClearText();
prompt.showToast({
......@@ -208,12 +225,13 @@ struct IndexPage {
})
}
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%').backgroundColor(Color.Black)
List({space:5}){
List({}){
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])
Text(item.title).fontSize(20).fontColor(Color.White)
}.width('100%').height(50).alignItems(VerticalAlign.Center)
.linearGradient(this.count===0&&this.TEST===0?{angle: 90,colors: [[0x000000, 0.0],[0x000000, 1.0]]}:{ angle: 90,colors: [[this.ColorTrue[index], 0.0], [this.ColorTrue2[index], 0.618]]})
.onClick(( )=>{
this.count = 1;
this.ClearAll=false;
......@@ -224,7 +242,7 @@ struct IndexPage {
})
}
},item => item.title)
}.width('100%').height('92%')
}.width('100%').height('92%').divider({strokeWidth:1,color:Color.Grey})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
ClearText(){
......
......@@ -46,7 +46,9 @@ struct IndexPage {
{ title: 'CameraVideo', uri: 'pages/Camera/CameraVideo' },
{ title: 'CameraFlash', uri: 'pages/Camera/CameraFlash' },
]
@State ColorObject : string[] = VarColor;
@State ColorObject : Object[] = VarColor;
@State ColorTrue : Object[] = [];
@State ColorTrue2 : Object[] = [];
async onPageShow(){
let Test = null;
let context =null;
......@@ -66,7 +68,7 @@ struct IndexPage {
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();
let log = (this.TestCaseList[i].title+';'+'none '+';').toString();
fileio.writeSync(fd,log);
}
fileio.closeSync(fd);
......@@ -97,12 +99,12 @@ struct IndexPage {
let name1 = '刚刚点进了哪个用例:'+ titles;
let results = this.result;
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 11;
let number = WriteTitle.length + 7;
let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'true '){
this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';');
this.ColorObject[this.current] = 'true ';
let Log = (titles+';'+'true '+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
......@@ -115,8 +117,8 @@ struct IndexPage {
filewrite(name1,results,titles)
}
else if (this.result === 'false'){
this.ColorObject[this.current] = '#ffff0000';
let Log = (titles+';'+'#ffff0000'+';');
this.ColorObject[this.current] = 'false';
let Log = (titles+';'+'false'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
......@@ -128,10 +130,25 @@ struct IndexPage {
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles);
}
else if (this.result === 'None'){
else {
this.ColorObject[this.current] = this.ColorObject[this.current];
}
}
for (let i = 0; i < TestList.length; i++){
if (this.ColorObject[i] === 'true '){
this.ColorTrue[i] = 0x263526
this.ColorTrue2[i] = 0x0CB60C
}
else if (this.ColorObject[i] === 'false'){
this.ColorTrue[i] = 0x380303
this.ColorTrue2[i] = 0xd60a0a
}
else {
this.ColorTrue[i] = 0x000000
this.ColorTrue2[i] = 0x000000
}
}
}
build(){
Column(){
......@@ -143,9 +160,9 @@ struct IndexPage {
router.back();
})
Row(){
Text('Camera')
Text('Camera SubSystem')
.fontColor(Color.White)
.fontSize('20fp')
.fontSize('22fp')
}.justifyContent(FlexAlign.SpaceAround).backgroundColor(Color.Black)
Row() {
Button(){
......@@ -162,7 +179,7 @@ struct IndexPage {
action: () => {
this.ClearAll = true;
this.ColorObject.forEach((value, index) => {
this.ColorObject[index] = '#ff808080';
this.ColorObject[index] = 'none ';
});
this.ClearText();
prompt.showToast({
......@@ -209,12 +226,13 @@ struct IndexPage {
})
}
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%').backgroundColor(Color.Black)
List({space:5}){
List({}){
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])
Text(item.title).fontSize(20).fontColor(Color.White)
}.width('100%').height(50).alignItems(VerticalAlign.Center)
.linearGradient(this.count===0&&this.TEST===0?{angle: 90,colors: [[0x000000, 0.0],[0x000000, 1.0]]}:{ angle: 90,colors: [[this.ColorTrue[index], 0.0], [this.ColorTrue2[index], 0.618]]})
.onClick(( )=>{
this.count = 1;
this.ClearAll=false;
......@@ -225,7 +243,7 @@ struct IndexPage {
})
}
},item => item.title)
}.width('100%').height('92%')
}.width('100%').height('92%').divider({strokeWidth:1,color:Color.Grey})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
ClearText(){
......@@ -233,7 +251,7 @@ struct IndexPage {
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();
let log = (this.TestCaseList[i].title+';'+'none '+';').toString();
fileio.writeSync(fd,log);
}
}
......
......@@ -13,20 +13,18 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let CameraColdPath = path1 + '/ColdStartCamera.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'CameraColdStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延小于2300ms则测试通过';
@State toSP_daemon: string = 'SP_daemon -editor coldStartHM com.ohos.camera 相机 ohtest';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State num: number = 0;
......@@ -39,6 +37,9 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.resultNum = 'time:-1000';
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -51,10 +52,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面` + '\n' + '\n'
+ `3.清空后台应用,将底层任务栏中应用拖至桌面` + '\n' + '\n' + `4.工作台运行‘点击启动测试.bat’选择冷启动>相机测试,回车执行`
+ '\n' + '\n' +`5.测试应用自动执行冷启动后手动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果'
+ '\n' + '\n' + `7.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面` + '\n' + '\n'
+ `2.清空后台应用` + '\n' + '\n' + `3.快速点击桌面相机应用` + '\n' + '\n' +`4.测试应用拉起后手动返回validator界面`
+ '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -66,6 +66,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.num = 0;
this.StartEnable = !this.StartEnable;
let str = {
......@@ -87,14 +88,12 @@ struct CustomContainerUser {
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
/*
camera
*/
let CameraFd = fileio.openSync(CameraColdPath, 0o100 | 0o2002, 0o664);
let CameraBuf = new ArrayBuffer(4096);
fileio.readSync(CameraFd,CameraBuf);
let CameraReport = String.fromCharCode.apply(null,new Uint8Array(CameraBuf));
this.StartEnable = !this.StartEnable;
// /*
// camera
// */
let CameraReport = globalThis.resultNum;
let CameraHead = CameraReport.indexOf('time:');
let CameraTime = CameraReport.substring(CameraHead+5);
this.cameraNum = parseFloat(CameraTime);
......@@ -104,6 +103,7 @@ struct CustomContainerUser {
if( this.num === 1 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,15 +13,12 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let ContactsColdPath = path1 + '/ColdStartContacts.log';
@Entry
@Component
struct CustomContainerUser {
......@@ -35,10 +32,13 @@ struct CustomContainerUser {
@State mmsNum: number = 0;
@State cameraNum: number = 0;
@State contactsNum: number = 0;
@State toSP_daemon: string = 'SP_daemon -editor coldStartHM com.ohos.contacts 联系人 ohtest'
scroller: Scroller = new Scroller();
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -51,10 +51,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面` + '\n' + '\n'
+ `3.清空后台应用,将底层任务栏中应用拖至桌面` + '\n' + '\n' + `4.工作台运行‘点击启动测试.bat’选择冷启动>联系人测试,回车执行`
+ '\n' + '\n' +`5.测试应用自动执行冷启动后手动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果'
+ '\n' + '\n' + `7.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面` + '\n' + '\n'
+ `2.清空后台应用` + '\n' + '\n' + `3.快速点击桌面联系人应用` + '\n' + '\n' +`4.测试应用拉起后手动返回validator界面`
+ '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -66,6 +65,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.num = 0;
this.StartEnable = !this.StartEnable;
let str = {
......@@ -87,14 +87,11 @@ struct CustomContainerUser {
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
this.StartEnable = !this.StartEnable;
/*
Contacts
*/
let ContactsFd = fileio.openSync(ContactsColdPath, 0o100 | 0o2002, 0o664);
let ContactsBuf = new ArrayBuffer(4096);
fileio.readSync(ContactsFd,ContactsBuf);
let ContactsReport = String.fromCharCode.apply(null,new Uint8Array(ContactsBuf));
let ContactsReport = globalThis.resultNum;
let ContactsHead = ContactsReport.indexOf('time:');
let ContactsTime = ContactsReport.substring(ContactsHead+5);
this.contactsNum = parseFloat(ContactsTime);
......@@ -104,6 +101,7 @@ struct CustomContainerUser {
if( this.num === 1 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,20 +13,17 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let ContactsColdPath = path1 + '/HotStartContacts.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'ContactsHotStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延小于600ms则测试通过';
@State toSP_daemon: string = 'SP_daemon -editor hotStart com.ohos.contacts 联系人 ohtest';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:应用热启动时延小于600ms则测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State num: number = 0;
......@@ -39,6 +36,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -51,10 +50,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面`+ '\n' + '\n'
+ `3.开启联系人应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择热启动>联系人测试`+ '\n' + '\n' +
`5.测试应用手动执行热启动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果' + '\n' + '\n'
+ `7.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n'
+ `2.开启联系人应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `3.再次启动桌面联系人应用`+ '\n' + '\n' +
`4.测试应用拉起后返回validator界面` + '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n'
+ `6.若联系人热启动测试在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -66,6 +65,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.num = 0;
this.StartEnable = !this.StartEnable;
let str = {
......@@ -87,14 +87,11 @@ struct CustomContainerUser {
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
this.StartEnable = !this.StartEnable;
/*
Contacts
*/
let ContactsFd = fileio.openSync(ContactsColdPath, 0o100 | 0o2002, 0o664);
let ContactsBuf = new ArrayBuffer(4096);
fileio.readSync(ContactsFd,ContactsBuf);
let ContactsReport = String.fromCharCode.apply(null,new Uint8Array(ContactsBuf));
let ContactsReport = globalThis.resultNum;
let ContactsHead = ContactsReport.indexOf(':');
let ContactsTime = ContactsReport.substring(ContactsHead+1);
this.contactsNum = parseFloat(ContactsTime);
......@@ -104,6 +101,7 @@ struct CustomContainerUser {
if( this.num === 1 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,20 +13,18 @@
* limitations under the License.
*/
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/ExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
import router from '@ohos.router';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let Xpath = path1 + '/DeskFps.log'
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'DeskFps';
@State toSP_daemon: string = 'SP_daemon -editor fpsohtest com.ohos.launcher 桌面';
@State StepTips: string = '操作步骤:根据操作提示滑动系统桌面测试帧率'+'\n'+'预期结果:帧率大于55帧测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
......@@ -35,6 +33,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -47,9 +47,8 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面`+ '\n' + '\n'
+ `3.工作台运行’点击启动测试.bat‘选择帧率>桌面`+ '\n' + '\n' +`4.左右滑动系统桌面连续10s以上` + '\n' + '\n'
+ '5.回到DeskFps测试项点击结束键' + '\n' + '\n' + `6.若测试最高帧率大于55帧则通过测试`
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.左右滑动系统桌面连续10s以上`
+ '\n' + '\n' + '3.回到DeskFps测试项点击结束键' + '\n' + '\n' + `4.若测试最高帧率大于55帧则通过测试`
+ '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
......@@ -62,6 +61,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
......@@ -83,32 +83,33 @@ struct CustomContainerUser {
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let headList = new Array();
let endList = new Array();
let head = report.indexOf(":");
let end = report.indexOf('|');
let Fps = new Array();
while(head > -1){
headList.push(head);
head = report.indexOf(":",head + 1);
}
while(end > -1){
endList.push(end);
end = report.indexOf("|",end + 1);
}
for(let i = 0; i < headList.length; i++) {
Fps[i] = Number(report.substring(headList[i]+1,endList[i]));
}
let maxFps = Math.max(...Fps);
let report = globalThis.resultNum;
// let headList = new Array();
// let endList = new Array();
// let head = report.indexOf(":");
// let end = report.indexOf('|');
// let Fps = new Array();
//
// while(head > -1){
// headList.push(head);
// head = report.indexOf(":",head + 1);
// }
// while(end > -1){
// endList.push(end);
// end = report.indexOf("|",end + 1);
// }
// for(let i = 0; i < headList.length; i++) {
// Fps[i] = Number(report.substring(headList[i]+1,endList[i]));
// }
let reg = /fps:(\d+)/g;
let matches = report.match(reg);
let fpsValues = matches.map(match => parseInt(match.substring(4)));
let maxFps = Math.max(...fpsValues);
this.Fps = maxFps.toString();
if(maxFps >= 55) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -59,7 +59,13 @@ struct IndexPage {
{title:'ScrollPhotosList',uri:'pages/Experience/ScrollPhotosList'},
{title:'KeyboardInput',uri:'pages/Experience/KeyboardInputTest'},
]
@State ColorObject : string[] = VarColor;
@State ColorObject : Object[] = VarColor;
@State ColorTrue : Object[] = [];
@State ColorTrue2 : Object[] = [];
aboutToAppear() {
globalThis.CreateFloatingWindow();
// globalThis.HideFloatingWindow();
}
async onPageShow(){
let Test = null;
let context =null;
......@@ -79,7 +85,7 @@ struct IndexPage {
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();
let log = (this.TestCaseList[i].title+';'+'none '+';').toString();
fileio.writeSync(fd,log);
}
fileio.closeSync(fd);
......@@ -110,12 +116,12 @@ struct IndexPage {
let name1 = '刚刚点进了哪个用例:'+ titles;
let results = this.result;
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 11;
let number = WriteTitle.length + 7;
let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'true '){
this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';');
this.ColorObject[this.current] = 'true ';
let Log = (titles+';'+'true '+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
......@@ -128,8 +134,8 @@ struct IndexPage {
filewrite(name1,results,titles)
}
else if (this.result === 'false'){
this.ColorObject[this.current] = '#ffff0000';
let Log = (titles+';'+'#ffff0000'+';');
this.ColorObject[this.current] = 'false';
let Log = (titles+';'+'false'+';');
let key = ColorBack.substring(Index,Index+number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log);
......@@ -141,10 +147,25 @@ struct IndexPage {
fileio.writeSync(Fd,Report);
filewrite(name1,results,titles);
}
else if (this.result === 'None'){
else {
this.ColorObject[this.current] = this.ColorObject[this.current];
}
}
for (let i = 0; i < TestList.length; i++){
if (this.ColorObject[i] === 'true '){
this.ColorTrue[i] = 0x263526
this.ColorTrue2[i] = 0x0CB60C
}
else if (this.ColorObject[i] === 'false'){
this.ColorTrue[i] = 0x380303
this.ColorTrue2[i] = 0xd60a0a
}
else {
this.ColorTrue[i] = 0x000000
this.ColorTrue2[i] = 0x000000
}
}
}
build(){
Column(){
......@@ -175,7 +196,7 @@ struct IndexPage {
action: () => {
this.ClearAll = true;
this.ColorObject.forEach((value, index) => {
this.ColorObject[index] = '#ff808080';
this.ColorObject[index] = 'none ';
});
this.ClearText();
prompt.showToast({
......@@ -222,12 +243,13 @@ struct IndexPage {
})
}
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%').backgroundColor(Color.Black)
List({space:5}){
List({}){
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])
Text(item.title).fontSize(20).fontColor(Color.White)
}.width('100%').height(50)
.linearGradient(this.count===0&&this.TEST===0?{angle: 90,colors: [[0x000000, 0.0],[0x000000, 1.0]]}:{ angle: 90,colors: [[this.ColorTrue[index], 0.0], [this.ColorTrue2[index], 0.618]]})
.onClick(( )=>{
this.count = 1;
this.ClearAll=false;
......@@ -238,7 +260,7 @@ struct IndexPage {
})
}
},item => item.title)
}.width('100%').height('92%')
}.width('100%').height('92%').divider({strokeWidth:1,color:Color.Grey})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
ClearText(){
......@@ -248,7 +270,7 @@ struct IndexPage {
fileio.mkdirSync(ExperienceDataPath);
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString();
let log = (this.TestCaseList[i].title+';'+'none '+';').toString();
fileio.writeSync(fd,log);
}
}
......
......@@ -12,19 +12,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let Xpath = path1 + '/CompleteTimeKeyboard.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'KeyboardDisplay';
@State toSP_daemon: string = 'SP_daemon -editor completeTime com.example.kikakeyboard ohtest';
@State StepTips: string = '操作步骤:根据操作提示点击输入框等待键盘加载'+'\n'+'预期结果:输入键盘弹出时延小于1000ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
......@@ -33,6 +30,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -45,10 +44,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入信息` + '\n' + '\n' +
'3.新建一条信息显示输入框'+ '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择完成时延>键盘按键弹出`+ '\n' + '\n' +
`5.点击输入框等待键盘弹出` + '\n' + '\n' + '6.待脚本执行结束回到Validator点击结束键' + '\n' + '\n'
+ `7.若弹出键盘时延小于或等于1000ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入信息` + '\n' + '\n' + '2.新建一条信息显示输入框'+ '\n' + '\n'
+ `3.点击输入框等待键盘弹出` + '\n' + '\n' + '4.测试结束回到Validator点击结束键' + '\n' + '\n'
+ `5.若弹出键盘时延小于或等于1000ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -60,6 +58,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.StartEnable = !this.StartEnable;
let bundleName=new String("com.ohos.mms").toString();
let abilityName=new String("com.ohos.mms.MainAbility").toString();
......@@ -84,16 +83,14 @@ struct CustomContainerUser {
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let report = globalThis.resultNum;
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
let time = parseFloat(this.time);
if( 0 < time && time < 1000 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -12,19 +12,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let Xpath = path1 + '/ResponseTimeKeyboard.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'KeyboardInput';
@State toSP_daemon: string = 'SP_daemon -editor responseTime com.example.kikakeyboard ohtest';
@State StepTips: string = '操作步骤:根据操作提示点击键盘按键'+'\n'+'预期结果:键盘输入响应时延小于150ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
......@@ -33,6 +29,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -45,10 +43,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入信息` + '\n' + '\n' +
'3.新建一条信息点击输入框打开键盘'+ '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择响应时延>键盘按键输入`+ '\n' + '\n'
+`5.随意点击按键等待响应` + '\n' + '\n' + '6.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' +
`7.若按键响应时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入信息` + '\n' + '\n' + '2.新建一条信息点击输入框打开键盘'+ '\n' +
'\n' + `3.随意点击按键等待响应` + '\n' + '\n' + '4.待测试结束回到Validator点击结束键' + '\n' + '\n' +
`5.若按键响应时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -60,6 +57,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.StartEnable = !this.StartEnable;
let bundleName=new String("com.ohos.mms").toString();
let abilityName=new String("com.ohos.mms.MainAbility").toString();
......@@ -83,17 +81,15 @@ struct CustomContainerUser {
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
this.StartEnable = !this.StartEnable;
let report = globalThis.resultNum;
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( 0 < time && time < 150 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,20 +13,17 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let MmsColdPath = path1 + '/ColdStartMms.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'MmsColdStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延小于2300ms则测试通过';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:应用冷启动时延小于2300ms则测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State num: number = 0;
......@@ -35,10 +32,13 @@ struct CustomContainerUser {
@State mmsNum: number = 0;
@State cameraNum: number = 0;
@State contactsNum: number = 0;
@State toSP_daemon: string = 'SP_daemon -editor coldStartHM com.ohos.mms 信息 ohtest'
scroller: Scroller = new Scroller();
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -51,10 +51,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面` + '\n' + '\n'
+ `3.清空后台应用,将底层任务栏中应用拖至桌面` + '\n' + '\n' + `4.工作台运行‘点击启动测试.bat’选择冷启动>信息测试,回车执行`
+ '\n' + '\n' +`5.测试应用自动执行冷启动后手动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果'
+ '\n' + '\n' + `7.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面` + '\n' + '\n'
+ `2.清空后台应用` + '\n' + '\n' + `3.快速点击桌面信息应用` + '\n' + '\n' +`4.测试应用拉起后手动返回validator界面`
+ '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -66,6 +65,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.num = 0;
this.StartEnable = !this.StartEnable;
let str = {
......@@ -87,14 +87,11 @@ struct CustomContainerUser {
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
this.StartEnable = !this.StartEnable;
/*
mms
*/
let MmsFd = fileio.openSync(MmsColdPath, 0o100 | 0o2002, 0o664);
let MmsBuf = new ArrayBuffer(4096);
fileio.readSync(MmsFd,MmsBuf);
let MmsReport = String.fromCharCode.apply(null,new Uint8Array(MmsBuf));
let MmsReport = globalThis.resultNum;
let MmsHead = MmsReport.indexOf('time:');
let MmsTime = MmsReport.substring(MmsHead+5);
this.mmsNum = parseFloat(MmsTime);
......@@ -104,6 +101,7 @@ struct CustomContainerUser {
if( this.num === 1 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,19 +13,17 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let MmsColdPath = path1 + '/HotStartMms.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'MmsHotStart';
@State toSP_daemon: string = 'SP_daemon -editor hotStart com.ohos.mms 信息 ohtest';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延小于600ms则测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
......@@ -39,6 +37,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -51,10 +51,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面`+ '\n' + '\n'
+ `3.开启信息应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择热启动>信息测试`+ '\n' + '\n' +
`5.测试应用手动执行热启动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果' + '\n' + '\n'
+ `7.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n'
+ `2.开启信息应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `3.再次启动桌面信息应用`+ '\n' + '\n' +
`4.测试应用拉起后返回validator界面` + '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n'
+ `6.若信息热启动测试在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -67,6 +67,7 @@ struct CustomContainerUser {
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
this.num = 0;
globalThis.ShowFloatingWindow();
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
......@@ -91,10 +92,7 @@ struct CustomContainerUser {
/*
mms
*/
let MmsFd = fileio.openSync(MmsColdPath, 0o100 | 0o2002, 0o664);
let MmsBuf = new ArrayBuffer(4096);
fileio.readSync(MmsFd,MmsBuf);
let MmsReport = String.fromCharCode.apply(null,new Uint8Array(MmsBuf));
let MmsReport = globalThis.resultNum;
let MmsHead = MmsReport.indexOf(':');
let MmsTime = MmsReport.substring(MmsHead+1);
this.mmsNum = parseFloat(MmsTime);
......@@ -104,6 +102,7 @@ struct CustomContainerUser {
if( this.num === 1 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,18 +13,14 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/ExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let Xpath = path1 + '/PhotoFps.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'PhotoFps';
@State toSP_daemon: string = 'SP_daemon -editor fpsohtest com.ohos.photos 图库';
@State StepTips: string = '操作步骤:根据操作提示滑动图库测试帧率'+'\n'+'预期结果:帧率大于或等于55帧测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
......@@ -33,6 +29,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -45,10 +43,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.在图库中预置500张图片`+ '\n' + '\n'
+ `3.点击开始键进入图库`+ '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择帧率>图库`+ '\n' + '\n' +
`5.滑动图库缩略图界面连续10s以上` + '\n' + '\n' + '6.回到PhotoFps测试项点击结束键' + '\n' + '\n' +
`7.若测试最高帧率大于或等于55帧则通过测试` + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.在图库中预置500张图片`+ '\n' + '\n' + `2.点击开始键进入图库`
+ '\n' + '\n' + `3.滑动图库缩略图界面连续10s以上` + '\n' + '\n' + '4.回到PhotoFps测试项点击结束键' + '\n' + '\n' +
`5.若测试最高帧率大于或等于55帧则通过测试` + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -60,6 +57,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.StartEnable = !this.StartEnable;
let bundleName=new String("com.ohos.photos").toString();
let abilityName=new String("com.ohos.photos.MainAbility").toString();
......@@ -83,33 +81,17 @@ struct CustomContainerUser {
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let headList = new Array();
let endList = new Array();
let head = report.indexOf(":");
let end = report.indexOf('|');
let Fps = new Array();
while(head > -1){
headList.push(head);
head = report.indexOf(":",head + 1);
}
while(end > -1){
endList.push(end);
end = report.indexOf("|",end + 1);
}
for(let i = 0; i < headList.length; i++) {
Fps[i] = Number(report.substring(headList[i]+1,endList[i]));
}
let maxFps = Math.max(...Fps);
this.StartEnable = !this.StartEnable;
let report = globalThis.resultNum;
let reg = /fps:(\d+)/g;
let matches = report.match(reg);
let fpsValues = matches.map(match => parseInt(match.substring(4)));
let maxFps = Math.max(...fpsValues);
this.Fps = maxFps.toString();
if(maxFps >= 55) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,20 +13,17 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let PhotosColdPath = path1 + '/ColdStartPhotos.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'PhotosColdStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延小于2300ms则测试通过';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:应用冷启动时延小于2300ms则测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State num: number = 0;
......@@ -35,10 +32,13 @@ struct CustomContainerUser {
@State mmsNum: number = 0;
@State cameraNum: number = 0;
@State contactsNum: number = 0;
@State toSP_daemon: string = 'SP_daemon -editor coldStartHM com.ohos.photos 图库 ohtest';
scroller: Scroller = new Scroller();
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -51,10 +51,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面` + '\n' + '\n'
+ `3.清空后台应用,将底层任务栏中应用拖至桌面` + '\n' + '\n' + `4.工作台运行‘点击启动测试.bat’选择冷启动>图库测试,回车执行`
+ '\n' + '\n' +`5.测试应用自动执行冷启动后手动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果'
+ '\n' + '\n' + `7.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面` + '\n' + '\n'
+ `2.清空后台应用` + '\n' + '\n' + `3.快速点击桌面图库应用` + '\n' + '\n' +`4.测试应用拉起后手动返回validator界面`
+ '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -66,6 +65,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.num = 0;
this.StartEnable = !this.StartEnable;
let str = {
......@@ -87,14 +87,11 @@ struct CustomContainerUser {
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
this.StartEnable = !this.StartEnable;
/*
photos
*/
let photosFd = fileio.openSync(PhotosColdPath, 0o100 | 0o2002, 0o664);
let photosBuf = new ArrayBuffer(4096);
fileio.readSync(photosFd,photosBuf);
let photosReport = String.fromCharCode.apply(null,new Uint8Array(photosBuf));
let photosReport = globalThis.resultNum;
let photosHead = photosReport.indexOf('time:');
let photosTime = photosReport.substring(photosHead+5);
this.photosNum = parseFloat(photosTime);
......@@ -104,6 +101,7 @@ struct CustomContainerUser {
if( this.num === 1 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,20 +13,18 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let PhotosColdPath = path1 + '/HotStartPhotos.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'PhotosHotStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延小于600ms则测试通过';
@State toSP_daemon: string = 'SP_daemon -editor hotStart com.ohos.photos 图库 ohtest';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:应用热启动时延小于600ms则测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State num: number = 0;
......@@ -39,6 +37,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -51,10 +51,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面`+ '\n' + '\n'
+ `3.开启图库应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择热启动>图库测试`+ '\n' + '\n' +
`5.测试应用手动执行热启动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果' + '\n' + '\n'
+ `7.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n'
+ `2.开启图库应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `3.再次启动桌面图库应用`+ '\n' + '\n' +
`4.测试应用拉起后返回validator界面` + '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n'
+ `6.若图库热启动测试在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -66,6 +66,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.num = 0;
this.StartEnable = !this.StartEnable;
let str = {
......@@ -87,14 +88,11 @@ struct CustomContainerUser {
.enabled(!this.StartEnable)
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
this.StartEnable = !this.StartEnable;
/*
photos
*/
let photosFd = fileio.openSync(PhotosColdPath, 0o100 | 0o2002, 0o664);
let photosBuf = new ArrayBuffer(4096);
fileio.readSync(photosFd,photosBuf);
let photosReport = String.fromCharCode.apply(null,new Uint8Array(photosBuf));
let photosReport = globalThis.resultNum;
let photosHead = photosReport.indexOf(':');
let photosTime = photosReport.substring(photosHead+1);
this.photosNum = parseFloat(photosTime);
......@@ -104,6 +102,7 @@ struct CustomContainerUser {
if( this.num === 1 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,18 +13,14 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let Xpath = path1 + '/ResponseTimePhotos.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'ScrollPhotosList';
@State toSP_daemon: string = 'SP_daemon -editor responseTime com.ohos.photos ohtest';
@State StepTips: string = '操作步骤:根据操作提示滑动图库缩略表'+'\n'+'预期结果:滑动响应时延小于150ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
......@@ -33,6 +29,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -45,10 +43,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.在图库中预置500张图片`+ '\n' + '\n'
+`3.点击开始键进入图库`+ '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择响应时延>图库缩略列表滑动`+ '\n' + '\n' +
`5.滑动图库缩略列表等待响应` + '\n' + '\n' + '6.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' +
`7.若滑动响应时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.在图库中预置500张图片`+ '\n' + '\n' +`2.点击开始键进入图库`
+ '\n' + '\n' + `3.滑动图库缩略列表等待响应` + '\n' + '\n' + '4.待测试结束回到Validator点击结束键' + '\n' + '\n' +
`5.若滑动响应时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -60,6 +57,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.StartEnable = !this.StartEnable;
let bundleName=new String("com.ohos.photos").toString();
let abilityName=new String("com.ohos.photos.MainAbility").toString();
......@@ -84,16 +82,14 @@ struct CustomContainerUser {
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let report = globalThis.resultNum;
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( 0 < time && time < 150 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,20 +13,17 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let SettingsColdPath = path1 + '/ColdStartSetting.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'SettingsColdStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延小于2300ms则测试通过';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:应用冷启动时延小于2300ms则测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State num: number = 0;
......@@ -35,10 +32,13 @@ struct CustomContainerUser {
@State mmsNum: number = 0;
@State cameraNum: number = 0;
@State contactsNum: number = 0;
@State toSP_daemon: string = 'SP_daemon -editor coldStartHM com.ohos.settings 设置 ohtest';
scroller: Scroller = new Scroller();
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -51,10 +51,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面` + '\n' + '\n'
+ `3.清空后台应用,将底层任务栏中应用拖至桌面` + '\n' + '\n' + `4.工作台运行‘点击启动测试.bat’选择冷启动>设置测试,回车执行`
+ '\n' + '\n' +`5.测试应用自动执行冷启动后手动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果'
+ '\n' + '\n' + `7.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面` + '\n' + '\n'
+ `2.清空后台应用` + '\n' + '\n' + `3.快速点击桌面设置应用` + '\n' + '\n' +`4.测试应用拉起后手动返回validator界面`
+ '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -66,6 +65,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.num = 0;
this.StartEnable = !this.StartEnable;
let str = {
......@@ -91,10 +91,7 @@ struct CustomContainerUser {
/*
settings
*/
let setFd = fileio.openSync(SettingsColdPath, 0o100 | 0o2002, 0o664);
let setBuf = new ArrayBuffer(4096);
fileio.readSync(setFd,setBuf);
let setReport = String.fromCharCode.apply(null,new Uint8Array(setBuf));
let setReport = globalThis.resultNum;
let setHead = setReport.indexOf('time:');
let setTime = setReport.substring(setHead+5);
this.setNum = parseFloat(setTime);
......@@ -104,6 +101,7 @@ struct CustomContainerUser {
if( this.num === 1 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,20 +13,18 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/StartExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let SettingsColdPath = path1 + '/HotStartSetting.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'SettingsHotStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延小于600ms则测试通过';
@State toSP_daemon: string = 'SP_daemon -editor hotStart com.ohos.settings 设置 ohtest';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:应用热启动时延小于600ms则测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
@State num: number = 0;
......@@ -39,6 +37,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -51,10 +51,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面`+ '\n' + '\n'
+ `3.开启设置应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择热启动>设置测试`+ '\n' + '\n' +
`5.测试应用手动执行热启动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果' + '\n' + '\n'
+ `7.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n'
+ `2.开启设置应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `3.再次启动桌面设置应用`+ '\n' + '\n' +
`4.测试应用拉起后返回validator界面` + '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n'
+ `6.若设置热启动测试在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -66,6 +66,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.num = 0;
this.StartEnable = !this.StartEnable;
let str = {
......@@ -91,10 +92,7 @@ struct CustomContainerUser {
/*
settings
*/
let setFd = fileio.openSync(SettingsColdPath, 0o100 | 0o2002, 0o664);
let setBuf = new ArrayBuffer(4096);
fileio.readSync(setFd,setBuf);
let setReport = String.fromCharCode.apply(null,new Uint8Array(setBuf));
let setReport = globalThis.resultNum;
let setHead = setReport.indexOf(':');
let setTime = setReport.substring(setHead+1);
this.setNum = parseFloat(setTime);
......@@ -104,6 +102,7 @@ struct CustomContainerUser {
if( this.num === 1 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,20 +13,17 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let Xpath = path1 + '/CompleteTimeLauncher.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'StartBackgroundTask';
@State toSP_daemon: string = 'SP_daemon -editor completeTime com.ohos.launcher ohtest';
@State StepTips: string = '操作步骤:根据操作提示打开后台任务'+'\n'+'预期结果:打开后台任务时延小于600ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
......@@ -35,6 +32,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -47,10 +46,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入桌面开启任务管理器`
+ '\n' + '\n' + `3.工作台运行’点击启动测试.bat‘选择完成时延>后台任务切换`+ '\n' + '\n' +`4.随意点开一个后台任务`
+ '\n' + '\n' + '5.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' +
`6.若打开后台任务时延小于或等于600ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入桌面开启任务管理器`
+ '\n' + '\n' + `2.随意点开一个后台任务` + '\n' + '\n' + '3.待测试执行结束回到Validator点击结束键' + '\n' + '\n' +
`4.若打开后台任务时延小于或等于600ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -62,6 +60,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
......@@ -83,16 +82,14 @@ struct CustomContainerUser {
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let report = globalThis.resultNum;
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( 0 < time && time < 600 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,20 +13,17 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let Xpath = path1 + '/ResponseTimeLauncher.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'StartNotification';
@State toSP_daemon: string = 'SP_daemon -editor responseTime com.ohos.launcher ohtest';
@State StepTips: string = '操作步骤:根据操作提示下拉通知栏'+'\n'+'预期结果:下拉通知栏时延小于150ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
......@@ -35,6 +32,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -47,10 +46,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入桌面` + '\n' + '\n'
+ `3.工作台运行’点击启动测试.bat‘选择响应时延>下拉状态栏`+ '\n' + '\n' +`4.从屏幕顶部滑动下拉通知栏` + '\n' + '\n'
+ '5.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' + `6.若下拉通知栏时延小于或等于150ms则通过测试` +
'\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入桌面` + '\n' + '\n' + `2.从屏幕顶部滑动下拉通知栏`
+ '\n' + '\n' + '3.待测试执行结束回到Validator点击结束键' + '\n' + '\n' + `4.若下拉通知栏时延小于或等于150ms则通过测试`
+ '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -62,6 +60,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
......@@ -83,16 +82,14 @@ struct CustomContainerUser {
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let report = globalThis.resultNum;
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( 0 < time && time < 150 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,20 +13,17 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let Xpath = path1 + '/CompleteTimeLauncher.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'StartTaskManager';
@State toSP_daemon: string = 'SP_daemon -editor completeTime com.ohos.launcher ohtest';
@State StepTips: string = '操作步骤:根据操作提示打开任务管理器'+'\n'+'预期结果:打开任务管理器时延小于1000ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
......@@ -35,6 +32,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -47,10 +46,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入桌面` + '\n' + '\n'
+ `3.工作台运行’点击启动测试.bat‘选择完成时延>启动任务管理器`+ '\n' + '\n' +`4.点击右下角方框开启任务管理器` + '\n' + '\n'
+ '5.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' + `6.若启动任务管理器时延小于或等于1000ms则通过测试`
+ '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入桌面` + '\n' + '\n' + '\n' + '\n' +
`2.点击右下角方框开启任务管理器` + '\n' + '\n' + '3.待测试执行结束回到Validator点击结束键' + '\n' + '\n'
+ `4.若启动任务管理器时延小于或等于1000ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -62,6 +60,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.StartEnable = !this.StartEnable;
let str = {
bundleName:"com.ohos.launcher",
......@@ -83,16 +82,14 @@ struct CustomContainerUser {
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let report = globalThis.resultNum;
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( 0 < time && time < 1000 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -13,18 +13,14 @@
* limitations under the License.
*/
import router from '@ohos.router';
import fileio from '@ohos.fileio';
import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir;
let path1 = path + '/ExperienceData';
let Xpath = path1 + '/ResponseTimePhotos.log';
@Entry
@Component
struct CustomContainerUser {
@State name: string = 'ViewPhoto';
@State toSP_daemon: string = 'SP_daemon -editor responseTime com.ohos.photos ohtest';
@State StepTips: string = '操作步骤:根据操作提示点击图片等待加载'+'\n'+'预期结果:图片响应时延小于150ms测试通过';
@State Vue: boolean = false;
@State StartEnable: boolean = true;
......@@ -33,6 +29,8 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
@Builder specificNoParam() {
......@@ -45,10 +43,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp')
}
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.在图库中预置500张图片`+ '\n' + '\n'
+ `3.点击开始键进入图库`+ '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择响应时延>查看图片` + '\n' + '\n' +
`5.点击一张图库缩略图等待响应` + '\n' + '\n' + '6.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' +
`7.若图片响应时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.在图库中预置500张图片`+ '\n' + '\n' + `2.点击开始键进入图库`
+ '\n' + '\n' + `3.点击一张图库缩略图等待响应` + '\n' + '\n' + '4.待测试执行结束回到Validator点击结束键'
+ '\n' + '\n' + `5.若图片响应时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -60,6 +57,7 @@ struct CustomContainerUser {
.enabled(this.StartEnable)
.opacity(this.StartEnable? 1 : 0.4)
.onClick(async () => {
globalThis.ShowFloatingWindow();
this.StartEnable = !this.StartEnable;
let bundleName=new String("com.ohos.photos").toString();
let abilityName=new String("com.ohos.photos.MainAbility").toString();
......@@ -84,16 +82,14 @@ struct CustomContainerUser {
.opacity(!this.StartEnable? 1 : 0.4)
.onClick(() => {
this.StartEnable = !this.StartEnable
let fd = fileio.openSync(Xpath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(4096);
fileio.readSync(fd,buf);
let report = String.fromCharCode.apply(null,new Uint8Array(buf));
let report = globalThis.resultNum;
let head = report.indexOf(":");
this.time = report.substring(head+1);
let time = parseFloat(this.time)
if( 0 < time && time < 150 ) {
this.Vue = true;
}
globalThis.HideFloatingWindow();
})
}
}
......
......@@ -45,8 +45,9 @@ struct IndexPage {
{ title: 'PlayerAudio', uri: 'pages/Player/PlayAudioList' },
{ title: 'PlayerVideo', uri: 'pages/Player/PlayVideoList' },
]
@State ColorObject: string[] = VarColor;
@State ColorObject: Object[] = VarColor;
@State ColorTrue : Object[] = [];
@State ColorTrue2 : Object[] = [];
async onPageShow() {
let Test = null;
let context = null;
......@@ -66,7 +67,7 @@ struct IndexPage {
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();
let log = (this.TestCaseList[i].title + ';' + 'none ' + ';').toString();
fileio.writeSync(fd, log);
}
fileio.closeSync(fd);
......@@ -98,12 +99,12 @@ struct IndexPage {
let name1 = '刚刚点进了哪个用例:' + titles;
let results = this.result;
let WriteTitle = (titles).toString();
let number = WriteTitle.length + 11;
let number = WriteTitle.length + 7;
let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'true ') {
this.ColorObject[this.current] = '#ff008000';
let Log = (titles + ';' + '#ff008000' + ';');
this.ColorObject[this.current] = 'true ';
let Log = (titles + ';' + 'true ' + ';');
let key = ColorBack.substring(Index, Index + number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key, Log);
......@@ -116,8 +117,8 @@ struct IndexPage {
filewrite(name1, results, titles)
}
else if (this.result === 'false') {
this.ColorObject[this.current] = '#ffff0000';
let Log = (titles + ';' + '#ffff0000' + ';');
this.ColorObject[this.current] = 'false';
let Log = (titles + ';' + 'false' + ';');
let key = ColorBack.substring(Index, Index + number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key, Log);
......@@ -129,10 +130,25 @@ struct IndexPage {
fileio.writeSync(Fd, Report);
filewrite(name1, results, titles);
}
else if (this.result === 'None') {
else {
this.ColorObject[this.current] = this.ColorObject[this.current];
}
}
for (let i = 0; i < TestList.length; i++){
if (this.ColorObject[i] === 'true '){
this.ColorTrue[i] = 0x263526
this.ColorTrue2[i] = 0x0CB60C
}
else if (this.ColorObject[i] === 'false'){
this.ColorTrue[i] = 0x380303
this.ColorTrue2[i] = 0xd60a0a
}
else {
this.ColorTrue[i] = 0x000000
this.ColorTrue2[i] = 0x000000
}
}
}
build() {
......@@ -166,7 +182,7 @@ struct IndexPage {
action: () => {
this.ClearAll = true;
this.ColorObject.forEach((value, index) => {
this.ColorObject[index] = '#ff808080';
this.ColorObject[index] = 'none ';
});
this.ClearText();
prompt.showToast({
......@@ -220,16 +236,16 @@ struct IndexPage {
.height('6%')
.backgroundColor(Color.Black)
List({ space: 5 }) {
List({}) {
ForEach(this.TestCaseList, (item, index) => {
ListItem() {
Row() {
Text(item.title).fontSize(16).fontColor(Color.Black)
Text(item.title).fontSize(20).fontColor(Color.White)
}
.width('100%')
.height(50)
.alignItems(VerticalAlign.Center)
.backgroundColor(this.count === 0 && this.TEST === 0 ? '#ff808080' : this.ColorObject[index])
.linearGradient(this.count===0&&this.TEST===0?{angle: 90,colors: [[0x000000, 0.0],[0x000000, 1.0]]}:{ angle: 90,colors: [[this.ColorTrue[index], 0.0], [this.ColorTrue2[index], 0.618]]})
.onClick(() => {
this.count = 1;
this.ClearAll = false;
......@@ -240,7 +256,7 @@ struct IndexPage {
})
}
}, item => item.title)
}.width('100%').height('92%')
}.width('100%').height('92%').divider({strokeWidth:1,color:Color.Grey})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
......@@ -251,7 +267,7 @@ struct IndexPage {
fileio.openSync(VideoTxtPath, 0o100 | 0o2002, 0o664);
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for (let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title + ';' + '#ff808080' + ';').toString();
let log = (this.TestCaseList[i].title + ';' + 'none ' + ';').toString();
fileio.writeSync(fd, log);
}
FlushData.ResetPlayerAudio();
......
......@@ -65,7 +65,7 @@ struct IndexPage {
{title:'Player',uri:'pages/Player/Player_index'},
{title:'Experience',uri:'pages/Experience/Experience_index'},
]
@State ColorObject : string[] = ['#ff808080','#ff808080','#ff808080','#ff808080','#ff808080']
@State ColorObject : string[] = ['#ff000000','#ff000000','#ff000000','#ff000000','#ff000000']
async onPageShow(){
let Test = null;
let context =null;
......@@ -173,11 +173,11 @@ struct IndexPage {
})
}
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%')
List({space:5}){
List({}){
ForEach(this.TestCaseList,(item,index) => {
ListItem(){
Row(){
Text(item.title).fontSize(16).fontColor(Color.Black)
Text(item.title).fontSize(20).fontColor(Color.White)
}.width('100%').height(50).alignItems(VerticalAlign.Center).backgroundColor(this.ColorObject[index])
.onClick(()=>{
router.push({
......@@ -194,7 +194,7 @@ struct IndexPage {
})
}
},item => item.title)
}.width('100%').height('92%')
}.width('100%').height('92%').divider({strokeWidth:1,color:Color.Grey})
}.width('100%').height('100%').backgroundColor(Color.Black)
}
ClearText(){
......
......@@ -11,12 +11,12 @@ class AudioRenderer {
private audioRenderer: audio.AudioRenderer = undefined
private fd: number = undefined
private offset: number = undefined
private length: number = undefined
async createAudioRenderer(){
let audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_2,
// channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
......@@ -35,10 +35,17 @@ class AudioRenderer {
async startRenderer(){
try{
await this.audioRenderer.start()
// await globalThis.abilityContext.resourceManager.getRawFileDescriptor('test_44100_2.wav').then(value => {
// this.fd = value.fd
// Logger.info(this.tag, `fd : ${this.fd}`)
// let fileDescriptor = {fd: value.fd, offset: value.offset, length: value.length};
// Logger.info(this.tag, `getRawFileDescriptor success fileDescriptor:` + JSON.stringify(fileDescriptor) )
// }).catch(error => {
// console.log('case getRawFileDescriptor err: ' + error);
// });
globalThis.abilityContext.resourceManager.getRawFd("test_44100_2.wav").then(value => {
this.fd = value.fd
this.offset = value.offset
this.length = value.length
Logger.info(this.tag, `getRawFd fd : ${this.fd}, offset: ${value.offset}, length: ${value.length}`)
}).catch(err => {
console.log(`getRawFd fail err: ${err}, message: ${err.message}, code: ${err.code}`);
......@@ -46,7 +53,8 @@ class AudioRenderer {
let bufferSize = await this.audioRenderer.getBufferSize()
Logger.info(this.tag, `audioRenderer bufferSize:` + JSON.stringify(bufferSize))
let len = this.length % bufferSize == 0 ? Math.floor(this.length / bufferSize) : Math.floor(this.length / bufferSize + 1);
let stat = await fs.stat(this.fd);
let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
let buf = new ArrayBuffer(bufferSize);
while (true) {
for (let i = 0;i < len; i++) {
......@@ -79,6 +87,11 @@ class AudioRenderer {
try{
if (this.audioRenderer){
await this.audioRenderer.release()
// await globalThis.abilityContext.resourceManager.closeRawFileDescriptor('test_44100_2.wav').then(()=> {
// Logger.info(this.tag, `closeRawFileDescriptor success`)
// }).catch(err => {
// Logger.info(this.tag, `closeRawFileDescriptor fail err: ${err}, message: ${err.message}, code: ${err.code}`)
// });
await globalThis.abilityContext.resourceManager.closeRawFd('test_44100_2.wav').then(()=> {
Logger.info(this.tag, `closeRawFileDescriptor success`)
}).catch(err => {
......
......@@ -150,6 +150,7 @@ class CameraService {
Logger.info(this.tag, `previewObj format: ${previewObj.format}`)
}
await this.createPreviewOutputFn(previewObj ? previewObj : this.cameraOutputCapability.previewProfiles[0], surfaceId)
// await this.createPhotoOutputFn(this.photoProfileObj)
await this.createPhotoOutputFn(obj ? obj : this.cameraOutputCapability.photoProfiles[photoIndex?photoIndex:0])
await this.createCameraInputFn(this.cameras[cameraDeviceIndex])
await this.cameraInputOpenFn()
......@@ -394,6 +395,15 @@ class CameraService {
await this.captureSession.addOutput(this.videoOutput)
await this.captureSession.commitConfig()
await this.captureSession.start()
// await this.videoOutput.on('frameStart', async () => {
// Logger.info(this.tag, `frameStart start`)
// try {
// await this.videoRecorder.start()
// Logger.info(this.tag, `frameStart end`)
// } catch (err) {
// Logger.info(this.tag, `videoRecorder start fail err: ${err}`)
// }
// })
await this.videoOutput.start()
await this.videoRecorder.start().then(() => {
setTimeout(async () => {
......
import socket from '@ohos.net.socket';
let tcp = socket.constructTCPSocketInstance();
tcp.on('message', value => {
let buffer = value.message;
let dataView = new DataView(buffer);
let messageView = '';
for (var i = 0; i < dataView.byteLength; i++) {
messageView += String.fromCharCode(dataView.getUint8(i));
}
console.log('123123123' + messageView);
globalThis.resultNum = messageView;
});
@Entry
@Component
struct FloatBall {
@State timerNum: number = 0;
timerId: number = -1;
@State windShowState: boolean = false;
@State title: string = 'start';
@State sec: number = 15;
@State refreshSec: number = 3;
offsetX: number = -1;
offsetY: number = -1;
COUNTS = 2;
DURATION: number = 300;
mHit = Array(this.COUNTS);
isDoubleFlag = false;
singleClickId = 0;
private countDown() {
this.title = 'count';
var T = setInterval(() => {
if (this.sec <= 0) {
clearTimeout(T);
this.title = 'done';
this.sec = 15;
this.refreshCount();
} else if(this.title === 'start'){
clearTimeout(T);
this.sec = 15;
} else if (this.title === 'done'){
clearTimeout(T);
this.sec = 15;
this.refreshCount();
}
else {
this.sec--;
}
}, 1000)
}
private refreshCount() {
var Time = setInterval(() => {
if (this.refreshSec <= 0) {
clearTimeout(Time);
this.title = 'start';
this.refreshSec = 3;
} else {
this.refreshSec--;
}
}, 1000)
}
private TCPConnect(){
tcp.bind({address: '0.0.0.0', port: 8284, family: 1}, err => {
if (err) {
console.log('bind fail');
return;
}
console.log('bind success');
})
tcp.connect({ address: { address: '0.0.0.0', port: 8284, family: 1 } }, err => {
if (err) {
console.log('connect fail');
this.title = 'connect fail';
return;
}
console.log('connect success');
tcp.getRemoteAddress((err, data) => {
if (err) {
console.log('getRemoteAddressfail');
return;
}
console.log('getRemoteAddresssuccess:' + JSON.stringify(data));
this.title = 'start';
})
tcp.getState((err, data) => {
if (err) {
console.log('getState fail');
return;
}
console.log('getState success:' + JSON.stringify(data));
});
})
}
private TCPClose(){
tcp.close((err) => {
console.log('close socket.');
console.log('ErrorError: ' + err)
});
tcp.off('message');
tcp.off('connect');
tcp.off('close');
}
aboutToAppear() {
this.TCPConnect();
}
longEvent() {
this.destroyAllWindow();
}
destroyAllWindow() {
globalThis.DestroyFloatingWindow();
}
MoveWindow(offsetX: number, offsetY: number) {
globalThis.MoveFloatingWindow(offsetX, offsetY);
}
SetWindowPosition(offsetX: number, offsetY: number) {
globalThis.SetFloatingWindowPosition(offsetX, offsetY)
}
build(){
Stack({alignContent: Alignment.Center}) {
if(this.title === 'connecting'){
Circle()
.width('90vp').height('90vp').fill(Color.White).fillOpacity(0).opacity(0.8)
.border({radius:'90vp',width:'0.5vp',color:'#00ff00'})
.linearGradient({
angle: 135,
direction: GradientDirection.Left,
colors: [['#00ff00',1.0],['#00ff00',1.0]]
})
Text('连接中')
.fontSize(14).textAlign(TextAlign.Center).fontColor($r('app.color.color_fff')).width('100%').height('100%')
.gesture(
GestureGroup(GestureMode.Exclusive,
PanGesture({})
.onActionStart(() => {})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX;
this.offsetY = event.offsetY;
})
.onActionEnd(() => {
this.MoveWindow(this.offsetX, this.offsetY);
this.SetWindowPosition(this.offsetX, this.offsetY)
})
)
)
}
if(this.title === 'connect fail'){
Circle()
.width('90vp').height('90vp').fill(Color.White).fillOpacity(0).opacity(0.8)
.border({radius:'90vp',width:'0.5vp',color:$r('app.color.colorPrimary')})
.linearGradient({
angle: 135,
direction: GradientDirection.Left,
colors: [[$r('app.color.colorPrimary'),1.0],[$r('app.color.colorPrimary'),1.0]]
})
Text('连接失败')
.fontSize(14).textAlign(TextAlign.Center).fontColor($r('app.color.color_fff')).width('100%').height('100%')
.onClick(() => {
this.TCPClose();
this.TCPConnect();
})
.gesture(
GestureGroup(GestureMode.Exclusive,
PanGesture({})
.onActionStart(() => {})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX;
this.offsetY = event.offsetY;
})
.onActionEnd(() => {
this.MoveWindow(this.offsetX, this.offsetY);
this.SetWindowPosition(this.offsetX, this.offsetY)
})
)
)
}
if(this.title === 'start'){
Circle()
.width('90vp').height('90vp').fill(Color.White).fillOpacity(0).opacity(0.8)
.border({radius:'90vp',width:'0.5vp',color:$r('app.color.colorPrimary')})
.linearGradient({
angle: 135,
direction: GradientDirection.Left,
colors: [[$r('app.color.colorPrimary'),1.0],[$r('app.color.colorPrimary'),1.0]]
})
Text('start')
.fontSize(18).textAlign(TextAlign.Center).fontColor($r('app.color.color_fff')).width('100%').height('100%')
.onClick(() => {
tcp.send({
data: globalThis.SendMessage
//此处省略encoding, 默认为utf-8编码格式
}, err => {
if (err) {
console.log('send fail');
return;
}
console.log('send success:' + tcp.send);
})
if (this.sec === 15) {
this.countDown()
}
})
.gesture(
GestureGroup(GestureMode.Exclusive,
LongPressGesture({fingers: 1, repeat: false, duration: 1000 })
.onAction(() => {
this.TCPClose();
}),
PanGesture({})
.onActionStart(() => {
})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX;
this.offsetY = event.offsetY;
})
.onActionEnd(() => {
this.MoveWindow(this.offsetX, this.offsetY);
this.SetWindowPosition(this.offsetX, this.offsetY)
})
)
)
}
if(this.title === 'count'){
Circle()
.width('90vp').height('90vp').fill(Color.White).fillOpacity(0).opacity(0.8)
.border({radius:'90vp',width:'0.5vp',color:$r('app.color.color_666')})
.linearGradient({
angle: 135,
direction: GradientDirection.Left,
colors: [[$r('app.color.color_666'),1.0],[$r('app.color.color_666'),1.0]]
})
Text(`${this.sec}`)
.fontSize(18).textAlign(TextAlign.Center).fontColor($r('app.color.color_fff')).width('100%').height('100%')
.gesture(
GestureGroup(GestureMode.Exclusive,
TapGesture({ count: 2 })
.onAction(() => {
this.title = 'start';
}),
LongPressGesture({fingers: 1, repeat: false, duration: 1000 })
.onAction(() => {
this.title = 'done';
}),
PanGesture({})
.onActionStart(() => {
})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX;
this.offsetY = event.offsetY;
})
.onActionEnd(() => {
this.MoveWindow(this.offsetX, this.offsetY);
this.SetWindowPosition(this.offsetX, this.offsetY)
})
)
)
}
if(this.title === 'done'){
Circle()
.width('90vp').height('90vp').fill(Color.White).fillOpacity(0).opacity(0.8)
.border({radius:'90vp',width:'0.5vp',color:'#00ff00'})
.linearGradient({
angle: 135,
direction: GradientDirection.Left,
colors: [['#00ff00',1.0],['#00ff00',1.0]]
})
Text('done')
.fontSize(18).textAlign(TextAlign.Center).fontColor($r('app.color.color_fff')).width('100%').height('100%')
.onClick(async () => {
this.title = 'start';
})
.gesture(
GestureGroup(GestureMode.Exclusive,
LongPressGesture({fingers: 1, repeat: false, duration: 1000 })
.onAction(() => {
}),
PanGesture({})
.onActionStart(() => {
})
.onActionUpdate((event: GestureEvent) => {
this.offsetX = event.offsetX;
this.offsetY = event.offsetY;
})
.onActionEnd(() => {
this.MoveWindow(this.offsetX, this.offsetY);
this.SetWindowPosition(this.offsetX, this.offsetY)
})
)
)
}
}.width('100%').height('100%')
}
}
\ No newline at end of file
import window from '@ohos.window';
export class FloatWindowFun {
static floatingWindowOffsetX: number = 50;
static floatingWindowOffsetY: number = 500;
static windowWidth: number = 2560;
static windowHeight: number = 1600;
static atWidth: number = 180;
static title: String= 'start';
static initAllFun() {
globalThis.CreateFloatingWindow = (() => {
window.createWindow({ctx:globalThis.abilityContext, name:'sp_floatingWindow', windowType:window.WindowType.TYPE_FLOAT}).then((floatWin) => {
floatWin.moveWindowTo(this.floatingWindowOffsetX, this.floatingWindowOffsetY).then(() => {
floatWin.resize(this.atWidth, this.atWidth).then(() => {
floatWin.getWindowProperties()
floatWin.setUIContent('pages/model/FloatBall').then(() => {
floatWin.setWindowBackgroundColor('#00000000')
// floatWin.hide()
// floatWin.showWindow().then(() => {
// globalThis.showFloatingWindow = false;
// })
})
})
})
})
})
globalThis.MoveFloatingWindow = ((offsetX: number, offsetY: number) => {
let xx = (this.floatingWindowOffsetX + offsetX * 2) < 0 ? 0 : ((this.floatingWindowOffsetX + offsetX * 2) > (this.windowWidth - 200) ? (this.windowWidth - 200) : (this.floatingWindowOffsetX + offsetX * 2));
let yy = (this.floatingWindowOffsetY + offsetY * 2) < 0 ? 0 : ((this.floatingWindowOffsetY + offsetY * 2) > (this.windowHeight - 200) ? (this.windowHeight - 200) : (this.floatingWindowOffsetY + offsetY * 2));
window.findWindow("sp_floatingWindow").moveWindowTo(xx, yy);
})
globalThis.DestroyFloatingWindow = (() => {
window.findWindow('sp_floatingWindow').destroyWindow().then(() => {
globalThis.showFloatingWindow = false;
})
})
globalThis.SetFloatingWindowPosition = ((offsetX: number, offsetY: number) => {
this.floatingWindowOffsetX = (this.floatingWindowOffsetX + offsetX * 2) < 0 ? 0 : ((this.floatingWindowOffsetX + offsetX * 2) > (this.windowWidth - 200) ? (this.windowWidth - 200) : (this.floatingWindowOffsetX + offsetX * 2));
this.floatingWindowOffsetY = (this.floatingWindowOffsetY + offsetY * 2) < 0 ? 0 : ((this.floatingWindowOffsetY + offsetY * 2) > (this.windowHeight - 200) ? (this.windowHeight - 200): (this.floatingWindowOffsetY + offsetY * 2));
})
globalThis.HideFloatingWindow = (() => {
window.findWindow("sp_floatingWindow").hide().then(() => {
globalThis.showFloatingWindow = false;
})
})
globalThis.ShowFloatingWindow = (() => {
window.findWindow("sp_floatingWindow").showWindow().then(() => {
globalThis.title = this.title;
})
// .then(() => {
// globalThis.showFloatingWindow = true;
// console.log('2222222222');
// })
})
}
}
\ No newline at end of file
......@@ -59,6 +59,9 @@
},
{
"name": "ohos.permission.START_INVISIBLE_ABILITY"
},
{
"name": "ohos.permission.SYSTEM_FLOAT_WINDOW"
}
]
}
......
{
"color": [
{
"name": "colorPrimary",
"value": "#B3193F"
},
{
"name": "color_fff",
"value": "#FFFFFF"
},
{
"name": "white",
"value": "#FFFFFF"
},
{
"name": "color_666",
"value": "#666666"
}
]
}
\ No newline at end of file
......@@ -61,6 +61,7 @@
"pages/Player/PlayAudio",
"pages/Player/PlayVideo",
"pages/Player/PlayAudioList",
"pages/Player/PlayVideoList"
"pages/Player/PlayVideoList",
"pages/model/FloatBall"
]
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册