提交 e2641614 编写于 作者: T tianwenzhe

change to master

Signed-off-by: Ntian-wenzhe411 <tianwenzhe2@huawei.com>
上级 e0ec19de
import AbilityStage from "@ohos.app.ability.AbilityStage" import AbilityStage from "@ohos.application.AbilityStage"
import Logger from '../pages/model/Logger' import Logger from '../pages/model/Logger'
export default class MyAbilityStage extends AbilityStage { export default class MyAbilityStage extends AbilityStage {
......
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.application.Ability'
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
...@@ -17,15 +17,15 @@ export default class MainAbility extends Ability { ...@@ -17,15 +17,15 @@ 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', 'ohos.permission.CAMERA', "ohos.permission.CAPTURE_SCREEN","ohos.permission.INTERNET","ohos.permission.CAMERA",
'ohos.permission.MICROPHONE', 'ohos.permission.START_INVISIBLE_ABILITY']).then( () => {} ); "ohos.permission.MICROPHONE", "ohos.permission.START_INVISIBLE_ABILITY"]).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));
return; return;
} }
console.info( 'Succeeded in loading the content. Data: ' + JSON.stringify(data) ); console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data))
}); });
} }
......
...@@ -116,7 +116,7 @@ struct IndexPage { ...@@ -116,7 +116,7 @@ struct IndexPage {
let number = WriteTitle.length + 11; let number = WriteTitle.length + 11;
let Index = ColorBack.indexOf(WriteTitle); let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'true'){ if (this.result === 'true '){
this.ColorObject[this.current] = '#ff008000'; this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';'); let Log = (titles+';'+'#ff008000'+';');
let key = ColorBack.substring(Index,Index+number); let key = ColorBack.substring(Index,Index+number);
...@@ -154,7 +154,7 @@ struct IndexPage { ...@@ -154,7 +154,7 @@ struct IndexPage {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp') Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back(); router.back();
}) })
...@@ -282,12 +282,12 @@ struct IndexPage { ...@@ -282,12 +282,12 @@ struct IndexPage {
FailIndex = report.indexOf('false',FailIndex + 1); FailIndex = report.indexOf('false',FailIndex + 1);
} }
let failNum = (FailNum).toString(); let failNum = (FailNum).toString();
let PassIndex = report.indexOf('true'); let PassIndex = report.indexOf('true ');
let PassNum = 0; let PassNum = 0;
while (PassIndex != -1) { while (PassIndex != -1) {
console.log(PassIndex); console.log(PassIndex);
PassNum++; PassNum++;
PassIndex = report.indexOf('true',PassIndex + 1); PassIndex = report.indexOf('true ',PassIndex + 1);
} }
let TestNum = FailNum + PassNum; let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString(); let testNum = (TestNum).toString();
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer1'; import {CustomContainer} from '../common/CanvasCustomContainer1';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer1'; import {CustomContainer} from '../common/CanvasCustomContainer1';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -57,11 +57,14 @@ struct SetCircle { ...@@ -57,11 +57,14 @@ struct SetCircle {
} }
Row({space:10}){ Row({space:10}){
Text('font-style').fontSize(13).border({width:0}).size({width:'24%',height:'18%'}) Text('font-style').fontSize(13).border({width:0}).size({width:'24%',height:'18%'})
Text('normal').fontSize(13).border({width:2}).size({width:'24%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('normal').fontSize(13)
}
.size({width:'24%',height:'18%'})
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal normal 120px sans-serif'; this.context.font = 'normal normal 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num1 = 1; this.num1 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -71,11 +74,14 @@ struct SetCircle { ...@@ -71,11 +74,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('italic').fontSize(13).border({width:2}).size({width:'24%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('italic').fontSize(13)
}
.size({width:'24%',height:'18%'})
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'italic normal 120px sans-serif'; this.context.font = 'italic normal 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num2 = 1; this.num2 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -88,11 +94,14 @@ struct SetCircle { ...@@ -88,11 +94,14 @@ struct SetCircle {
} }
Row({space:8}) { Row({space:8}) {
Text('font-weight').fontSize(13).border({ width: 0 }).size({ width: '24%', height: '18%' }) Text('font-weight').fontSize(13).border({ width: 0 }).size({ width: '24%', height: '18%' })
Text('normal').fontSize(13).border({ width: 2 }).size({ width: '16%', height: '18%' }) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(() => { Text('normal').fontSize(13)
}
.size({width:'16%',height:'18%'})
.onChange(() => {
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal normal 120px sans-serif'; this.context.font = 'normal normal 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num3 = 1; this.num3 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -102,11 +111,14 @@ struct SetCircle { ...@@ -102,11 +111,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('bold').fontSize(13).border({width:2}).size({width:'16%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('bold').fontSize(13)
}
.size({width:'16%',height:'18%'})
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal bold 120px sans-serif'; this.context.font = 'normal bold 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num4 = 1; this.num4 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -116,11 +128,14 @@ struct SetCircle { ...@@ -116,11 +128,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('bolder').fontSize(13).border({width:2}).size({width:'16%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('bolder').fontSize(13)
}
.size({width:'16%',height:'18%'})
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal bolder 120px sans-serif'; this.context.font = 'normal bolder 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num5 = 1; this.num5 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -130,11 +145,14 @@ struct SetCircle { ...@@ -130,11 +145,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('lighter').fontSize(13).border({width:2}).size({width:'16%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('lighter').fontSize(13)
}
.size({width:'16%',height:'18%'})
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal lighter 120px sans-serif'; this.context.font = 'normal lighter 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num6 = 1; this.num6 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -146,11 +164,14 @@ struct SetCircle { ...@@ -146,11 +164,14 @@ struct SetCircle {
}) })
} }
Row({space:5}) { Row({space:5}) {
Text('100').fontSize(13).border({ width: 2 }).size({ width: '10%', height: '18%' }) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(() => { Text('100').fontSize(13)
}
.size({ width: '10%', height: '18%' })
.onChange(() => {
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal 100 120px sans-serif'; this.context.font = 'normal 100 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num7 = 1; this.num7 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -160,11 +181,14 @@ struct SetCircle { ...@@ -160,11 +181,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('200').fontSize(13).border({width:2}).size({width:'10%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('200').fontSize(13)
}
.size({ width: '10%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal 200 120px sans-serif'; this.context.font = 'normal 200 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num8 = 1; this.num8 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -174,11 +198,14 @@ struct SetCircle { ...@@ -174,11 +198,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('300').fontSize(13).border({width:2}).size({width:'10%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('300').fontSize(13)
}
.size({ width: '10%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal 300 120px sans-serif'; this.context.font = 'normal 300 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num9 = 1; this.num9 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -188,11 +215,14 @@ struct SetCircle { ...@@ -188,11 +215,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('400').fontSize(13).border({width:2}).size({width:'10%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('400').fontSize(13)
}
.size({ width: '10%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal 400 120px sans-serif'; this.context.font = 'normal 400 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num10 = 1; this.num10 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -202,11 +232,14 @@ struct SetCircle { ...@@ -202,11 +232,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('500').fontSize(13).border({width:2}).size({width:'10%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('500').fontSize(13)
}
.size({ width: '10%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal 500 120px sans-serif'; this.context.font = 'normal 500 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num11 = 1; this.num11 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -216,11 +249,14 @@ struct SetCircle { ...@@ -216,11 +249,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('600').fontSize(13).border({width:2}).size({width:'10%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('600').fontSize(13)
}
.size({ width: '10%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal 600 120px sans-serif'; this.context.font = 'normal 600 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num12 = 1; this.num12 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -230,11 +266,14 @@ struct SetCircle { ...@@ -230,11 +266,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('700').fontSize(13).border({width:2}).size({width:'10%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('700').fontSize(13)
}
.size({ width: '10%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal 700 120px sans-serif'; this.context.font = 'normal 700 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num13 = 1; this.num13 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -244,11 +283,14 @@ struct SetCircle { ...@@ -244,11 +283,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('800').fontSize(13).border({width:2}).size({width:'10%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('800').fontSize(13)
}
.size({ width: '10%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal 800 120px sans-serif'; this.context.font = 'normal 800 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num14 = 1; this.num14 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -258,11 +300,14 @@ struct SetCircle { ...@@ -258,11 +300,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('900').fontSize(13).border({width:2}).size({width:'10%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('900').fontSize(13)
}
.size({ width: '10%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal 900 120px sans-serif'; this.context.font = 'normal 900 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num15 = 1; this.num15 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -275,11 +320,14 @@ struct SetCircle { ...@@ -275,11 +320,14 @@ struct SetCircle {
} }
Row({space:10}){ Row({space:10}){
Text('font-family').fontSize(13).border({width:0}).size({width:'24%',height:'18%'}) Text('font-family').fontSize(13).border({width:0}).size({width:'24%',height:'18%'})
Text('sans-serif').fontSize(13).border({width:2}).size({width:'24%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('sans-serif').fontSize(13)
}
.size({width:'24%',height:'18%'})
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal normal 120px sans-serif'; this.context.font = 'normal normal 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num16 = 1; this.num16 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -289,11 +337,14 @@ struct SetCircle { ...@@ -289,11 +337,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('serif').fontSize(13).border({width:2}).size({width:'24%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('serif').fontSize(13)
}
.size({width:'24%',height:'18%'})
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal normal 120px serif'; this.context.font = 'normal normal 80px serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num17 = 1; this.num17 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -303,11 +354,14 @@ struct SetCircle { ...@@ -303,11 +354,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('monospace').fontSize(13).border({width:2}).size({width:'24%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('monospace').fontSize(13)
}
.size({width:'24%',height:'18%'})
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal normal 120px monospace'; this.context.font = 'normal normal 80px monospace';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num18 = 1; this.num18 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -320,11 +374,14 @@ struct SetCircle { ...@@ -320,11 +374,14 @@ struct SetCircle {
} }
Row({space:10}) { Row({space:10}) {
Text('font-size').fontSize(13).border({ width: 0 }).size({ width: '18%', height: '18%' }) Text('font-size').fontSize(13).border({ width: 0 }).size({ width: '18%', height: '18%' })
Text('small').fontSize(13).border({ width: 2 }).size({ width: '18%', height: '18%' }) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(() => { Text('small').fontSize(13)
}
.size({ width: '18%', height: '18%' })
.onChange(() => {
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal normal 10px sans-serif'; this.context.font = 'normal normal 10px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num19 = 1; this.num19 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -334,11 +391,14 @@ struct SetCircle { ...@@ -334,11 +391,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('medium').fontSize(13).border({width:2}).size({width:'18%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('medium').fontSize(13)
}
.size({ width: '18%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal normal 50px sans-serif'; this.context.font = 'normal normal 50px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num20 = 1; this.num20 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -348,11 +408,14 @@ struct SetCircle { ...@@ -348,11 +408,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('large').fontSize(13).border({width:2}).size({width:'18%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('large').fontSize(13)
}
.size({ width: '18%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal normal 80px sans-serif'; this.context.font = 'normal normal 80px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num21 = 1; this.num21 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -362,11 +425,14 @@ struct SetCircle { ...@@ -362,11 +425,14 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('extra').fontSize(13).border({width:2}).size({width:'18%',height:'18%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('extra').fontSize(13)
}
.size({ width: '18%', height: '18%' })
.onChange(()=>{
this.context.clearRect(0, 10, 600, 600); this.context.clearRect(0, 10, 600, 600);
this.context.font = 'normal normal 120px sans-serif'; this.context.font = 'normal normal 120px sans-serif';
this.context.fillText("Hello World", 80, 120); this.context.fillText("Hello World", 40, 180);
this.num22 = 1; this.num22 = 1;
if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 if( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1
&& this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1 && this.num6 == 1 && this.num7 == 1 && this.num8 == 1 && this.num9 == 1 && this.num10 == 1
...@@ -384,8 +450,6 @@ struct SetCircle { ...@@ -384,8 +450,6 @@ struct SetCircle {
.height('100%') .height('100%')
.backgroundColor('#ffffffff') .backgroundColor('#ffffffff')
.onReady(() =>{ .onReady(() =>{
this.context.font = '120px sans-serif';
this.context.fillText("Hello World", 80, 120);
}) })
}.width('100%').height('70%') }.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White) }.width('100%').height('80%').backgroundColor(Color.White)
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer2'; import {CustomContainer} from '../common/CanvasCustomContainer2';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -37,11 +37,17 @@ struct SetCircle { ...@@ -37,11 +37,17 @@ struct SetCircle {
.gesture( .gesture(
PanGesture({}) PanGesture({})
.onActionStart((event: GestureEvent) => { .onActionStart((event: GestureEvent) => {
this.context.clearRect(100, 100, 250, 200);
console.info('Pan start'); console.info('Pan start');
this.Vue = true; this.Vue = true;
}) })
.onActionUpdate((event: GestureEvent) => { .onActionUpdate((event: GestureEvent) => {
this.context.clearRect(100, 100, 250, 200);
if(event.offsetX>200){
event.offsetX = 200;
}
else if (event.offsetX < 20){
event.offsetX = 20;
}
this.X = event.offsetX; this.X = event.offsetX;
this.context.globalAlpha = (this.X)*0.005; this.context.globalAlpha = (this.X)*0.005;
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer1'; import {CustomContainer} from '../common/CanvasCustomContainer1';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -22,7 +22,7 @@ struct SetCircle { ...@@ -22,7 +22,7 @@ struct SetCircle {
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 = 'CanvasGlobalCompositeOperation'; @State name: string = 'CanvasGlobalCompositeOperation';
@State StepTips: string = '操作步骤:点击不同的合成操作的方式'+'\n'+'预期结果:原本默认合成方式会随点击变化'; @State StepTips: string = '操作步骤:点击不同的合成操作的方式'+'\n'+'预期结果:原本默认合成方式会随点击变化(红色为先绘制内容,蓝色为后绘制内容)';
@State Vue: boolean = false; @State Vue: boolean = false;
@State num1: number = 0; @State num1: number = 0;
@State num2: number = 0; @State num2: number = 0;
...@@ -45,8 +45,17 @@ struct SetCircle { ...@@ -45,8 +45,17 @@ struct SetCircle {
Text('').fontSize(0).border({width:0}).size({width:'0%',height:'2%'}) Text('').fontSize(0).border({width:0}).size({width:'0%',height:'2%'})
} }
Row({space:10}){ Row({space:10}){
Text('s-over').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('s-over').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=>{
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -60,8 +69,17 @@ struct SetCircle { ...@@ -60,8 +69,17 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('s-atop').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('s-atop').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=>{
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -75,8 +93,17 @@ struct SetCircle { ...@@ -75,8 +93,17 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('s-in').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('s-in').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=>{
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -90,8 +117,17 @@ struct SetCircle { ...@@ -90,8 +117,17 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('s-out').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=>{ Text('s-out').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=>{
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -107,8 +143,17 @@ struct SetCircle { ...@@ -107,8 +143,17 @@ struct SetCircle {
}) })
} }
Row({space:10}){ Row({space:10}){
Text('d-over').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=> { Text('d-over').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=> {
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -122,8 +167,17 @@ struct SetCircle { ...@@ -122,8 +167,17 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('d-atop').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=> { Text('d-atop').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=> {
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -137,8 +191,17 @@ struct SetCircle { ...@@ -137,8 +191,17 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('d-in').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=> { Text('d-in').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=> {
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -152,8 +215,17 @@ struct SetCircle { ...@@ -152,8 +215,17 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('d-out').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=> { Text('d-out').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=> {
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -169,8 +241,17 @@ struct SetCircle { ...@@ -169,8 +241,17 @@ struct SetCircle {
}) })
} }
Row({space:10}){ Row({space:10}){
Text('lighter').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=> { Text('lighter').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=> {
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -184,8 +265,17 @@ struct SetCircle { ...@@ -184,8 +265,17 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('copy').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=> { Text('copy').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=> {
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -199,8 +289,17 @@ struct SetCircle { ...@@ -199,8 +289,17 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
} }
}) })
Text('xor').fontSize(13).border({width:2}).size({width:'18%',height:'20%'}) Toggle({type:ToggleType.Button, isOn:false}){
.onClick(()=> { Text('xor').fontSize(13)
}
.size({width:'18%',height:'20%'})
.onChange(()=> {
this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
this.context.clearRect(0, 10, 350, 300); this.context.clearRect(0, 10, 350, 300);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50); this.context.fillRect(150, 150, 50, 50);
...@@ -223,11 +322,6 @@ struct SetCircle { ...@@ -223,11 +322,6 @@ struct SetCircle {
.height('100%') .height('100%')
.backgroundColor('#ffffffff') .backgroundColor('#ffffffff')
.onReady(() =>{ .onReady(() =>{
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalCompositeOperation = 'source-over';
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(180, 180, 50, 50);
}) })
}.width('100%').height('70%') }.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White) }.width('100%').height('80%').backgroundColor(Color.White)
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer1'; import {CustomContainer} from '../common/CanvasCustomContainer1';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer2'; import {CustomContainer} from '../common/CanvasCustomContainer2';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -36,15 +36,22 @@ struct SetCircle { ...@@ -36,15 +36,22 @@ struct SetCircle {
.gesture( .gesture(
PanGesture({}) PanGesture({})
.onActionStart((event: GestureEvent) => { .onActionStart((event: GestureEvent) => {
this.context.clearRect(100, 100, 250, 200);
console.info('Pan start'); console.info('Pan start');
this.Vue = true; this.Vue = true;
}) })
.onActionUpdate((event: GestureEvent) => { .onActionUpdate((event: GestureEvent) => {
if(event.offsetX > 200){
event.offsetX = 200;
}
else if(event.offsetX < 20){
event.offsetX = 20;
}
this.X = event.offsetX; this.X = event.offsetX;
this.context.arc(180, 150, 50, 0, 6.28); this.context.clearRect(100, 90, 250, 200);
this.context.setLineDash([20,30]); this.context.setLineDash([20,30]);
this.context.lineDashOffset = (this.X)*0.02; this.context.beginPath();
this.context.arc(180, 150, 50, 0, 6.28);
this.context.lineDashOffset = (this.X) * 0.2;
this.context.stroke(); this.context.stroke();
}) })
.onActionEnd(() => { .onActionEnd(() => {
...@@ -53,7 +60,7 @@ struct SetCircle { ...@@ -53,7 +60,7 @@ struct SetCircle {
) )
}.width('70%').height('25%') }.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('虚线偏移量: ' + (this.X)*0.02 ) Text('虚线偏移量: ' + (this.X)*0.2 )
}.width('100%').height('20%') }.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context) Canvas(this.context)
...@@ -61,10 +68,6 @@ struct SetCircle { ...@@ -61,10 +68,6 @@ struct SetCircle {
.height('100%') .height('100%')
.backgroundColor('#ffffffff') .backgroundColor('#ffffffff')
.onReady(() =>{ .onReady(() =>{
this.context.arc(180, 150, 50, 0, 6.28);
this.context.setLineDash([20,30]);
this.context.lineDashOffset = 0.1;
this.context.stroke();
}) })
}.width('100%').height('55%') }.width('100%').height('55%')
}.width('100%').height('80%').backgroundColor(Color.White) }.width('100%').height('80%').backgroundColor(Color.White)
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer1'; import {CustomContainer} from '../common/CanvasCustomContainer1';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer2'; import {CustomContainer} from '../common/CanvasCustomContainer2';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -36,11 +36,17 @@ struct SetCircle { ...@@ -36,11 +36,17 @@ struct SetCircle {
.gesture( .gesture(
PanGesture({}) PanGesture({})
.onActionStart((event: GestureEvent) => { .onActionStart((event: GestureEvent) => {
this.context.clearRect(100, 100, 250, 200);
console.info('Pan start'); console.info('Pan start');
this.Vue = true; this.Vue = true;
}) })
.onActionUpdate((event: GestureEvent) => { .onActionUpdate((event: GestureEvent) => {
if(event.offsetX > 200){
event.offsetX = 200;
}
else if(event.offsetX < 20){
event.offsetX = 20;
}
this.context.clearRect(100, 100, 250, 200);
this.X = event.offsetX; this.X = event.offsetX;
this.context.lineWidth = (this.X)*0.1; this.context.lineWidth = (this.X)*0.1;
this.context.strokeRect(120, 120, 120, 120); this.context.strokeRect(120, 120, 120, 120);
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer2'; import {CustomContainer} from '../common/CanvasCustomContainer2';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -36,13 +36,19 @@ struct SetCircle { ...@@ -36,13 +36,19 @@ struct SetCircle {
.gesture( .gesture(
PanGesture({}) PanGesture({})
.onActionStart((event: GestureEvent) => { .onActionStart((event: GestureEvent) => {
this.context.clearRect(0, 0, 600, 500);
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100); this.context.fillRect(150, 150, 100, 100);
console.info('Pan start'); console.info('Pan start');
this.Vue = true; this.Vue = true;
}) })
.onActionUpdate((event: GestureEvent) => { .onActionUpdate((event: GestureEvent) => {
if(event.offsetX > 200){
event.offsetX = 200;
}
else if(event.offsetX < 20){
event.offsetX = 20;
}
this.context.clearRect(0, 0, 600, 500);
this.X = event.offsetX; this.X = event.offsetX;
this.context.shadowBlur = this.X; this.context.shadowBlur = this.X;
this.context.shadowColor = 'rgb(0,0,0)'; this.context.shadowColor = 'rgb(0,0,0)';
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer2'; import {CustomContainer} from '../common/CanvasCustomContainer2';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -77,8 +77,6 @@ struct SetCircle { ...@@ -77,8 +77,6 @@ struct SetCircle {
.height('100%') .height('100%')
.backgroundColor('#ffffffff') .backgroundColor('#ffffffff')
.onReady(() =>{ .onReady(() =>{
this.context.shadowBlur = 30;
this.context.shadowColor = 'rgb(0,0,255)';
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100); this.context.fillRect(150, 150, 100, 100);
}) })
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer2'; import {CustomContainer} from '../common/CanvasCustomContainer2';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -36,7 +36,6 @@ struct SetCircle { ...@@ -36,7 +36,6 @@ struct SetCircle {
.gesture( .gesture(
PanGesture({}) PanGesture({})
.onActionStart((event: GestureEvent) => { .onActionStart((event: GestureEvent) => {
this.context.clearRect(10, 50, 400, 300);
this.context.shadowColor = 'rgb(0,0,0)'; this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100); this.context.fillRect(150, 150, 100, 100);
...@@ -44,6 +43,13 @@ struct SetCircle { ...@@ -44,6 +43,13 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
}) })
.onActionUpdate((event: GestureEvent) => { .onActionUpdate((event: GestureEvent) => {
if(event.offsetX > 200){
event.offsetX = 200;
}
else if(event.offsetX < 20){
event.offsetX = 20;
}
this.context.clearRect(10, 50, 400, 300);
this.X = event.offsetX; this.X = event.offsetX;
this.context.shadowBlur = 10; this.context.shadowBlur = 10;
this.context.shadowOffsetX = (this.X)*0.05; this.context.shadowOffsetX = (this.X)*0.05;
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer2'; import {CustomContainer} from '../common/CanvasCustomContainer2';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -36,7 +36,6 @@ struct SetCircle { ...@@ -36,7 +36,6 @@ struct SetCircle {
.gesture( .gesture(
PanGesture({}) PanGesture({})
.onActionStart((event: GestureEvent) => { .onActionStart((event: GestureEvent) => {
this.context.clearRect(10, 50, 400, 300);
this.context.shadowColor = 'rgb(0,0,0)'; this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)'; this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100); this.context.fillRect(150, 150, 100, 100);
...@@ -44,6 +43,13 @@ struct SetCircle { ...@@ -44,6 +43,13 @@ struct SetCircle {
this.Vue = true; this.Vue = true;
}) })
.onActionUpdate((event: GestureEvent) => { .onActionUpdate((event: GestureEvent) => {
if(event.offsetX > 200){
event.offsetX = 200;
}
else if(event.offsetX < 20){
event.offsetX = 20;
}
this.context.clearRect(10, 50, 400, 300);
this.X = event.offsetX; this.X = event.offsetX;
this.context.shadowBlur = 10; this.context.shadowBlur = 10;
this.context.shadowOffsetY = (this.X)*0.05; this.context.shadowOffsetY = (this.X)*0.05;
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer1'; import {CustomContainer} from '../common/CanvasCustomContainer1';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer1'; import {CustomContainer} from '../common/CanvasCustomContainer1';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -39,11 +39,12 @@ struct SetCircle { ...@@ -39,11 +39,12 @@ struct SetCircle {
.onClick(()=>{ .onClick(()=>{
this.context.clearRect(0, 10, 500, 500); this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2; this.context.lineWidth = 2;
this.context.moveTo(180, 10); this.context.moveTo(250, 10);
this.context.lineTo(180, 310); this.context.lineTo(250, 310);
this.context.stroke(); this.context.stroke();
this.context.textAlign = 'start'; this.context.textAlign = 'start';
this.context.fillText('textAlign=start', 180, 160); this.context.font = '40px sans-serif'
this.context.fillText('textAlign=start', 250, 160);
this.num1 = 1; this.num1 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){ if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true; this.Vue = true;
...@@ -53,11 +54,11 @@ struct SetCircle { ...@@ -53,11 +54,11 @@ struct SetCircle {
.onClick(()=>{ .onClick(()=>{
this.context.clearRect(0, 10, 500, 500); this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2; this.context.lineWidth = 2;
this.context.moveTo(180, 10); this.context.moveTo(250, 10);
this.context.lineTo(180, 310); this.context.lineTo(250, 310);
this.context.stroke(); this.context.stroke();
this.context.textAlign = 'end'; this.context.textAlign = 'end';
this.context.fillText('textAlign=end', 180, 160); this.context.fillText('textAlign=end', 250, 160);
this.num2 = 1; this.num2 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){ if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true; this.Vue = true;
...@@ -67,11 +68,11 @@ struct SetCircle { ...@@ -67,11 +68,11 @@ struct SetCircle {
.onClick(()=>{ .onClick(()=>{
this.context.clearRect(0, 10, 500, 500); this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2; this.context.lineWidth = 2;
this.context.moveTo(180, 10); this.context.moveTo(250, 10);
this.context.lineTo(180, 310); this.context.lineTo(250, 310);
this.context.stroke(); this.context.stroke();
this.context.textAlign = 'left'; this.context.textAlign = 'left';
this.context.fillText('textAlign=left', 180, 160); this.context.fillText('textAlign=left', 250, 160);
this.num3 = 1; this.num3 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){ if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true; this.Vue = true;
...@@ -81,11 +82,11 @@ struct SetCircle { ...@@ -81,11 +82,11 @@ struct SetCircle {
.onClick(()=>{ .onClick(()=>{
this.context.clearRect(0, 10, 500, 500); this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2; this.context.lineWidth = 2;
this.context.moveTo(180, 10); this.context.moveTo(250, 10);
this.context.lineTo(180, 310); this.context.lineTo(250, 310);
this.context.stroke(); this.context.stroke();
this.context.textAlign = 'center'; this.context.textAlign = 'center';
this.context.fillText('textAlign=center', 180, 160); this.context.fillText('textAlign=center', 250, 160);
this.num4 = 1; this.num4 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){ if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true; this.Vue = true;
...@@ -95,11 +96,11 @@ struct SetCircle { ...@@ -95,11 +96,11 @@ struct SetCircle {
.onClick(()=> { .onClick(()=> {
this.context.clearRect(0, 10, 500, 500); this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2; this.context.lineWidth = 2;
this.context.moveTo(180, 10); this.context.moveTo(250, 10);
this.context.lineTo(180, 310); this.context.lineTo(250, 310);
this.context.stroke(); this.context.stroke();
this.context.textAlign = 'right'; this.context.textAlign = 'right';
this.context.fillText('textAlign=right', 180, 160); this.context.fillText('textAlign=right', 250, 160);
this.num5 = 1; this.num5 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){ if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true; this.Vue = true;
...@@ -113,12 +114,9 @@ struct SetCircle { ...@@ -113,12 +114,9 @@ struct SetCircle {
.backgroundColor('#ffffffff') .backgroundColor('#ffffffff')
.onReady(() =>{ .onReady(() =>{
this.context.lineWidth = 2; this.context.lineWidth = 2;
this.context.moveTo(180, 10); this.context.moveTo(250, 10);
this.context.lineTo(180, 310); this.context.lineTo(250, 310);
this.context.stroke(); this.context.stroke();
this.context.font = '60px sans-serif';
this.context.textAlign = 'start';
this.context.fillText('textAlign=start', 180, 160);
}) })
}.width('100%').height('70%') }.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White) }.width('100%').height('80%').backgroundColor(Color.White)
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CanvasCustomContainer1'; import {CustomContainer} from '../common/CanvasCustomContainer1';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SetCircle { struct SetCircle {
...@@ -43,6 +43,7 @@ struct SetCircle { ...@@ -43,6 +43,7 @@ struct SetCircle {
this.context.moveTo(0, 120); this.context.moveTo(0, 120);
this.context.lineTo(400, 120); this.context.lineTo(400, 120);
this.context.stroke(); this.context.stroke();
this.context.font = '60px sans-serif';
this.context.textBaseline = 'top'; this.context.textBaseline = 'top';
this.context.fillText('Top', 160, 120); this.context.fillText('Top', 160, 120);
this.num1 = 1; this.num1 = 1;
...@@ -120,11 +121,8 @@ struct SetCircle { ...@@ -120,11 +121,8 @@ struct SetCircle {
this.context.strokeStyle = '#0000ff'; this.context.strokeStyle = '#0000ff';
this.context.lineWidth = 2; this.context.lineWidth = 2;
this.context.moveTo(0, 120); this.context.moveTo(0, 120);
this.context.lineTo(400, 120); this.context.lineTo(500, 120);
this.context.stroke(); this.context.stroke();
this.context.font = '60px sans-serif';
this.context.textBaseline = 'top';
this.context.fillText('Top', 160, 120);
}) })
}.width('100%').height('70%') }.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White) }.width('100%').height('80%').backgroundColor(Color.White)
......
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CustomContainer2'; import {CustomContainer} from '../common/CustomContainer2';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct LongPressGestureExample { struct LongPressGestureExample {
@State X: number = 0; @State X: number = 0;
@State name: string = 'LongPressGesture'; @State name: string = 'LongPressGesture';
@State StepTips: string = '操作步骤:用至少一根手指长按图像(最多十根手指)'+'\n'+'预期结果:长按动作触发计数增加'; @State StepTips: string = '操作步骤:手指长按图像'+'\n'+'预期结果:长按动作触发计数增加,显示计数可大于10';
@State Vue: boolean = false; @State Vue: boolean = false;
async aboutToAppear(){ async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name); await FirstDialog.ChooseDialog(this.StepTips,this.name);
...@@ -36,8 +36,10 @@ struct LongPressGestureExample { ...@@ -36,8 +36,10 @@ struct LongPressGestureExample {
.onAction((event: GestureEvent) => { .onAction((event: GestureEvent) => {
if (event.repeat) { if (event.repeat) {
this.X++; this.X++;
if(this.X >= 10){
this.Vue = true; this.Vue = true;
} }
}
}) })
.onActionEnd(() => { .onActionEnd(() => {
this.X = 0; this.X = 0;
......
...@@ -12,16 +12,16 @@ ...@@ -12,16 +12,16 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CustomContainer3'; import {CustomContainer} from '../common/CustomContainer3';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct PanGestureExample { struct PanGestureExample {
@State X: number = 0; @State X: number = 0;
@State Y: number = 0; @State Y: number = 0;
@State name: string = 'PanGesture'; @State name: string = 'PanGesture';
@State StepTips: string = '操作步骤:用至少一根手指拖动图像(最多十根手指)'+'\n'+'预期结果:图片正常拖动,偏移坐标显示正常'; @State StepTips: string = '操作步骤:手指拖动图像'+'\n'+'预期结果:图片正常拖动,偏移坐标显示正常';
@State Vue: boolean = false; @State Vue: boolean = false;
async aboutToAppear(){ async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name); await FirstDialog.ChooseDialog(this.StepTips,this.name);
......
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CustomContainer2'; import {CustomContainer} from '../common/CustomContainer2';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct PinchGuestureTest { struct PinchGuestureTest {
@State X: number = 1; @State X: number = 1;
@State name: string = 'PinchGesture'; @State name: string = 'PinchGesture';
@State StepTips: string = '操作步骤:用手指触摸捏合图片(至少2根手指,最大为5指)'+'\n'+'预期结果:图片能够被正常捏合放缩'; @State StepTips: string = '操作步骤:两根手指触摸捏合图片'+'\n'+'预期结果:图片能够被正常捏合放缩';
@State Vue: boolean = false; @State Vue: boolean = false;
async aboutToAppear(){ async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name); await FirstDialog.ChooseDialog(this.StepTips,this.name);
......
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CustomContainer2'; import {CustomContainer} from '../common/CustomContainer2';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct RotationGuestureTest { struct RotationGuestureTest {
@State X: number = 0; @State X: number = 0;
@State name: string = 'RotationGesture'; @State name: string = 'RotationGesture';
@State StepTips: string = '操作步骤:用至少两根手指旋转图像(最多五根手指)'+'\n'+'预期结果:图片能够正常旋转'; @State StepTips: string = '操作步骤:两根手指旋转图像'+'\n'+'预期结果:图片能够正常旋转且文本旋转角度显示正常';
@State Vue: boolean = false; @State Vue: boolean = false;
async aboutToAppear(){ async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name); await FirstDialog.ChooseDialog(this.StepTips,this.name);
......
...@@ -12,15 +12,16 @@ ...@@ -12,15 +12,16 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CustomContainer'; import {CustomContainer} from '../common/CustomContainer';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
private listArr: number[] = Array.from(new Array(50).keys()); private listArr: number[] = Array.from(new Array(50).keys());
@State name: string = 'ScrollingList'; @State name: string = 'ScrollingList';
@State StepTips: string = '操作步骤:滑动列表观察是否能正常滑动'+'\n'+'预期结果:列表滑动正常'; @State StepTips: string = '操作步骤:滑动列表观察是否能上下滑动'+'\n'
+'预期结果:列表从Item#1滑动至Item#50,并且从#Item50滑动至#Item1,滑动正常,无卡顿';
@State Vue: boolean = false; @State Vue: boolean = false;
async aboutToAppear(){ async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name); await FirstDialog.ChooseDialog(this.StepTips,this.name);
......
...@@ -12,16 +12,16 @@ ...@@ -12,16 +12,16 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CustomContainer3'; import {CustomContainer} from '../common/CustomContainer3';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct SwipeGestureTest { struct SwipeGestureTest {
@State X : number = 0; @State X : number = 0;
@State Y : number = 0; @State Y : number = 0;
@State name: string = 'SwipeGesture'; @State name: string = 'SwipeGesture';
@State StepTips: string = '操作步骤:用至少一根手指滑动图像(最多十根手指)'+'\n'+'预期结果:图片正常滑动,手势滑动角度及速度显示正常'; @State StepTips: string = '操作步骤:手指上下滑动图像'+'\n'+'预期结果:图片正常滑动,手势滑动角度及速度显示正常';
@State Vue: boolean = false; @State Vue: boolean = false;
async aboutToAppear(){ async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name); await FirstDialog.ChooseDialog(this.StepTips,this.name);
......
...@@ -12,15 +12,15 @@ ...@@ -12,15 +12,15 @@
* 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 router from '@ohos.router';
import {CustomContainer} from '../common/CustomContainer4'; import {CustomContainer} from '../common/CustomContainer4';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router';
@Entry @Entry
@Component @Component
struct TapGestureExample { struct TapGestureExample {
@State value: string = ''; @State value: string = '';
@State name: string = 'TapGesture'; @State name: string = 'TapGesture';
@State StepTips: string = '操作步骤:用至少一根手指连续双击图像(最多十根手指)'+'\n'+'预期结果:双击图片后文本提示正常弹出'; @State StepTips: string = '操作步骤:手指连续双击图像'+'\n'+'预期结果:双击图片后文本提示正常弹出';
@State Vue: boolean = false; @State Vue: boolean = false;
async aboutToAppear(){ async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name); await FirstDialog.ChooseDialog(this.StepTips,this.name);
......
...@@ -50,7 +50,7 @@ struct CustomContainer1 { ...@@ -50,7 +50,7 @@ struct CustomContainer1 {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -82,7 +82,7 @@ struct CustomContainer1 { ...@@ -82,7 +82,7 @@ struct CustomContainer1 {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
...@@ -126,7 +126,7 @@ struct CustomContainer1 { ...@@ -126,7 +126,7 @@ struct CustomContainer1 {
}; };
let name = this.name; let name = this.name;
let displayName = `${info.prefix}${name}${info.suffix}`; let displayName = `${info.prefix}${name}${info.suffix}`;
let dirPath = path + '/' + displayName; let dirPath = path + '/screenshot' + '/' + displayName;
let imagePackerApi = image.createImagePacker(); let imagePackerApi = image.createImagePacker();
let arrayBuffer = await imagePackerApi.packing(data, packOpts); let arrayBuffer = await imagePackerApi.packing(data, packOpts);
let fd = fileio.openSync(dirPath,0o102,0o666); let fd = fileio.openSync(dirPath,0o102,0o666);
......
...@@ -86,7 +86,7 @@ struct audioInputRouting { ...@@ -86,7 +86,7 @@ struct audioInputRouting {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:'pages/Audio/Audio_index', url:'pages/Audio/Audio_index',
......
...@@ -86,7 +86,7 @@ struct audioInputRouting { ...@@ -86,7 +86,7 @@ struct audioInputRouting {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:'pages/Audio/Audio_index', url:'pages/Audio/Audio_index',
......
...@@ -76,7 +76,7 @@ struct audioOutputRouting { ...@@ -76,7 +76,7 @@ struct audioOutputRouting {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:'pages/Audio/Audio_index', url:'pages/Audio/Audio_index',
......
...@@ -76,7 +76,7 @@ struct audioOutputRouting { ...@@ -76,7 +76,7 @@ struct audioOutputRouting {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:'pages/Audio/Audio_index', url:'pages/Audio/Audio_index',
......
...@@ -76,7 +76,7 @@ struct audioOutputRouting { ...@@ -76,7 +76,7 @@ struct audioOutputRouting {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:'pages/Audio/Audio_index', url:'pages/Audio/Audio_index',
......
...@@ -99,7 +99,7 @@ struct IndexPage { ...@@ -99,7 +99,7 @@ struct IndexPage {
let number = WriteTitle.length + 11; let number = WriteTitle.length + 11;
let Index = ColorBack.indexOf(WriteTitle); let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'true'){ if (this.result === 'true '){
this.ColorObject[this.current] = '#ff008000'; this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';'); let Log = (titles+';'+'#ff008000'+';');
let key = ColorBack.substring(Index,Index+number); let key = ColorBack.substring(Index,Index+number);
...@@ -137,7 +137,7 @@ struct IndexPage { ...@@ -137,7 +137,7 @@ struct IndexPage {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp') Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back(); router.back();
}) })
...@@ -265,12 +265,12 @@ struct IndexPage { ...@@ -265,12 +265,12 @@ struct IndexPage {
FailIndex = report.indexOf('false',FailIndex + 1); FailIndex = report.indexOf('false',FailIndex + 1);
} }
let failNum = (FailNum).toString(); let failNum = (FailNum).toString();
let PassIndex = report.indexOf('true'); let PassIndex = report.indexOf('true ');
let PassNum = 0; let PassNum = 0;
while (PassIndex != -1) { while (PassIndex != -1) {
console.log(PassIndex); console.log(PassIndex);
PassNum++; PassNum++;
PassIndex = report.indexOf('true',PassIndex + 1); PassIndex = report.indexOf('true ',PassIndex + 1);
} }
let TestNum = FailNum + PassNum; let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString(); let testNum = (TestNum).toString();
......
...@@ -78,7 +78,7 @@ struct cameraOrientation { ...@@ -78,7 +78,7 @@ struct cameraOrientation {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' }) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' })
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back({ router.back({
url: 'pages/Camera/Camera_index', url: 'pages/Camera/Camera_index',
......
...@@ -106,7 +106,7 @@ struct cameraOrientation { ...@@ -106,7 +106,7 @@ struct cameraOrientation {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' }) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' })
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back({ router.back({
url: 'pages/Camera/Camera_index', url: 'pages/Camera/Camera_index',
......
...@@ -113,7 +113,7 @@ struct cameraOrientation { ...@@ -113,7 +113,7 @@ struct cameraOrientation {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' }) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' })
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back({ router.back({
url: 'pages/Camera/Camera_index', url: 'pages/Camera/Camera_index',
......
...@@ -118,7 +118,7 @@ struct cameraFormat { ...@@ -118,7 +118,7 @@ struct cameraFormat {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' }) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' })
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back({ router.back({
url: 'pages/Camera/Camera_index', url: 'pages/Camera/Camera_index',
......
...@@ -104,7 +104,7 @@ struct cameraOrientation { ...@@ -104,7 +104,7 @@ struct cameraOrientation {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' }) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' })
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back({ router.back({
url: 'pages/Camera/Camera_index', url: 'pages/Camera/Camera_index',
......
...@@ -129,7 +129,7 @@ struct cameraOrientation { ...@@ -129,7 +129,7 @@ struct cameraOrientation {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' }) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' })
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back({ router.back({
url: 'pages/Camera/Camera_index', url: 'pages/Camera/Camera_index',
......
...@@ -100,7 +100,7 @@ struct IndexPage { ...@@ -100,7 +100,7 @@ struct IndexPage {
let number = WriteTitle.length + 11; let number = WriteTitle.length + 11;
let Index = ColorBack.indexOf(WriteTitle); let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'true'){ if (this.result === 'true '){
this.ColorObject[this.current] = '#ff008000'; this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';'); let Log = (titles+';'+'#ff008000'+';');
let key = ColorBack.substring(Index,Index+number); let key = ColorBack.substring(Index,Index+number);
...@@ -138,7 +138,7 @@ struct IndexPage { ...@@ -138,7 +138,7 @@ struct IndexPage {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp') Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back(); router.back();
}) })
...@@ -266,12 +266,12 @@ struct IndexPage { ...@@ -266,12 +266,12 @@ struct IndexPage {
FailIndex = report.indexOf('false',FailIndex + 1); FailIndex = report.indexOf('false',FailIndex + 1);
} }
let failNum = (FailNum).toString(); let failNum = (FailNum).toString();
let PassIndex = report.indexOf('true'); let PassIndex = report.indexOf('true ');
let PassNum = 0; let PassNum = 0;
while (PassIndex != -1) { while (PassIndex != -1) {
console.log(PassIndex); console.log(PassIndex);
PassNum++; PassNum++;
PassIndex = report.indexOf('true',PassIndex + 1); PassIndex = report.indexOf('true ',PassIndex + 1);
} }
let TestNum = FailNum + PassNum; let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString(); let testNum = (TestNum).toString();
......
...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common'; ...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let CameraColdPath = path + '/ColdStartCamera.log'; let path1 = path + '/ExperienceData';
let CameraColdPath = path1 + '/ColdStartCamera.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'CameraColdStart'; @State name: string = 'CameraColdStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延低于2000ms则测试通过'; @State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延小于2300ms则测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State num: number = 0; @State num: number = 0;
...@@ -48,9 +49,10 @@ struct CustomContainerUser { ...@@ -48,9 +49,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用,将底层任务栏中应用拖至桌面` Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面` + '\n' + '\n'
+ '\n' + '\n' + `3.双击执行.bat选择冷启动>相机测试,回车执行`+ '\n' + '\n' +`4.测试应用自动执行冷启动后手动返回validator界面` + `3.清空后台应用,将底层任务栏中应用拖至桌面` + '\n' + '\n' + `4.工作台运行‘点击启动测试.bat’选择冷启动>相机测试,回车执行`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' ) + '\n' + '\n' +`5.测试应用自动执行冷启动后手动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果'
+ '\n' + '\n' + `7.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -94,7 +96,7 @@ struct CustomContainerUser { ...@@ -94,7 +96,7 @@ struct CustomContainerUser {
let CameraHead = CameraReport.indexOf('time:'); let CameraHead = CameraReport.indexOf('time:');
let CameraTime = CameraReport.substring(CameraHead+5); let CameraTime = CameraReport.substring(CameraHead+5);
this.cameraNum = parseFloat(CameraTime); this.cameraNum = parseFloat(CameraTime);
if( 0 < this.cameraNum && this.cameraNum < 2000 ) { if( 0 < this.cameraNum && this.cameraNum < 2300 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common'; ...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let ContactsColdPath = path + '/ColdStartContacts.log'; let path1 = path + '/ExperienceData';
let ContactsColdPath = path1 + '/ColdStartContacts.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'ContactsColdStart'; @State name: string = 'ContactsColdStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延低于2000ms则测试通过'; @State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延小于2300ms则测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State num: number = 0; @State num: number = 0;
...@@ -48,9 +49,10 @@ struct CustomContainerUser { ...@@ -48,9 +49,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用,将底层任务栏中应用拖至桌面` Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面` + '\n' + '\n'
+ '\n' + '\n' + `3.双击执行.bat选择冷启动>联系人测试,回车执行`+ '\n' + '\n' +`4.测试应用自动执行冷启动后手动返回validator界面` + `3.清空后台应用,将底层任务栏中应用拖至桌面` + '\n' + '\n' + `4.工作台运行‘点击启动测试.bat’选择冷启动>联系人测试,回车执行`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' ) + '\n' + '\n' +`5.测试应用自动执行冷启动后手动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果'
+ '\n' + '\n' + `7.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -94,7 +96,7 @@ struct CustomContainerUser { ...@@ -94,7 +96,7 @@ struct CustomContainerUser {
let ContactsHead = ContactsReport.indexOf('time:'); let ContactsHead = ContactsReport.indexOf('time:');
let ContactsTime = ContactsReport.substring(ContactsHead+5); let ContactsTime = ContactsReport.substring(ContactsHead+5);
this.contactsNum = parseFloat(ContactsTime); this.contactsNum = parseFloat(ContactsTime);
if( 0 < this.contactsNum && this.contactsNum < 2000 ) { if( 0 < this.contactsNum && this.contactsNum < 2300 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common'; ...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let ContactsColdPath = path + '/HotStartContacts.log'; let path1 = path + '/ExperienceData';
let ContactsColdPath = path1 + '/HotStartContacts.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'ContactsHotStart'; @State name: string = 'ContactsHotStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延低于1000ms则测试通过'; @State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延小于600ms则测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State num: number = 0; @State num: number = 0;
...@@ -48,10 +49,10 @@ struct CustomContainerUser { ...@@ -48,10 +49,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在` Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面`+ '\n' + '\n'
+ '\n' + '\n' + `3.双击执行.bat选择热启动>联系人测试`+ '\n' + '\n' +`4.测试应用手动执行热启动返回validator界面` + `3.开启联系人应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择热启动>联系人测试`+ '\n' + '\n' +
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若所有热启动测试均在规定时延内完成则通过测试` `5.测试应用手动执行热启动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果' + '\n' + '\n'
+ '\n' + '\n' + '\n' + '\n' ) + `7.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -95,7 +96,7 @@ struct CustomContainerUser { ...@@ -95,7 +96,7 @@ struct CustomContainerUser {
let ContactsHead = ContactsReport.indexOf(':'); let ContactsHead = ContactsReport.indexOf(':');
let ContactsTime = ContactsReport.substring(ContactsHead+1); let ContactsTime = ContactsReport.substring(ContactsHead+1);
this.contactsNum = parseFloat(ContactsTime); this.contactsNum = parseFloat(ContactsTime);
if( 0 < this.contactsNum && this.contactsNum < 1000 ) { if( 0 < this.contactsNum && this.contactsNum < 600 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -21,12 +21,13 @@ import router from '@ohos.router'; ...@@ -21,12 +21,13 @@ import router from '@ohos.router';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let Xpath = path + '/DeskFps.log' let path1 = path + '/ExperienceData';
let Xpath = path1 + '/DeskFps.log'
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'DeskFps'; @State name: string = 'DeskFps';
@State StepTips: string = '操作步骤:根据操作提示滑动系统桌面测试帧率'+'\n'+'预期结果:帧率高于54帧测试通过'; @State StepTips: string = '操作步骤:根据操作提示滑动系统桌面测试帧率'+'\n'+'预期结果:帧率大于55帧测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State Fps: string = '0'; @State Fps: string = '0';
...@@ -44,9 +45,9 @@ struct CustomContainerUser { ...@@ -44,9 +45,9 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面`+ '\n' + '\n'
+ `2.双击执行.bat选择帧率>桌面`+ '\n' + '\n' +`3.左右滑动系统桌面连续10s以上` + '\n' + '\n' + `3.工作台运行’点击启动测试.bat‘选择帧率>桌面`+ '\n' + '\n' +`4.左右滑动系统桌面连续10s以上` + '\n' + '\n'
+ '4.回到DeskFps测试项点击停止键' + '\n' + '\n' + `5.若测试最高帧率大于54帧则通过测试` + '5.回到DeskFps测试项点击结束键' + '\n' + '\n' + `6.若测试最高帧率大于55帧则通过测试`
+ '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' ) + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
...@@ -103,7 +104,7 @@ struct CustomContainerUser { ...@@ -103,7 +104,7 @@ struct CustomContainerUser {
} }
let maxFps = Math.max(...Fps); let maxFps = Math.max(...Fps);
this.Fps = maxFps.toString(); this.Fps = maxFps.toString();
if(maxFps >= 54) { if(maxFps >= 55) {
this.Vue = true; this.Vue = true;
} }
}) })
......
...@@ -24,6 +24,7 @@ import data_preferences from '@ohos.data.preferences'; ...@@ -24,6 +24,7 @@ import data_preferences from '@ohos.data.preferences';
const TAG = 'ParseXML'; const TAG = 'ParseXML';
let path = globalThis.dir; let path = globalThis.dir;
let path1 = path + '/Experience'; let path1 = path + '/Experience';
let ExperienceDataPath = path + '/ExperienceData';
let VarColor = []; let VarColor = [];
let ColorBackPath = path + '/ExperienceColorBack.txt'; let ColorBackPath = path + '/ExperienceColorBack.txt';
...@@ -112,7 +113,7 @@ struct IndexPage { ...@@ -112,7 +113,7 @@ struct IndexPage {
let number = WriteTitle.length + 11; let number = WriteTitle.length + 11;
let Index = ColorBack.indexOf(WriteTitle); let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'true'){ if (this.result === 'true '){
this.ColorObject[this.current] = '#ff008000'; this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';'); let Log = (titles+';'+'#ff008000'+';');
let key = ColorBack.substring(Index,Index+number); let key = ColorBack.substring(Index,Index+number);
...@@ -150,7 +151,7 @@ struct IndexPage { ...@@ -150,7 +151,7 @@ struct IndexPage {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp') Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back(); router.back();
}) })
...@@ -243,6 +244,8 @@ struct IndexPage { ...@@ -243,6 +244,8 @@ struct IndexPage {
ClearText(){ ClearText(){
fileio.rmdirSync(path1); fileio.rmdirSync(path1);
fileio.mkdirSync(path1); fileio.mkdirSync(path1);
fileio.rmdirSync(ExperienceDataPath);
fileio.mkdirSync(ExperienceDataPath);
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666); let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) { for(let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString(); let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString();
...@@ -252,7 +255,6 @@ struct IndexPage { ...@@ -252,7 +255,6 @@ struct IndexPage {
ReadTextParseXml(){ ReadTextParseXml(){
let ReportPath = path1 + '/ExperienceReport.txt'; let ReportPath = path1 + '/ExperienceReport.txt';
let dir = fileio.opendirSync(path1); let dir = fileio.opendirSync(path1);
console.info("ssssss"+dir);
while (dir) { while (dir) {
let OP = fileio.openSync(ReportPath, 0o100 | 0o2002, 0o664); let OP = fileio.openSync(ReportPath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(40960); let buf = new ArrayBuffer(40960);
...@@ -278,12 +280,12 @@ struct IndexPage { ...@@ -278,12 +280,12 @@ struct IndexPage {
FailIndex = report.indexOf('false',FailIndex + 1); FailIndex = report.indexOf('false',FailIndex + 1);
} }
let failNum = (FailNum).toString(); let failNum = (FailNum).toString();
let PassIndex = report.indexOf('true'); let PassIndex = report.indexOf('true ');
let PassNum = 0; let PassNum = 0;
while (PassIndex != -1) { while (PassIndex != -1) {
console.log(PassIndex); console.log(PassIndex);
PassNum++; PassNum++;
PassIndex = report.indexOf('true',PassIndex + 1); PassIndex = report.indexOf('true ',PassIndex + 1);
} }
let TestNum = FailNum + PassNum; let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString(); let testNum = (TestNum).toString();
......
...@@ -18,13 +18,14 @@ import FirstDialog from '../model/FirstDialog'; ...@@ -18,13 +18,14 @@ import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router'; import router from '@ohos.router';
let path = globalThis.dir; let path = globalThis.dir;
let Xpath = path + '/CompleteTimeKeyboard.log'; let path1 = path + '/ExperienceData';
let Xpath = path1 + '/CompleteTimeKeyboard.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'KeyboardDisplay'; @State name: string = 'KeyboardDisplay';
@State StepTips: string = '操作步骤:根据操作提示点击输入框等待键盘加载'+'\n'+'预期结果:输入键盘弹出时延于1000ms测试通过'; @State StepTips: string = '操作步骤:根据操作提示点击输入框等待键盘加载'+'\n'+'预期结果:输入键盘弹出时延于1000ms测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State time: string = '0'; @State time: string = '0';
...@@ -42,10 +43,10 @@ struct CustomContainerUser { ...@@ -42,10 +43,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入信息` + '\n' + '\n' +'2.新建一条信息显示输入框'+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入信息` + '\n' + '\n' +
+ `3.双击执行.bat选择完成时延>键盘按键弹出`+ '\n' + '\n' +`4.点击输入框等待键盘弹出` + '\n' + '\n' '3.新建一条信息显示输入框'+ '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择完成时延>键盘按键弹出`+ '\n' + '\n' +
+ '5.待脚本执行结束回到Validator点击停止键' + '\n' + '\n' + `6.若弹出键盘时延小于或等于1000ms则通过测试` `5.点击输入框等待键盘弹出` + '\n' + '\n' + '6.待脚本执行结束回到Validator点击结束键' + '\n' + '\n'
+ '\n' + '\n' + '\n' + '\n' ) + `7.若弹出键盘时延小于或等于1000ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
......
...@@ -18,13 +18,14 @@ import FirstDialog from '../model/FirstDialog'; ...@@ -18,13 +18,14 @@ import FirstDialog from '../model/FirstDialog';
import router from '@ohos.router'; import router from '@ohos.router';
let path = globalThis.dir; let path = globalThis.dir;
let Xpath = path + '/ResponseTimeKeyboard.log'; let path1 = path + '/ExperienceData';
let Xpath = path1 + '/ResponseTimeKeyboard.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'KeyboardInput'; @State name: string = 'KeyboardInput';
@State StepTips: string = '操作步骤:根据操作提示点击键盘按键'+'\n'+'预期结果:键盘输入响应时延于150ms测试通过'; @State StepTips: string = '操作步骤:根据操作提示点击键盘按键'+'\n'+'预期结果:键盘输入响应时延于150ms测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State time: string = '0'; @State time: string = '0';
...@@ -42,10 +43,10 @@ struct CustomContainerUser { ...@@ -42,10 +43,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入信息` + '\n' + '\n' +'2.新建一条信息点击输入框打开键盘'+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入信息` + '\n' + '\n' +
+ `3.双击执行.bat选择响应时延>键盘按键输入`+ '\n' + '\n' +`4.随意点击按键等待响应` + '\n' + '\n' '3.新建一条信息点击输入框打开键盘'+ '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择响应时延>键盘按键输入`+ '\n' + '\n'
+ '5.待脚本执行结束回到Validator点击停止键' + '\n' + '\n' + `6.若按键响应时延小于或等于150ms则通过测试` +`5.随意点击按键等待响应` + '\n' + '\n' + '6.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' +
+ '\n' + '\n' + '\n' + '\n' ) `7.若按键响应时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
......
...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common'; ...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let MmsColdPath = path + '/ColdStartMms.log'; let path1 = path + '/ExperienceData';
let MmsColdPath = path1 + '/ColdStartMms.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'MmsColdStart'; @State name: string = 'MmsColdStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延低于2000ms则测试通过'; @State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延小于2300ms则测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State num: number = 0; @State num: number = 0;
...@@ -48,9 +49,10 @@ struct CustomContainerUser { ...@@ -48,9 +49,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用,将底层任务栏中应用拖至桌面` Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面` + '\n' + '\n'
+ '\n' + '\n' + `3.双击执行.bat选择冷启动>信息测试,回车执行`+ '\n' + '\n' +`4.测试应用自动执行冷启动后手动返回validator界面` + `3.清空后台应用,将底层任务栏中应用拖至桌面` + '\n' + '\n' + `4.工作台运行‘点击启动测试.bat’选择冷启动>信息测试,回车执行`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' ) + '\n' + '\n' +`5.测试应用自动执行冷启动后手动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果'
+ '\n' + '\n' + `7.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -94,7 +96,7 @@ struct CustomContainerUser { ...@@ -94,7 +96,7 @@ struct CustomContainerUser {
let MmsHead = MmsReport.indexOf('time:'); let MmsHead = MmsReport.indexOf('time:');
let MmsTime = MmsReport.substring(MmsHead+5); let MmsTime = MmsReport.substring(MmsHead+5);
this.mmsNum = parseFloat(MmsTime); this.mmsNum = parseFloat(MmsTime);
if( 0 < this.mmsNum && this.mmsNum < 2000 ) { if( 0 < this.mmsNum && this.mmsNum < 2300 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common'; ...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let MmsColdPath = path + '/HotStartMms.log'; let path1 = path + '/ExperienceData';
let MmsColdPath = path1 + '/HotStartMms.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'MmsHotStart'; @State name: string = 'MmsHotStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延低于1000ms则测试通过'; @State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延小于600ms则测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State num: number = 0; @State num: number = 0;
...@@ -48,10 +49,10 @@ struct CustomContainerUser { ...@@ -48,10 +49,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在` Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面`+ '\n' + '\n'
+ '\n' + '\n' + `3.双击执行.bat选择热启动>信息测试`+ '\n' + '\n' +`4.测试应用手动执行热启动后返回validator界面` + `3.开启信息应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择热启动>信息测试`+ '\n' + '\n' +
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若热启动测试在规定时延内完成则通过测试` `5.测试应用手动执行热启动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果' + '\n' + '\n'
+ '\n' + '\n' + '\n' + '\n' ) + `7.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -95,7 +96,7 @@ struct CustomContainerUser { ...@@ -95,7 +96,7 @@ struct CustomContainerUser {
let MmsHead = MmsReport.indexOf(':'); let MmsHead = MmsReport.indexOf(':');
let MmsTime = MmsReport.substring(MmsHead+1); let MmsTime = MmsReport.substring(MmsHead+1);
this.mmsNum = parseFloat(MmsTime); this.mmsNum = parseFloat(MmsTime);
if( 0 < this.mmsNum && this.mmsNum < 1000 ) { if( 0 < this.mmsNum && this.mmsNum < 600 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -18,13 +18,14 @@ import {CustomContainer} from '../common/ExperienceCustomContainer'; ...@@ -18,13 +18,14 @@ import {CustomContainer} from '../common/ExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir; let path = globalThis.dir;
let Xpath = path + '/PhotoFps.log'; let path1 = path + '/ExperienceData';
let Xpath = path1 + '/PhotoFps.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'PhotoFps'; @State name: string = 'PhotoFps';
@State StepTips: string = '操作步骤:根据操作提示滑动图库测试帧率'+'\n'+'预期结果:帧率高于或等于54帧测试通过'; @State StepTips: string = '操作步骤:根据操作提示滑动图库测试帧率'+'\n'+'预期结果:帧率大于或等于55帧测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State Fps: string = '0'; @State Fps: string = '0';
...@@ -42,10 +43,10 @@ struct CustomContainerUser { ...@@ -42,10 +43,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.在图库中预置500张图片`+ '\n' + '\n' +`2.点击开始键进入图库`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.在图库中预置500张图片`+ '\n' + '\n'
+ `3.双击执行.bat选择帧率>图库`+ '\n' + '\n' +`4.滑动图库缩略图界面连续10s以上` + '\n' + '\n' + `3.点击开始键进入图库`+ '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择帧率>图库`+ '\n' + '\n' +
+ '5.回到PhotoFps测试项点击停止键' + '\n' + '\n' + `6.若测试最高帧率大于或等于54帧则通过测试` `5.滑动图库缩略图界面连续10s以上` + '\n' + '\n' + '6.回到PhotoFps测试项点击结束键' + '\n' + '\n' +
+ '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' ) `7.若测试最高帧率大于或等于55帧则通过测试` + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -104,7 +105,7 @@ struct CustomContainerUser { ...@@ -104,7 +105,7 @@ struct CustomContainerUser {
} }
let maxFps = Math.max(...Fps); let maxFps = Math.max(...Fps);
this.Fps = maxFps.toString(); this.Fps = maxFps.toString();
if(maxFps >= 54) { if(maxFps >= 55) {
this.Vue = true; this.Vue = true;
} }
}) })
......
...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common'; ...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let PhotosColdPath = path + '/ColdStartPhotos.log'; let path1 = path + '/ExperienceData';
let PhotosColdPath = path1 + '/ColdStartPhotos.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'PhotosColdStart'; @State name: string = 'PhotosColdStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延低于2000ms则测试通过'; @State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延小于2300ms则测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State num: number = 0; @State num: number = 0;
...@@ -48,9 +49,10 @@ struct CustomContainerUser { ...@@ -48,9 +49,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用,将底层任务栏中应用拖至桌面` Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面` + '\n' + '\n'
+ '\n' + '\n' + `3.双击执行.bat选择冷启动>图库测试,回车执行`+ '\n' + '\n' +`4.测试应用自动执行冷启动后手动返回validator界面` + `3.清空后台应用,将底层任务栏中应用拖至桌面` + '\n' + '\n' + `4.工作台运行‘点击启动测试.bat’选择冷启动>图库测试,回车执行`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' ) + '\n' + '\n' +`5.测试应用自动执行冷启动后手动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果'
+ '\n' + '\n' + `7.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -94,7 +96,7 @@ struct CustomContainerUser { ...@@ -94,7 +96,7 @@ struct CustomContainerUser {
let photosHead = photosReport.indexOf('time:'); let photosHead = photosReport.indexOf('time:');
let photosTime = photosReport.substring(photosHead+5); let photosTime = photosReport.substring(photosHead+5);
this.photosNum = parseFloat(photosTime); this.photosNum = parseFloat(photosTime);
if( 0 < this.photosNum && this.photosNum < 2000 ) { if( 0 < this.photosNum && this.photosNum < 2300 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common'; ...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let PhotosColdPath = path + '/HotStartPhotos.log'; let path1 = path + '/ExperienceData';
let PhotosColdPath = path1 + '/HotStartPhotos.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'PhotosHotStart'; @State name: string = 'PhotosHotStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延低于1000ms则测试通过'; @State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延小于600ms则测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State num: number = 0; @State num: number = 0;
...@@ -48,10 +49,10 @@ struct CustomContainerUser { ...@@ -48,10 +49,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在` Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面`+ '\n' + '\n'
+ '\n' + '\n' + `3.双击执行.bat选择热启动>图库测试`+ '\n' + '\n' +`4.测试应用手动执行热启动后返回validator界面` + `3.开启图库应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择热启动>图库测试`+ '\n' + '\n' +
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若热启动测试在规定时延内完成则通过测试` `5.测试应用手动执行热启动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果' + '\n' + '\n'
+ '\n' + '\n' + '\n' + '\n' ) + `7.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -95,7 +96,7 @@ struct CustomContainerUser { ...@@ -95,7 +96,7 @@ struct CustomContainerUser {
let photosHead = photosReport.indexOf(':'); let photosHead = photosReport.indexOf(':');
let photosTime = photosReport.substring(photosHead+1); let photosTime = photosReport.substring(photosHead+1);
this.photosNum = parseFloat(photosTime); this.photosNum = parseFloat(photosTime);
if( 0 < this.photosNum && this.photosNum < 1000 ) { if( 0 < this.photosNum && this.photosNum < 600 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -18,13 +18,14 @@ import {CustomContainer} from '../common/TimeExperienceCustomContainer'; ...@@ -18,13 +18,14 @@ import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir; let path = globalThis.dir;
let Xpath = path + '/ResponseTimePhotos.log'; let path1 = path + '/ExperienceData';
let Xpath = path1 + '/ResponseTimePhotos.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'ScrollPhotosList'; @State name: string = 'ScrollPhotosList';
@State StepTips: string = '操作步骤:根据操作提示滑动图库缩略表'+'\n'+'预期结果:滑动响应时延于150ms测试通过'; @State StepTips: string = '操作步骤:根据操作提示滑动图库缩略表'+'\n'+'预期结果:滑动响应时延于150ms测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State time: string = '0'; @State time: string = '0';
...@@ -42,10 +43,10 @@ struct CustomContainerUser { ...@@ -42,10 +43,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.在图库中预置500张图片`+ '\n' + '\n' +`2.点击开始键进入图库`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.在图库中预置500张图片`+ '\n' + '\n'
+ `3.双击执行.bat选择响应时延>图库缩略列表滑动`+ '\n' + '\n' +`4.滑动图库缩略列表等待响应` + '\n' + '\n' +`3.点击开始键进入图库`+ '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择响应时延>图库缩略列表滑动`+ '\n' + '\n' +
+ '5.待脚本执行结束回到Validator点击停止键' + '\n' + '\n' + `6.若滑动响应时延小于或等于150ms则通过测试` `5.滑动图库缩略列表等待响应` + '\n' + '\n' + '6.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' +
+ '\n' + '\n' + '\n' + '\n' ) `7.若滑动响应时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
......
...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common'; ...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let SettingsColdPath = path + '/ColdStartSetting.log'; let path1 = path + '/ExperienceData';
let SettingsColdPath = path1 + '/ColdStartSetting.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'SettingsColdStart'; @State name: string = 'SettingsColdStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延低于2000ms则测试通过'; @State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用冷启动时延小于2300ms则测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State num: number = 0; @State num: number = 0;
...@@ -48,9 +49,10 @@ struct CustomContainerUser { ...@@ -48,9 +49,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.清空后台应用,将底层任务栏中应用拖至桌面` Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面` + '\n' + '\n'
+ '\n' + '\n' + `3.双击执行.bat选择冷启动>设置测试,回车执行`+ '\n' + '\n' +`4.测试应用自动执行冷启动后手动返回validator界面` + `3.清空后台应用,将底层任务栏中应用拖至桌面` + '\n' + '\n' + `4.工作台运行‘点击启动测试.bat’选择冷启动>设置测试,回车执行`
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' ) + '\n' + '\n' +`5.测试应用自动执行冷启动后手动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果'
+ '\n' + '\n' + `7.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -94,7 +96,7 @@ struct CustomContainerUser { ...@@ -94,7 +96,7 @@ struct CustomContainerUser {
let setHead = setReport.indexOf('time:'); let setHead = setReport.indexOf('time:');
let setTime = setReport.substring(setHead+5); let setTime = setReport.substring(setHead+5);
this.setNum = parseFloat(setTime); this.setNum = parseFloat(setTime);
if( 0 < this.setNum && this.setNum < 2000 ) { if( 0 < this.setNum && this.setNum < 2300 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common'; ...@@ -20,12 +20,13 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let SettingsColdPath = path + '/HotStartSetting.log'; let path1 = path + '/ExperienceData';
let SettingsColdPath = path1 + '/HotStartSetting.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'SettingsHotStart'; @State name: string = 'SettingsHotStart';
@State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延低于1000ms则测试通过'; @State StepTips: string = '操作步骤:根据操作提示运行脚本文件,启动应用'+'\n'+'预期结果:所有应用热启动时延小于600ms则测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State num: number = 0; @State num: number = 0;
...@@ -48,10 +49,10 @@ struct CustomContainerUser { ...@@ -48,10 +49,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' + `1.点击开始键进入系统桌面`+ '\n' + '\n' + `2.开启应用回退到桌面,保证此时后台应用存在` Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入系统桌面`+ '\n' + '\n'
+ '\n' + '\n' + `3.双击执行.bat选择热启动>设置测试`+ '\n' + '\n' +`4.测试应用手动执行热启动后返回validator界面` + `3.开启设置应用回退到桌面,保证此时后台应用存在` + '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择热启动>设置测试`+ '\n' + '\n' +
+ '\n' + '\n' + '5.点击停止键观察测试结果' + '\n' + '\n' + `5.若热启动测试在规定时延内完成则通过测试` `5.测试应用手动执行热启动返回validator界面` + '\n' + '\n' + '6.点击结束键观察测试结果' + '\n' + '\n'
+ '\n' + '\n' + '\n' + '\n' ) + `7.若所有热启动测试均在规定时延内完成则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
...@@ -95,7 +96,7 @@ struct CustomContainerUser { ...@@ -95,7 +96,7 @@ struct CustomContainerUser {
let setHead = setReport.indexOf(':'); let setHead = setReport.indexOf(':');
let setTime = setReport.substring(setHead+1); let setTime = setReport.substring(setHead+1);
this.setNum = parseFloat(setTime); this.setNum = parseFloat(setTime);
if( 0 < this.setNum && this.setNum < 1000 ) { if( 0 < this.setNum && this.setNum < 600 ) {
this.num++ this.num++
} }
if( this.num === 1 ) { if( this.num === 1 ) {
......
...@@ -20,13 +20,14 @@ import context from '@ohos.app.ability.common'; ...@@ -20,13 +20,14 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let Xpath = path + '/CompleteTimeLauncher.log'; let path1 = path + '/ExperienceData';
let Xpath = path1 + '/CompleteTimeLauncher.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'StartBackgroundTask'; @State name: string = 'StartBackgroundTask';
@State StepTips: string = '操作步骤:根据操作提示打开后台任务'+'\n'+'预期结果:打开后台任务时延于600ms测试通过'; @State StepTips: string = '操作步骤:根据操作提示打开后台任务'+'\n'+'预期结果:打开后台任务时延于600ms测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State time: string = '0'; @State time: string = '0';
...@@ -44,9 +45,10 @@ struct CustomContainerUser { ...@@ -44,9 +45,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.点击开始键进入桌面开启任务管理器` + '\n' + '\n' + `2.双击执行.bat选择完成时延>后台任务切换`+ Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入桌面开启任务管理器`
'\n' + '\n' +`3.随意点开一个后台任务` + '\n' + '\n' + '4.待脚本执行结束回到Validator点击停止键' + '\n' + '\n' + `3.工作台运行’点击启动测试.bat‘选择完成时延>后台任务切换`+ '\n' + '\n' +`4.随意点开一个后台任务`
+ '\n' + '\n' + `5.若打开后台任务时延小于或等于600ms则通过测试` + '\n' + '\n' + '\n' + '\n' ) + '\n' + '\n' + '5.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' +
`6.若打开后台任务时延小于或等于600ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
......
...@@ -20,13 +20,14 @@ import context from '@ohos.app.ability.common'; ...@@ -20,13 +20,14 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let Xpath = path + '/ResponseTimeLauncher.log'; let path1 = path + '/ExperienceData';
let Xpath = path1 + '/ResponseTimeLauncher.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'StartNotification'; @State name: string = 'StartNotification';
@State StepTips: string = '操作步骤:根据操作提示下拉通知栏'+'\n'+'预期结果:下拉通知栏时延于150ms测试通过'; @State StepTips: string = '操作步骤:根据操作提示下拉通知栏'+'\n'+'预期结果:下拉通知栏时延于150ms测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State time: string = '0'; @State time: string = '0';
...@@ -44,9 +45,10 @@ struct CustomContainerUser { ...@@ -44,9 +45,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.点击开始键进入桌面` + '\n' + '\n' + `2.双击执行.bat选择响应时延>下拉状态栏`+ Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入桌面` + '\n' + '\n'
'\n' + '\n' +`3.从屏幕顶部滑动下拉通知栏` + '\n' + '\n' + '4.待脚本执行结束回到Validator点击停止键' + `3.工作台运行’点击启动测试.bat‘选择响应时延>下拉状态栏`+ '\n' + '\n' +`4.从屏幕顶部滑动下拉通知栏` + '\n' + '\n'
+ '\n' + '\n' + `5.若下拉通知栏时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' ) + '5.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' + `6.若下拉通知栏时延小于或等于150ms则通过测试` +
'\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
......
...@@ -20,13 +20,14 @@ import context from '@ohos.app.ability.common'; ...@@ -20,13 +20,14 @@ import context from '@ohos.app.ability.common';
let abilityContext = getContext(this) as context.UIAbilityContext; let abilityContext = getContext(this) as context.UIAbilityContext;
let path = globalThis.dir; let path = globalThis.dir;
let Xpath = path + '/CompleteTimeLauncher.log'; let path1 = path + '/ExperienceData';
let Xpath = path1 + '/CompleteTimeLauncher.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'StartTaskManager'; @State name: string = 'StartTaskManager';
@State StepTips: string = '操作步骤:根据操作提示打开任务管理器'+'\n'+'预期结果:打开任务管理器时延于1000ms测试通过'; @State StepTips: string = '操作步骤:根据操作提示打开任务管理器'+'\n'+'预期结果:打开任务管理器时延于1000ms测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State time: string = '0'; @State time: string = '0';
...@@ -44,9 +45,10 @@ struct CustomContainerUser { ...@@ -44,9 +45,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.点击开始键进入桌面` + '\n' + '\n' + `2.双击执行.bat选择完成时延>启动任务管理器`+ Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.点击开始键进入桌面` + '\n' + '\n'
'\n' + '\n' +`3.点击右下角方框开启任务管理器` + '\n' + '\n' + '4.待脚本执行结束回到Validator点击停止键' + `3.工作台运行’点击启动测试.bat‘选择完成时延>启动任务管理器`+ '\n' + '\n' +`4.点击右下角方框开启任务管理器` + '\n' + '\n'
+ '\n' + '\n' + `5.若启动任务管理器时延小于或等于1000ms则通过测试` + '\n' + '\n' + '\n' + '\n' ) + '5.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' + `6.若启动任务管理器时延小于或等于1000ms则通过测试`
+ '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
......
...@@ -18,13 +18,14 @@ import {CustomContainer} from '../common/TimeExperienceCustomContainer'; ...@@ -18,13 +18,14 @@ import {CustomContainer} from '../common/TimeExperienceCustomContainer';
import FirstDialog from '../model/FirstDialog'; import FirstDialog from '../model/FirstDialog';
let path = globalThis.dir; let path = globalThis.dir;
let Xpath = path + '/ResponseTimePhotos.log'; let path1 = path + '/ExperienceData';
let Xpath = path1 + '/ResponseTimePhotos.log';
@Entry @Entry
@Component @Component
struct CustomContainerUser { struct CustomContainerUser {
@State name: string = 'ViewPhoto'; @State name: string = 'ViewPhoto';
@State StepTips: string = '操作步骤:根据操作提示点击图片等待加载'+'\n'+'预期结果:图片响应时延于150ms测试通过'; @State StepTips: string = '操作步骤:根据操作提示点击图片等待加载'+'\n'+'预期结果:图片响应时延于150ms测试通过';
@State Vue: boolean = false; @State Vue: boolean = false;
@State StartEnable: boolean = true; @State StartEnable: boolean = true;
@State time: string = '0'; @State time: string = '0';
...@@ -42,10 +43,10 @@ struct CustomContainerUser { ...@@ -42,10 +43,10 @@ struct CustomContainerUser {
.fontColor(Color.White).fontSize('24fp') .fontColor(Color.White).fontSize('24fp')
} }
Row(){ Row(){
Text(`测试步骤:`+ '\n' + '\n' +`1.在图库中预置500张图片`+ '\n' + '\n' +`2.点击开始键进入图库`+ '\n' + '\n' Text(`测试步骤:`+ '\n' + '\n' + '1.测试设备通过USB连接工作台' + '\n' + '\n' + `2.在图库中预置500张图片`+ '\n' + '\n'
+ `3.双击执行.bat选择响应时延>查看图片`+ '\n' + '\n' +`4.点击一张图库缩略图等待响应` + '\n' + '\n' + `3.点击开始键进入图库`+ '\n' + '\n' + `4.工作台运行’点击启动测试.bat‘选择响应时延>查看图片` + '\n' + '\n' +
+ '5.待脚本执行结束回到Validator点击停止键' + '\n' + '\n' + `6.若图片响应时延小于或等于150ms则通过测试` `5.点击一张图库缩略图等待响应` + '\n' + '\n' + '6.待脚本执行结束回到Validator点击结束键' + '\n' + '\n' +
+ '\n' + '\n' + '\n' + '\n' ) `7.若图片响应时延小于或等于150ms则通过测试` + '\n' + '\n' + '\n' + '\n' )
.fontColor(Color.White).fontSize('20fp') .fontColor(Color.White).fontSize('20fp')
} }
Row(){ Row(){
......
...@@ -21,14 +21,14 @@ import router from '@ohos.router'; ...@@ -21,14 +21,14 @@ import router from '@ohos.router';
@Component @Component
struct playAudio { struct playAudio {
@State FillColor: string = '#FF000000'; @State FillColor: string = '#FF000000';
@State name: string = 'PlayAudio'; @State name: string = router.getParams()['audioTitle']
@State StepTips: string = '测试目的:用于测试音频播放暂停seek\n预期结果:音频播放暂停seek功能正常'; @State StepTips: string = '测试目的:用于测试音频播放暂停seek\n预期结果:音频播放暂停seek功能正常';
private tag: string = 'qlw' private tag: string = 'qlw';
@State Vue: boolean = false @State Vue: boolean = false;
@State videoSrc: Resource = $rawfile('StarWars10s-1C-44100-2SW.wav') @State audioSrc: string = router.getParams()['audioUrl'];
@State isAutoPlay: boolean = true @State isAutoPlay: boolean = true;
@State showControls: boolean = true @State showControls: boolean = true;
controller: VideoController = new VideoController() controller: VideoController = new VideoController();
async aboutToAppear() { async aboutToAppear() {
await FirstDialog.ChooseDialog(this.StepTips, this.name); await FirstDialog.ChooseDialog(this.StepTips, this.name);
...@@ -39,10 +39,10 @@ struct playAudio { ...@@ -39,10 +39,10 @@ struct playAudio {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' }) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' })
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back({ router.back({
url: 'pages/Player/Player_index', url: 'pages/Player/PlayAudioList',
params: { result: 'None', } params: { result: 'None', }
}) })
}) })
...@@ -53,7 +53,7 @@ struct playAudio { ...@@ -53,7 +53,7 @@ struct playAudio {
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Video({ Video({
src: this.videoSrc, src: this.audioSrc,
controller: this.controller controller: this.controller
}) })
.width('100%') .width('100%')
...@@ -61,24 +61,25 @@ struct playAudio { ...@@ -61,24 +61,25 @@ struct playAudio {
.autoPlay(this.isAutoPlay) .autoPlay(this.isAutoPlay)
.controls(this.showControls) .controls(this.showControls)
.onFinish(() => { .onFinish(() => {
this.Vue = true this.Vue = true;
}) })
}.width('100%').height('80%').onClick(() => { }.width('100%').height('80%').onClick(() => {
this.showControls = !this.showControls this.showControls = !this.showControls;
}) })
CustomContainer({ CustomContainer({
title: this.name, title: this.name,
Url: 'pages/Player/Player_index', Url: 'pages/Player/PlayAudioList',
StepTips: this.StepTips, StepTips: this.StepTips,
name: $name, name: $name,
Vue: $Vue Vue: $Vue
}).height('10%').width('100%') }).height('10%').width('100%')
}.width('100%').height('100%').backgroundColor(Color.Black) }.width('100%').height('100%').backgroundColor(Color.Black)
} }
onBackPress(){
onBackPress() {
router.replaceUrl({ router.replaceUrl({
url:'pages/Player/Player_index', url: 'pages/Player/PlayAudioList',
}) })
} }
} }
\ No newline at end of file
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary'
import data_preferences from '@ohos.data.preferences';
import MediaUtils from '../model/MediaUtils'
const TAG = 'ParseXML';
let path = globalThis.dir;
let path1 = path + '/Player';
let VarColor = [];
let ColorBackPath = path1 + '/PlayerAudioColorBack.txt';
let txtPath = path1 + '/PlayerAudioReport.txt';
@Entry
@Component
struct audioNew {
@State ClearAll: boolean = false;
@State name: string = 'PlayerAudio';
@State Vue: boolean = false;
private current: number = undefined;
@State MediaLib: MediaUtils = new MediaUtils();
@State count: number = 0;
@State result: string = '';
@State TEST: number = 0;
@State Url: string = '';
@State TestCaseList: Array<mediaLibrary.FileAsset> = [];
@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('PlayerAudio', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'PlayerAudio'. Data: " + data);
});
this.TestCaseList = await this.MediaLib.getFileAssetsAlbum('Audios/ValidatorData/');
if (Test != 1) {
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for (let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].displayName + ';' + '#ff808080' + ';').toString();
fileio.writeSync(fd, log);
}
fileio.closeSync(fd);
}
promise = preferences.put('PlayerAudio', 1);
promise.then(() => {
console.info("Succeeded in putting value of 'PlayerAudio'.");
});
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 === 'true ') {
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 === 'false') {
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];
}
}
// 所有测试项满足返回ture
let color = '#ff008000';
let colorBol = this.ColorObject.every((item) => item === color);
this.Vue = colorBol;
}
build() {
Column() {
Row() {
Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => {
router.back({
url: 'pages/Player/Player_index',
params: { result: 'None', }
})
})
Row() {
Text('Player Audio')
.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: () => {
}
}
)
})
}
}
.width('100%')
.justifyContent(FlexAlign.SpaceAround)
.margin({ top: '15vp' })
.height('6%')
.backgroundColor(Color.Black)
List({ space: 5 }) {
ForEach(this.TestCaseList, (item: mediaLibrary.FileAsset, index) => {
ListItem() {
Row() {
Text(item.displayName).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: 'pages/Player/PlayAudio',
params: {
audioUrl: item.uri,
audioTitle: item.displayName
}
})
})
}
}, item => item.title)
}.width('100%').height('80%')
Row() {
Blank()
Button() {
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
}
.width('40%')
.height('30vp')
.backgroundColor(Color.Grey)
.enabled(this.Vue)
.opacity(this.Vue ? 1 : 0.4)
.onClick(() => {
router.back({
url: 'pages/Player/Player_index',
params: { result: 'true ', title: this.name,
}
})
prompt.showToast({
message: '通过', duration: 1000
});
})
Blank().width(40)
Button() {
Image($r('app.media.ic_public_fail')).width('20vp').height('20vp')
}.width('40%').height('30vp').backgroundColor(Color.Grey)
.onClick(() => {
router.back({
url: 'pages/Player/Player_index',
params: { result: 'false', title: this.name,
}
})
console.log('wwwwwwwwww' + this.Url)
prompt.showToast({
message: '失败', duration: 1000
});
})
Blank()
}.width('100%').height('14%').backgroundColor(Color.Black).justifyContent(FlexAlign.Center)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
ClearText() {
fileio.unlinkSync(txtPath);
fileio.unlinkSync(ColorBackPath);
fileio.openSync(txtPath, 0o100 | 0o2002, 0o664);
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for (let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].displayName + ';' + '#ff808080' + ';').toString();
fileio.writeSync(fd, log);
}
}
onBackPress() {
router.replaceUrl({
url: 'pages/Player/Player_index',
})
}
}
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 WriteResult = (results).toString();
let number = WriteTitle.length + WriteResult.length + 2;
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
...@@ -22,14 +22,14 @@ import router from '@ohos.router'; ...@@ -22,14 +22,14 @@ import router from '@ohos.router';
@Component @Component
struct playVideo { struct playVideo {
@State FillColor: string = '#FF000000'; @State FillColor: string = '#FF000000';
@State name: string = 'PlayVideo'; @State name: string = router.getParams()['audioTitle'];
@State StepTips: string = '测试目的:用于测试视频播放暂停seek\n预期结果:视频播放暂停seek功能正常'; @State StepTips: string = '测试目的:用于测试视频播放暂停seek\n预期结果:视频播放暂停seek功能正常';
private tag: string = 'qlw' private tag: string = 'qlw';
@State Vue: boolean = false @State Vue: boolean = false;
@State videoSrc: Resource = $rawfile('H264_AAC.mkv') @State videoSrc: string = router.getParams()['audioUrl'];
@State isAutoPlay: boolean = true @State isAutoPlay: boolean = true;
@State showControls: boolean = true @State showControls: boolean = true;
controller: VideoController = new VideoController() controller: VideoController = new VideoController();
async aboutToAppear() { async aboutToAppear() {
await FirstDialog.ChooseDialog(this.StepTips, this.name); await FirstDialog.ChooseDialog(this.StepTips, this.name);
...@@ -40,10 +40,10 @@ struct playVideo { ...@@ -40,10 +40,10 @@ struct playVideo {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' }) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({ left: '20vp' })
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back({ router.back({
url: 'pages/Player/Player_index', url: 'pages/Player/PlayVideoList',
params: { result: 'None', } params: { result: 'None', }
}) })
}) })
...@@ -62,7 +62,7 @@ struct playVideo { ...@@ -62,7 +62,7 @@ struct playVideo {
.autoPlay(this.isAutoPlay) .autoPlay(this.isAutoPlay)
.controls(this.showControls) .controls(this.showControls)
.onFinish(() => { .onFinish(() => {
this.Vue = true this.Vue = true;
}) })
}.width('100%').height('80%').onClick(() => { }.width('100%').height('80%').onClick(() => {
this.showControls = !this.showControls this.showControls = !this.showControls
...@@ -70,16 +70,17 @@ struct playVideo { ...@@ -70,16 +70,17 @@ struct playVideo {
CustomContainer({ CustomContainer({
title: this.name, title: this.name,
Url: 'pages/Player/Player_index', Url: 'pages/Player/PlayVideoList',
StepTips: this.StepTips, StepTips: this.StepTips,
name: $name, name: $name,
Vue: $Vue Vue: $Vue
}).height('10%').width('100%') }).height('10%').width('100%')
}.width('100%').height('100%').backgroundColor(Color.Black) }.width('100%').height('100%').backgroundColor(Color.Black)
} }
onBackPress(){
onBackPress() {
router.replaceUrl({ router.replaceUrl({
url:'pages/Player/Player_index', url: 'pages/Player/PlayVideoList',
}) })
} }
} }
\ No newline at end of file
/*
* 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 mediaLibrary from '@ohos.multimedia.mediaLibrary'
import data_preferences from '@ohos.data.preferences';
import MediaUtils from '../model/MediaUtils'
const TAG = 'ParseXML';
let path = globalThis.dir;
let path1 = path + '/Player';
let VarColor = [];
let ColorBackPath = path1 + '/PlayerVideoColorBack.txt';
let txtPath = path1 + '/PlayerVideoReport.txt';
@Entry
@Component
struct videoNew {
@State ClearAll: boolean = false;
@State name: string = 'PlayerVideo';
@State Vue: boolean = false;
private current: number = undefined;
@State MediaLib: MediaUtils = new MediaUtils();
@State count: number = 0;
@State result: string = '';
@State TEST: number = 0;
@State Url: string = 'pages/Player/Player_index';
@State TestCaseList: Array<mediaLibrary.FileAsset> = [];
@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('PlayerVideo', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'PlayerVideo'. Data: " + data);
});
this.TestCaseList = await this.MediaLib.getFileAssetsAlbum('Videos/ValidatorData/');
if (Test != 1) {
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for (let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].displayName + ';' + '#ff808080' + ';').toString();
fileio.writeSync(fd, log);
}
fileio.closeSync(fd);
}
promise = preferences.put('PlayerVideo', 1);
promise.then(() => {
console.info("Succeeded in putting value of 'PlayerVideo'.");
});
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 === 'true ') {
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 === 'false') {
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];
}
}
// 所有测试项满足返回ture
let color = '#ff008000';
let colorBol = this.ColorObject.every((item) => item === color);
this.Vue = colorBol;
}
build() {
Column() {
Row() {
Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => {
router.back({
url: 'pages/Player/Player_index',
params: { result: 'None', }
})
})
Row() {
Text('Player Video')
.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: () => {
}
}
)
})
}
}
.width('100%')
.justifyContent(FlexAlign.SpaceAround)
.margin({ top: '15vp' })
.height('6%')
.backgroundColor(Color.Black)
List({ space: 5 }) {
ForEach(this.TestCaseList, (item: mediaLibrary.FileAsset, index) => {
ListItem() {
Row() {
Text(item.displayName).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: 'pages/Player/PlayVideo',
params: {
audioUrl: item.uri,
audioTitle: item.displayName
}
})
})
}
}, item => item.title)
}.width('100%').height('80%')
Row() {
Blank()
Button({ stateEffect: this.Vue }) {
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
}
.width('40%')
.height('30vp')
.backgroundColor(Color.Grey)
.enabled(this.Vue)
.opacity(this.Vue ? 1 : 0.4)
.onClick(() => {
router.back({
url: this.Url,
params: { result: 'true ', title: this.name,
}
})
prompt.showToast({
message: '通过', duration: 1000
});
})
Blank().width(40)
Button() {
Image($r('app.media.ic_public_fail')).width('20vp').height('20vp')
}.width('40%').height('30vp').backgroundColor(Color.Grey)
.onClick(() => {
router.back({
url: this.Url,
params: { result: 'false', title: this.name,
}
})
console.log('wwwwwwwwww' + this.Url)
prompt.showToast({
message: '失败', duration: 1000
});
})
Blank()
}.width('100%').height('14%').backgroundColor(Color.Black).justifyContent(FlexAlign.Center)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
ClearText() {
fileio.unlinkSync(txtPath);
fileio.unlinkSync(ColorBackPath);
fileio.openSync(txtPath, 0o100 | 0o2002, 0o664);
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for (let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].displayName + ';' + '#ff808080' + ';').toString();
fileio.writeSync(fd, log);
}
}
onBackPress() {
router.replaceUrl({
url: 'pages/Player/Player_index',
})
}
}
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 WriteResult = (results).toString();
let number = WriteTitle.length + WriteResult.length + 2;
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
...@@ -20,6 +20,7 @@ import xml from '@ohos.xml'; ...@@ -20,6 +20,7 @@ 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'; import data_preferences from '@ohos.data.preferences';
import FlushData from '../model/FlushData';
const TAG = 'ParseXML'; const TAG = 'ParseXML';
let path = globalThis.dir; let path = globalThis.dir;
...@@ -28,28 +29,29 @@ let path1 = path + '/Player'; ...@@ -28,28 +29,29 @@ let path1 = path + '/Player';
let VarColor = []; let VarColor = [];
let ColorBackPath = path + '/PlayerColorBack.txt'; let ColorBackPath = path + '/PlayerColorBack.txt';
let txtPath = path1 + '/PlayerReport.txt'; let txtPath = path1 + '/PlayerReport.txt';
let xmlPath =path1 + '/PlayerTest.xml'; let xmlPath = path1 + '/PlayerTest.xml';
@Entry @Entry
@Component @Component
struct IndexPage { struct IndexPage {
@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; @State TEST: number = 0;
private TestCaseList = [ private TestCaseList = [
{title:'PlayAudio',uri:'pages/Player/PlayAudio'}, { title: 'PlayerAudio', uri: 'pages/Player/PlayAudioList' },
{title:'PlayVideo',uri:'pages/Player/PlayVideo'}, { title: 'PlayerVideo', uri: 'pages/Player/PlayVideoList' },
] ]
@State ColorObject : string[] = VarColor; @State ColorObject: string[] = VarColor;
async onPageShow(){
async onPageShow() {
let Test = null; let Test = null;
let context =null; let context = null;
context = globalThis.getContext(); context = globalThis.getContext();
let preferences; let preferences;
let promise = data_preferences.getPreferences(context,'mystore'); let promise = data_preferences.getPreferences(context, 'mystore');
await promise.then((object) => { await promise.then((object) => {
preferences = object; preferences = object;
}); });
...@@ -59,11 +61,11 @@ struct IndexPage { ...@@ -59,11 +61,11 @@ struct IndexPage {
console.info("Succeeded in getting value of 'Player'. Data: " + data); console.info("Succeeded in getting value of 'Player'. Data: " + data);
}); });
if(Test != 1) { if (Test != 1) {
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666); let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) { for (let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString(); let log = (this.TestCaseList[i].title + ';' + '#ff808080' + ';').toString();
fileio.writeSync(fd,log); fileio.writeSync(fd, log);
} }
fileio.closeSync(fd); fileio.closeSync(fd);
} }
...@@ -79,72 +81,76 @@ struct IndexPage { ...@@ -79,72 +81,76 @@ struct IndexPage {
let opt = fileio.openSync(ColorBackPath, 0o100 | 0o2002, 0o664); let opt = fileio.openSync(ColorBackPath, 0o100 | 0o2002, 0o664);
let buff = new ArrayBuffer(40960); let buff = new ArrayBuffer(40960);
fileio.readSync(opt,buff); fileio.readSync(opt, buff);
let ColorBack = String.fromCharCode.apply(null, new Uint8Array(buff)); let ColorBack = String.fromCharCode.apply(null, new Uint8Array(buff));
let TestList = ColorBack.split(';'); let TestList = ColorBack.split(';');
for (let i = 0; i < Math.floor(TestList.length / 2); i++) { for (let i = 0; i < Math.floor(TestList.length / 2); i++) {
VarColor[i] = TestList[i*2+1]; VarColor[i] = TestList[i * 2+1];
} }
fileio.closeSync(opt); 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 WriteTitle = (titles).toString();
let number = WriteTitle.length + 11; let number = WriteTitle.length + 11;
let Index = ColorBack.indexOf(WriteTitle); let Index = ColorBack.indexOf(WriteTitle);
if (this.result === 'true'){ if (this.result === 'true ') {
this.ColorObject[this.current] = '#ff008000'; this.ColorObject[this.current] = '#ff008000';
let Log = (titles+';'+'#ff008000'+';'); let Log = (titles + ';' + '#ff008000' + ';');
let key = ColorBack.substring(Index,Index+number); let key = ColorBack.substring(Index, Index + number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666); let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log); ColorBack = ColorBack.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 = ColorBack.substring(0,rd); let Report = ColorBack.substring(0, rd);
fileio.closeSync(FD); fileio.closeSync(FD);
let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666); let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
fileio.writeSync(Fd,Report); fileio.writeSync(Fd, Report);
filewrite(name1,results,titles) filewrite(name1, results, titles)
} }
else if (this.result === 'false'){ else if (this.result === 'false') {
this.ColorObject[this.current] = '#ffff0000'; this.ColorObject[this.current] = '#ffff0000';
let Log = (titles+';'+'#ffff0000'+';'); let Log = (titles + ';' + '#ffff0000' + ';');
let key = ColorBack.substring(Index,Index+number); let key = ColorBack.substring(Index, Index + number);
let FD = fileio.openSync(ColorBackPath, 0o102, 0o666); let FD = fileio.openSync(ColorBackPath, 0o102, 0o666);
ColorBack = ColorBack.replace(key,Log); ColorBack = ColorBack.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 = ColorBack.substring(0,rd); let Report = ColorBack.substring(0, rd);
fileio.closeSync(FD); fileio.closeSync(FD);
let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666); let Fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
fileio.writeSync(Fd,Report); 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(){
Column(){ build() {
Column() {
Row() { Row() {
Button() { Button() {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp') Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(() => { .onClick(() => {
router.back(); router.back();
}) })
Row(){
Row() {
Text('Player SubSystem') Text('Player SubSystem')
.fontColor(Color.White) .fontColor(Color.White)
.fontSize('22fp') .fontSize('22fp')
}.justifyContent(FlexAlign.SpaceAround).backgroundColor(Color.Black) }.justifyContent(FlexAlign.SpaceAround).backgroundColor(Color.Black)
Row() { Row() {
Button(){ Button() {
Image($r('app.media.ic_public_delete')) Image($r('app.media.ic_public_delete'))
.width('30vp') .width('30vp')
.height('30vp') .height('30vp')
...@@ -178,7 +184,8 @@ struct IndexPage { ...@@ -178,7 +184,8 @@ struct IndexPage {
} }
) )
}) })
Button(){
Button() {
Image($r('app.media.ic_public_save')) Image($r('app.media.ic_public_save'))
.width('30vp') .width('30vp')
.height('30vp') .height('30vp')
...@@ -188,9 +195,9 @@ struct IndexPage { ...@@ -188,9 +195,9 @@ struct IndexPage {
this.ReadTextParseXml(); this.ReadTextParseXml();
AlertDialog.show({ AlertDialog.show({
message: "报告已生成,如需查看通过命令行输入'hdc_std file recv /data/app/el2/100/base/com.example.actsvalidator/haps/entry/files/Player/PlayerTest.xml -本地路径'", message: "报告已生成,如需查看通过命令行输入'hdc_std file recv /data/app/el2/100/base/com.example.actsvalidator/haps/entry/files/Player/PlayerTest.xml -本地路径'",
confirm:{ confirm: {
value:'OK', value: 'OK',
action:()=>{ action: () => {
prompt.showToast({ prompt.showToast({
message: '报告已生成', duration: 1000 message: '报告已生成', duration: 1000
}) })
...@@ -204,70 +211,86 @@ struct IndexPage { ...@@ -204,70 +211,86 @@ struct IndexPage {
}) })
}) })
} }
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%').backgroundColor(Color.Black) }
List({space:5}){ .width('100%')
ForEach(this.TestCaseList,(item,index) => { .justifyContent(FlexAlign.SpaceAround)
ListItem(){ .margin({ top: '15vp' })
Row(){ .height('6%')
.backgroundColor(Color.Black)
List({ space: 5 }) {
ForEach(this.TestCaseList, (item, index) => {
ListItem() {
Row() {
Text(item.title).fontSize(16).fontColor(Color.Black) 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(( )=>{ .width('100%')
.height(50)
.alignItems(VerticalAlign.Center)
.backgroundColor(this.count === 0 && this.TEST === 0 ? '#ff808080' : this.ColorObject[index])
.onClick(() => {
this.count = 1; this.count = 1;
this.ClearAll=false; this.ClearAll = false;
this.current = index; this.current = index;
router.push({ router.push({
url: item.uri, url: item.uri,
}) })
}) })
} }
},item => item.title) }, item => item.title)
}.width('100%').height('92%') }.width('100%').height('92%')
}.width('100%').height('100%').backgroundColor(Color.Black) }.width('100%').height('100%').backgroundColor(Color.Black)
} }
ClearText(){
ClearText() {
fileio.rmdirSync(path1); fileio.rmdirSync(path1);
fileio.mkdirSync(path1); fileio.mkdirSync(path1);
let fd = fileio.openSync(ColorBackPath, 0o102, 0o666); let fd = fileio.openSync(ColorBackPath, 0o102, 0o666);
for(let i = 0; i < this.TestCaseList.length; i++) { for (let i = 0; i < this.TestCaseList.length; i++) {
let log = (this.TestCaseList[i].title+';'+'#ff808080'+';').toString(); let log = (this.TestCaseList[i].title + ';' + '#ff808080' + ';').toString();
fileio.writeSync(fd,log); fileio.writeSync(fd, log);
} }
FlushData.ResetPlayerAudio();
FlushData.ResetPlayerVideo();
} }
ReadTextParseXml(){
ReadTextParseXml() {
let ReportPath = path1 + '/PlayerReport.txt'; let ReportPath = path1 + '/PlayerReport.txt';
let dir = fileio.opendirSync(path1); let dir = fileio.opendirSync(path1);
console.info("ssssss"+dir); console.info("ssssss" + dir);
while (dir) { while (dir) {
let OP = fileio.openSync(ReportPath, 0o100 | 0o2002, 0o664); let OP = fileio.openSync(ReportPath, 0o100 | 0o2002, 0o664);
let buf = new ArrayBuffer(40960); let buf = new ArrayBuffer(40960);
let RD = fileio.readSync(OP,buf); let RD = fileio.readSync(OP, buf);
console.info("ddddd"+RD); console.info("ddddd" + RD);
let report; let report;
function ab2str(buf) { function ab2str(buf) {
return report = String.fromCharCode.apply(null,new Uint8Array(buf)); return report = String.fromCharCode.apply(null, new Uint8Array(buf));
} }
ab2str(buf); ab2str(buf);
let str1 = report.split(";"); let str1 = report.split(";");
let title = []; let title = [];
let result = []; let result = [];
for(let i=0; i<Math.floor(str1.length/2); i++){ for (let i = 0; i < Math.floor(str1.length / 2); i++) {
title[i] = str1[i*2]; title[i] = str1[i*2];
result[i] = str1[i*2+1]; result[i] = str1[i * 2+1];
} }
let FailIndex = report.indexOf('false'); let FailIndex = report.indexOf('false');
let FailNum = 0; let FailNum = 0;
while (FailIndex != -1) { while (FailIndex != -1) {
console.log(FailIndex); console.log(FailIndex);
FailNum++; FailNum++;
FailIndex = report.indexOf('false',FailIndex + 1); FailIndex = report.indexOf('false', FailIndex + 1);
} }
let failNum = (FailNum).toString(); let failNum = (FailNum).toString();
let PassIndex = report.indexOf('true'); let PassIndex = report.indexOf('true ');
let PassNum = 0; let PassNum = 0;
while (PassIndex != -1) { while (PassIndex != -1) {
console.log(PassIndex); console.log(PassIndex);
PassNum++; PassNum++;
PassIndex = report.indexOf('true',PassIndex + 1); PassIndex = report.indexOf('true ', PassIndex + 1);
} }
let TestNum = FailNum + PassNum; let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString(); let testNum = (TestNum).toString();
...@@ -276,7 +299,7 @@ struct IndexPage { ...@@ -276,7 +299,7 @@ struct IndexPage {
let serializer = new xml.XmlSerializer(bufView); let serializer = new xml.XmlSerializer(bufView);
serializer.setDeclaration(); serializer.setDeclaration();
serializer.startElement("testsuite"); serializer.startElement("testsuite");
serializer.setAttributes("name","ActsPlayerTest"); serializer.setAttributes("name", "ActsPlayerTest");
serializer.setAttributes("time", "*"); serializer.setAttributes("time", "*");
serializer.setAttributes("errors", "0"); serializer.setAttributes("errors", "0");
serializer.setAttributes("disabled", "0"); serializer.setAttributes("disabled", "0");
...@@ -302,42 +325,43 @@ struct IndexPage { ...@@ -302,42 +325,43 @@ struct IndexPage {
let array = new Uint8Array(arrayBuffer); let array = new Uint8Array(arrayBuffer);
let serializerStr = that.decode(array); let serializerStr = that.decode(array);
console.info(xmlPath); console.info(xmlPath);
try{ try {
console.error(TAG,"write xmlPath =" +xmlPath); console.error(TAG, "write xmlPath =" + xmlPath);
var xmlfd = fileIO.openSync(xmlPath, 0o102, 0o666); var xmlfd = fileIO.openSync(xmlPath, 0o102, 0o666);
fileIO.writeSync(xmlfd,serializerStr); fileIO.writeSync(xmlfd, serializerStr);
}catch(err){ } catch (err) {
console.error(TAG,"read xmlPath =" + xmlPath + "error:" + err); console.error(TAG, "read xmlPath =" + xmlPath + "error:" + err);
}finally{ } finally {
fileIO.closeSync(xmlfd); fileIO.closeSync(xmlfd);
} }
return; return;
} }
} }
} }
function filewrite(name1,results,titles){
function filewrite(name1, results, titles) {
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);
let report = String.fromCharCode.apply(null,new Uint8Array(buf)); let report = String.fromCharCode.apply(null, new Uint8Array(buf));
let WriteTitle = (titles).toString(); let WriteTitle = (titles).toString();
let WriteResult = (results).toString(); let WriteResult = (results).toString();
let number = WriteTitle.length + WriteResult.length + 2; let number = WriteTitle.length + WriteResult.length + 2;
let Index = report.indexOf(WriteTitle); let Index = report.indexOf(WriteTitle);
let Log = (titles+";"+results+";").toString(); let Log = (titles + ";" + results + ";").toString();
if (Index == -1){ if (Index == -1) {
fileio.writeSync(fd,Log); fileio.writeSync(fd, Log);
} }
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(txtPath, 0o102, 0o666); let FD = fileio.openSync(txtPath, 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(txtPath, 0o102, 0o666); let Fd = fileio.openSync(txtPath, 0o102, 0o666);
fileio.writeSync(Fd,Report); fileio.writeSync(Fd, Report);
} }
} }
\ No newline at end of file
...@@ -47,7 +47,7 @@ export struct CustomContainer { ...@@ -47,7 +47,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
......
...@@ -55,7 +55,7 @@ export struct CustomContainer { ...@@ -55,7 +55,7 @@ export struct CustomContainer {
.onClick(() => { .onClick(() => {
router.back({ router.back({
url: this.Url, url: this.Url,
params: { result: 'true', title: this.name, params: { result: 'true ', title: this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
......
...@@ -57,7 +57,7 @@ export struct CustomContainer { ...@@ -57,7 +57,7 @@ export struct CustomContainer {
if (this.clickFrequency === this.testingFrequency){ if (this.clickFrequency === this.testingFrequency){
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
} }
......
...@@ -48,7 +48,7 @@ export struct CustomContainer { ...@@ -48,7 +48,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
......
...@@ -48,7 +48,7 @@ export struct CustomContainer { ...@@ -48,7 +48,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
......
...@@ -48,7 +48,7 @@ export struct CustomContainer { ...@@ -48,7 +48,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
......
...@@ -50,7 +50,7 @@ export struct CustomContainer { ...@@ -50,7 +50,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -82,7 +82,7 @@ export struct CustomContainer { ...@@ -82,7 +82,7 @@ export struct CustomContainer {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
......
...@@ -52,7 +52,7 @@ export struct CustomContainer { ...@@ -52,7 +52,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -84,7 +84,7 @@ export struct CustomContainer { ...@@ -84,7 +84,7 @@ export struct CustomContainer {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
......
...@@ -48,7 +48,7 @@ export struct CustomContainer { ...@@ -48,7 +48,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -80,7 +80,7 @@ export struct CustomContainer { ...@@ -80,7 +80,7 @@ export struct CustomContainer {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
......
...@@ -48,7 +48,7 @@ export struct CustomContainer { ...@@ -48,7 +48,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -80,7 +80,7 @@ export struct CustomContainer { ...@@ -80,7 +80,7 @@ export struct CustomContainer {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
......
...@@ -49,7 +49,7 @@ export struct CustomContainer { ...@@ -49,7 +49,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -81,7 +81,7 @@ export struct CustomContainer { ...@@ -81,7 +81,7 @@ export struct CustomContainer {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
......
...@@ -48,7 +48,7 @@ export struct CustomContainer { ...@@ -48,7 +48,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -80,7 +80,7 @@ export struct CustomContainer { ...@@ -80,7 +80,7 @@ export struct CustomContainer {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
......
...@@ -50,7 +50,7 @@ export struct CustomContainer { ...@@ -50,7 +50,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -82,7 +82,7 @@ export struct CustomContainer { ...@@ -82,7 +82,7 @@ export struct CustomContainer {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
......
...@@ -50,7 +50,7 @@ export struct CustomContainer { ...@@ -50,7 +50,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -82,7 +82,7 @@ export struct CustomContainer { ...@@ -82,7 +82,7 @@ export struct CustomContainer {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
......
...@@ -55,7 +55,7 @@ export struct CustomContainer { ...@@ -55,7 +55,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -87,7 +87,7 @@ export struct CustomContainer { ...@@ -87,7 +87,7 @@ export struct CustomContainer {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
......
...@@ -50,7 +50,7 @@ export struct CustomContainer { ...@@ -50,7 +50,7 @@ export struct CustomContainer {
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
params: {result : 'true', title : this.name, params: {result : 'true ', title : this.name,
} }
}) })
this.getScreen(isFullScreen); this.getScreen(isFullScreen);
...@@ -82,7 +82,7 @@ export struct CustomContainer { ...@@ -82,7 +82,7 @@ export struct CustomContainer {
Row() { Row() {
Button(){ Button(){
Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'}) Image($r('app.media.ic_public_back')).width('20vp').height('18vp').margin({left:'20vp'})
}.backgroundColor(Color.Black) }.backgroundColor(Color.Black).size({ width: '40vp', height: '30vp' })
.onClick(()=>{ .onClick(()=>{
router.back({ router.back({
url:this.Url, url:this.Url,
......
...@@ -20,7 +20,7 @@ import fileIO from '@ohos.fileio'; ...@@ -20,7 +20,7 @@ import fileIO from '@ohos.fileio';
import util from '@ohos.util'; import util from '@ohos.util';
import DateTimeUtil from './model/DateTimeUtil'; import DateTimeUtil from './model/DateTimeUtil';
import data_preferences from '@ohos.data.preferences'; import data_preferences from '@ohos.data.preferences';
import FlushData from '../pages/model/FlushData' import FlushData from '../pages/model/FlushData';
const TAG = 'ParseXML'; const TAG = 'ParseXML';
let path=globalThis.dir; let path=globalThis.dir;
...@@ -30,10 +30,13 @@ let path3 = path + '/Camera'; ...@@ -30,10 +30,13 @@ let path3 = path + '/Camera';
let path4 = path + '/Player'; let path4 = path + '/Player';
let path5 = path + '/Experience'; let path5 = path + '/Experience';
let picturePath = path + '/screenshot'; let picturePath = path + '/screenshot';
let ExperienceDataPath = path + '/ExperienceData';
let ArkUIColorBackPath = path + '/ArkUIColorBack.txt'; let ArkUIColorBackPath = path + '/ArkUIColorBack.txt';
let AudioColorBackPath = path + '/AudioColorBack.txt'; let AudioColorBackPath = path + '/AudioColorBack.txt';
let CameraColorBackPath = path + '/CameraColorBack.txt'; let CameraColorBackPath = path + '/CameraColorBack.txt';
let PlayerColorBackPath = path + '/PlayerColorBack.txt'; let PlayerColorBackPath = path + '/PlayerColorBack.txt';
let PlayerAudioColorBackPath = path4 + '/PlayerAudioColorBack.txt';
let PlayerVideoColorBackPath = path4 + '/PlayerVideoColorBack.txt';
let ExperienceColorBackPath = path + '/ExperienceColorBack.txt'; let ExperienceColorBackPath = path + '/ExperienceColorBack.txt';
fileio.openSync(ArkUIColorBackPath, 0o100 | 0o2002, 0o664); fileio.openSync(ArkUIColorBackPath, 0o100 | 0o2002, 0o664);
fileio.openSync(AudioColorBackPath, 0o100 | 0o2002, 0o664); fileio.openSync(AudioColorBackPath, 0o100 | 0o2002, 0o664);
...@@ -48,6 +51,8 @@ let path11 = path1 + '/ArkUIReport.txt'; ...@@ -48,6 +51,8 @@ let path11 = path1 + '/ArkUIReport.txt';
let path22 = path2 + '/AudioReport.txt'; let path22 = path2 + '/AudioReport.txt';
let path33 = path3 + '/CameraReport.txt'; let path33 = path3 + '/CameraReport.txt';
let path44 = path4 + '/PlayerReport.txt'; let path44 = path4 + '/PlayerReport.txt';
let PlayerAudioTxtPath = path4 + '/PlayerAudioReport.txt';
let PlayerVideoTxtPath = path4 + '/PlayerVideoReport.txt';
let path55 = path5 + '/ExperienceReport.txt'; let path55 = path5 + '/ExperienceReport.txt';
@Entry @Entry
...@@ -83,6 +88,7 @@ struct IndexPage { ...@@ -83,6 +88,7 @@ struct IndexPage {
fileio.mkdirSync(path4); fileio.mkdirSync(path4);
fileio.mkdirSync(path5); fileio.mkdirSync(path5);
fileio.mkdirSync(picturePath); fileio.mkdirSync(picturePath);
fileio.mkdirSync(ExperienceDataPath);
let promise = preferences.put('index', 1); let promise = preferences.put('index', 1);
promise.then(() => { promise.then(() => {
...@@ -97,6 +103,10 @@ struct IndexPage { ...@@ -97,6 +103,10 @@ struct IndexPage {
fileio.openSync(path22, 0o100 | 0o2002, 0o664); fileio.openSync(path22, 0o100 | 0o2002, 0o664);
fileio.openSync(path33, 0o100 | 0o2002, 0o664); fileio.openSync(path33, 0o100 | 0o2002, 0o664);
fileio.openSync(path44, 0o100 | 0o2002, 0o664); fileio.openSync(path44, 0o100 | 0o2002, 0o664);
fileio.openSync(PlayerAudioColorBackPath, 0o100 | 0o2002, 0o664);
fileio.openSync(PlayerVideoColorBackPath, 0o100 | 0o2002, 0o664);
fileio.openSync(PlayerAudioTxtPath, 0o100 | 0o2002, 0o664);
fileio.openSync(PlayerVideoTxtPath, 0o100 | 0o2002, 0o664);
fileio.openSync(path55, 0o100 | 0o2002, 0o664); fileio.openSync(path55, 0o100 | 0o2002, 0o664);
} }
build(){ build(){
...@@ -194,31 +204,43 @@ struct IndexPage { ...@@ -194,31 +204,43 @@ struct IndexPage {
fileio.unlinkSync(path22); fileio.unlinkSync(path22);
fileio.unlinkSync(path33); fileio.unlinkSync(path33);
fileio.unlinkSync(path44); fileio.unlinkSync(path44);
fileio.unlinkSync(PlayerAudioTxtPath);
fileio.unlinkSync(PlayerVideoTxtPath);
fileio.unlinkSync(path55); fileio.unlinkSync(path55);
fileio.unlinkSync(ArkUIColorBackPath); fileio.unlinkSync(ArkUIColorBackPath);
fileio.unlinkSync(AudioColorBackPath); fileio.unlinkSync(AudioColorBackPath);
fileio.unlinkSync(CameraColorBackPath); fileio.unlinkSync(CameraColorBackPath);
fileio.unlinkSync(PlayerColorBackPath); fileio.unlinkSync(PlayerColorBackPath);
fileio.unlinkSync(PlayerAudioColorBackPath);
fileio.unlinkSync(PlayerVideoColorBackPath);
fileio.unlinkSync(ExperienceColorBackPath); fileio.unlinkSync(ExperienceColorBackPath);
fileio.rmdirSync(picturePath); fileio.rmdirSync(picturePath);
fileio.mkdirSync(picturePath); fileio.mkdirSync(picturePath);
fileio.rmdirSync(ExperienceDataPath);
fileio.mkdirSync(ExperienceDataPath);
fileio.openSync(TimePath, 0o100 | 0o2002, 0o664); fileio.openSync(TimePath, 0o100 | 0o2002, 0o664);
fileio.openSync(xmlPath, 0o100 | 0o2002, 0o664); fileio.openSync(xmlPath, 0o100 | 0o2002, 0o664);
fileio.openSync(path11, 0o100 | 0o2002, 0o664); fileio.openSync(path11, 0o100 | 0o2002, 0o664);
fileio.openSync(path22, 0o100 | 0o2002, 0o664); fileio.openSync(path22, 0o100 | 0o2002, 0o664);
fileio.openSync(path33, 0o100 | 0o2002, 0o664); fileio.openSync(path33, 0o100 | 0o2002, 0o664);
fileio.openSync(path44, 0o100 | 0o2002, 0o664); fileio.openSync(path44, 0o100 | 0o2002, 0o664);
fileio.openSync(PlayerAudioTxtPath, 0o100 | 0o2002, 0o664);
fileio.openSync(PlayerVideoTxtPath, 0o100 | 0o2002, 0o664);
fileio.openSync(path55, 0o100 | 0o2002, 0o664); fileio.openSync(path55, 0o100 | 0o2002, 0o664);
fileio.openSync(ArkUIColorBackPath, 0o100 | 0o2002, 0o664); fileio.openSync(ArkUIColorBackPath, 0o100 | 0o2002, 0o664);
fileio.openSync(AudioColorBackPath, 0o100 | 0o2002, 0o664); fileio.openSync(AudioColorBackPath, 0o100 | 0o2002, 0o664);
fileio.openSync(CameraColorBackPath, 0o100 | 0o2002, 0o664); fileio.openSync(CameraColorBackPath, 0o100 | 0o2002, 0o664);
fileio.openSync(PlayerColorBackPath, 0o100 | 0o2002, 0o664); fileio.openSync(PlayerColorBackPath, 0o100 | 0o2002, 0o664);
fileio.openSync(PlayerAudioColorBackPath, 0o100 | 0o2002, 0o664);
fileio.openSync(PlayerVideoColorBackPath, 0o100 | 0o2002, 0o664);
fileio.openSync(ExperienceColorBackPath, 0o100 | 0o2002, 0o664); fileio.openSync(ExperienceColorBackPath, 0o100 | 0o2002, 0o664);
FlushData.ResetArkUI(); FlushData.ResetArkUI();
FlushData.ResetAudio(); FlushData.ResetAudio();
FlushData.ResetCamera(); FlushData.ResetCamera();
FlushData.ResetPlayer(); FlushData.ResetPlayer();
FlushData.ResetExperience(); FlushData.ResetExperience();
FlushData.ResetPlayerAudio();
FlushData.ResetPlayerVideo();
} }
SaveXml() { SaveXml() {
let dateTimeUtil = new DateTimeUtil(); let dateTimeUtil = new DateTimeUtil();
...@@ -229,6 +251,9 @@ struct IndexPage { ...@@ -229,6 +251,9 @@ struct IndexPage {
let StartTime = String.fromCharCode.apply(null, new Uint8Array(buf)); let StartTime = String.fromCharCode.apply(null, new Uint8Array(buf));
let Index = StartTime.indexOf(';'); let Index = StartTime.indexOf(';');
let starttime = StartTime.substring(0,Index); let starttime = StartTime.substring(0,Index);
if(starttime === ''){
starttime = '*'
}
let ArkUIReport; let ArkUIReport;
let AudioReport; let AudioReport;
let CameraReport; let CameraReport;
...@@ -314,12 +339,12 @@ struct IndexPage { ...@@ -314,12 +339,12 @@ struct IndexPage {
FailIndex = report.indexOf('false',FailIndex + 1); FailIndex = report.indexOf('false',FailIndex + 1);
} }
let failNum = (FailNum).toString(); let failNum = (FailNum).toString();
let PassIndex = report.indexOf('true'); let PassIndex = report.indexOf('true ');
let PassNum = 0; let PassNum = 0;
while(PassIndex != -1) { while(PassIndex != -1) {
console.log(PassIndex); console.log(PassIndex);
PassNum++; PassNum++;
PassIndex = report.indexOf('true',PassIndex + 1); PassIndex = report.indexOf('true ',PassIndex + 1);
} }
let TestNum = FailNum + PassNum; let TestNum = FailNum + PassNum;
let testNum = (TestNum).toString(); let testNum = (TestNum).toString();
...@@ -334,12 +359,12 @@ struct IndexPage { ...@@ -334,12 +359,12 @@ struct IndexPage {
ArkUIFailIndex = ArkUIReport.indexOf('false',ArkUIFailIndex + 1); ArkUIFailIndex = ArkUIReport.indexOf('false',ArkUIFailIndex + 1);
} }
let ArkuiFailNum = (ArkUIFailNum).toString(); let ArkuiFailNum = (ArkUIFailNum).toString();
let ArkUIPassIndex = ArkUIReport.indexOf('true'); let ArkUIPassIndex = ArkUIReport.indexOf('true ');
let ArkUIPassNum = 0; let ArkUIPassNum = 0;
while (ArkUIPassIndex != -1) { while (ArkUIPassIndex != -1) {
console.log(ArkUIPassIndex); console.log(ArkUIPassIndex);
ArkUIPassNum++; ArkUIPassNum++;
ArkUIPassIndex = ArkUIReport.indexOf('true',ArkUIPassIndex + 1); ArkUIPassIndex = ArkUIReport.indexOf('true ',ArkUIPassIndex + 1);
} }
let ArkUITestNum = ArkUIFailNum + ArkUIPassNum; let ArkUITestNum = ArkUIFailNum + ArkUIPassNum;
let ArkuiTestNum = (ArkUITestNum).toString(); let ArkuiTestNum = (ArkUITestNum).toString();
...@@ -354,12 +379,12 @@ struct IndexPage { ...@@ -354,12 +379,12 @@ struct IndexPage {
AudioFailIndex = AudioReport.indexOf('false',AudioFailIndex + 1); AudioFailIndex = AudioReport.indexOf('false',AudioFailIndex + 1);
} }
let audioFailNum = (AudioFailNum).toString(); let audioFailNum = (AudioFailNum).toString();
let AudioPassIndex = AudioReport.indexOf('true'); let AudioPassIndex = AudioReport.indexOf('true ');
let AudioPassNum = 0; let AudioPassNum = 0;
while (AudioPassIndex != -1) { while (AudioPassIndex != -1) {
console.log(AudioPassIndex); console.log(AudioPassIndex);
AudioPassNum++; AudioPassNum++;
AudioPassIndex = AudioReport.indexOf('true',AudioPassIndex + 1); AudioPassIndex = AudioReport.indexOf('true ',AudioPassIndex + 1);
} }
let AudioTestNum = AudioFailNum + AudioPassNum; let AudioTestNum = AudioFailNum + AudioPassNum;
let audioTestNum = (AudioTestNum).toString(); let audioTestNum = (AudioTestNum).toString();
...@@ -374,12 +399,12 @@ struct IndexPage { ...@@ -374,12 +399,12 @@ struct IndexPage {
CameraFailIndex = CameraReport.indexOf('false',CameraFailIndex + 1); CameraFailIndex = CameraReport.indexOf('false',CameraFailIndex + 1);
} }
let cameraFailNum = (CameraFailNum).toString(); let cameraFailNum = (CameraFailNum).toString();
let CameraPassIndex = CameraReport.indexOf('true'); let CameraPassIndex = CameraReport.indexOf('true ');
let CameraPassNum = 0; let CameraPassNum = 0;
while (CameraPassIndex != -1) { while (CameraPassIndex != -1) {
console.log(CameraPassIndex); console.log(CameraPassIndex);
CameraPassNum++; CameraPassNum++;
CameraPassIndex = CameraReport.indexOf('true',CameraPassIndex + 1); CameraPassIndex = CameraReport.indexOf('true ',CameraPassIndex + 1);
} }
let CameraTestNum = CameraFailNum + CameraPassNum; let CameraTestNum = CameraFailNum + CameraPassNum;
let cameraTestNum = (CameraTestNum).toString(); let cameraTestNum = (CameraTestNum).toString();
...@@ -394,12 +419,12 @@ struct IndexPage { ...@@ -394,12 +419,12 @@ struct IndexPage {
PlayerFailIndex = PlayerReport.indexOf('false',PlayerFailIndex + 1); PlayerFailIndex = PlayerReport.indexOf('false',PlayerFailIndex + 1);
} }
let playerFailNum = (PlayerFailNum).toString(); let playerFailNum = (PlayerFailNum).toString();
let PlayerPassIndex = PlayerReport.indexOf('true'); let PlayerPassIndex = PlayerReport.indexOf('true ');
let PlayerPassNum = 0; let PlayerPassNum = 0;
while (PlayerPassIndex != -1) { while (PlayerPassIndex != -1) {
console.log(PlayerPassIndex); console.log(PlayerPassIndex);
PlayerPassNum++; PlayerPassNum++;
PlayerPassIndex = PlayerReport.indexOf('true',PlayerPassIndex + 1); PlayerPassIndex = PlayerReport.indexOf('true ',PlayerPassIndex + 1);
} }
let PlayerTestNum = PlayerFailNum + PlayerPassNum; let PlayerTestNum = PlayerFailNum + PlayerPassNum;
let playerTestNum = (PlayerTestNum).toString(); let playerTestNum = (PlayerTestNum).toString();
...@@ -414,12 +439,12 @@ struct IndexPage { ...@@ -414,12 +439,12 @@ struct IndexPage {
ExperienceFailIndex = ExperienceReport.indexOf('false',ExperienceFailIndex + 1); ExperienceFailIndex = ExperienceReport.indexOf('false',ExperienceFailIndex + 1);
} }
let experienceFailNum = (ExperienceFailNum).toString(); let experienceFailNum = (ExperienceFailNum).toString();
let ExperiencePassIndex = ExperienceReport.indexOf('true'); let ExperiencePassIndex = ExperienceReport.indexOf('true ');
let ExperiencePassNum = 0; let ExperiencePassNum = 0;
while (ExperiencePassIndex != -1) { while (ExperiencePassIndex != -1) {
console.log(ExperiencePassIndex); console.log(ExperiencePassIndex);
ExperiencePassNum++; ExperiencePassNum++;
ExperiencePassIndex = ExperienceReport.indexOf('true',ExperiencePassIndex + 1); ExperiencePassIndex = ExperienceReport.indexOf('true ',ExperiencePassIndex + 1);
} }
let ExperienceTestNum = ExperienceFailNum + ExperiencePassNum; let ExperienceTestNum = ExperienceFailNum + ExperiencePassNum;
let experienceTestNum = (ExperienceTestNum).toString(); let experienceTestNum = (ExperienceTestNum).toString();
......
...@@ -136,4 +136,52 @@ export default class FlushData{ ...@@ -136,4 +136,52 @@ export default class FlushData{
console.info("Succeeded in flushing."); console.info("Succeeded in flushing.");
}); });
} }
static ResetPlayerAudio = 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('PlayerAudio', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'PlayerAudio'. Data: " + data);
});
promise = preferences.put('PlayerAudio', 0);
promise.then(() => {
console.info("Succeeded in putting value of 'PlayerAudio'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
}
static ResetPlayerVideo = 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('PlayerVideo', 0);
await promise.then((data) => {
Test = data;
console.info("Succeeded in getting value of 'PlayerVideo'. Data: " + data);
});
promise = preferences.put('PlayerVideo', 0);
promise.then(() => {
console.info("Succeeded in putting value of 'PlayerVideo'.");
});
promise = preferences.flush();
promise.then(() => {
console.info("Succeeded in flushing.");
});
}
} }
\ No newline at end of file
...@@ -37,9 +37,9 @@ export default class MediaUtils { ...@@ -37,9 +37,9 @@ export default class MediaUtils {
Logger.info(this.tag, `displayName = ${displayName},mediaType = ${mediaType}`) Logger.info(this.tag, `displayName = ${displayName},mediaType = ${mediaType}`)
let publicPath = await this.mediaTest.getPublicDirectory(info.directory) let publicPath = await this.mediaTest.getPublicDirectory(info.directory)
Logger.info(this.tag, `publicPath = ${publicPath}`) Logger.info(this.tag, `publicPath = ${publicPath}`)
try{ try {
return await this.mediaTest.createAsset(mediaType, displayName, publicPath) return await this.mediaTest.createAsset(mediaType, displayName, publicPath)
}catch(err){ } catch (err) {
Logger.info(this.tag, `createAsset err ` + JSON.stringify(err)) Logger.info(this.tag, `createAsset err ` + JSON.stringify(err))
} }
...@@ -77,9 +77,26 @@ export default class MediaUtils { ...@@ -77,9 +77,26 @@ export default class MediaUtils {
} }
} }
async getFileAssetsAlbum(path){
let fileKeyObj = mediaLibrary.FileKey
// ALBUM_NAME
let fetchOp = {
selections: `${fileKeyObj.RELATIVE_PATH}=?`,
selectionArgs: [`${path}`],
}
const fetchFileResult = await this.mediaTest.getFileAssets(fetchOp)
Logger.info(this.tag, `getFileAssetsAlbum,fetchFileResult.count = ${fetchFileResult.getCount()}`)
let fileAssets:Array<mediaLibrary.FileAsset> = []
if (fetchFileResult.getCount() > 0) {
fileAssets = await fetchFileResult.getAllObject()
}
return fileAssets
}
async getFileAssetsFromType(mediaType: number) { async getFileAssetsFromType(mediaType: number) {
Logger.info(this.tag, `getFileAssetsFromType,mediaType = ${mediaType}`) Logger.info(this.tag, `getFileAssetsFromType,mediaType = ${mediaType}`)
let fileKeyObj = mediaLibrary.FileKey let fileKeyObj = mediaLibrary.FileKey
// ALBUM_NAME
let fetchOp = { let fetchOp = {
selections: `${fileKeyObj.MEDIA_TYPE}=?`, selections: `${fileKeyObj.MEDIA_TYPE}=?`,
selectionArgs: [`${mediaType}`], selectionArgs: [`${mediaType}`],
...@@ -120,6 +137,7 @@ export default class MediaUtils { ...@@ -120,6 +137,7 @@ export default class MediaUtils {
deleteFile(media: any) { deleteFile(media: any) {
let uri = media.uri let uri = media.uri
Logger.info(this.tag, `deleteFile,uri = ${uri}`) Logger.info(this.tag, `deleteFile,uri = ${uri}`)
// @ts-ignore
return this.mediaTest.deleteAsset(uri) return this.mediaTest.deleteAsset(uri)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册