提交 a0a87143 编写于 作者: T tianwenzhe

srcroll list

Signed-off-by: Ntian-wenzhe411 <tianwenzhe2@huawei.com>
上级 c6857b33
......@@ -33,51 +33,55 @@ struct SetCircle {
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Red').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(100, 160, 150, 100);
this.FillColor = '#FFFF0000';
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(100, 160, 150, 100);
this.FillColor = '#fffffc3c';
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(100, 160, 150, 100);
this.FillColor = '#ff19fa00';
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
})
}.width('100%').height('70%')
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Red').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(100, 160, 150, 100);
this.FillColor = '#FFFF0000';
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(100, 160, 150, 100);
this.FillColor = '#fffffc3c';
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(100, 160, 150, 100);
this.FillColor = '#ff19fa00';
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.fillStyle = this.FillColor;
this.context.fillRect(100, 160, 150, 100);
})
}.width('100%').height('70%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -31,54 +31,58 @@ struct SetCircle {
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
console.info('Pan start');
this.Vue = true;
})
.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.context.globalAlpha = (this.X)*0.005;
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalAlpha = (this.X)*0.005;
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(200, 200, 50, 50);
})
.onActionEnd(() => {
console.info('Pan end');
})
)
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
console.info('Pan start');
this.Vue = true;
})
.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.context.globalAlpha = (this.X)*0.005;
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalAlpha = (this.X)*0.005;
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(200, 200, 50, 50);
})
.onActionEnd(() => {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }){
Text('透明度: ' + (this.X)*0.005 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.globalAlpha = 0.05;
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalAlpha = 0.05;
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(200, 200, 50, 50);
})
}.width('100%').height('55%')
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }){
Text('透明度: ' + (this.X)*0.005 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.globalAlpha = 0.05;
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 50, 50);
this.context.globalAlpha = 0.05;
this.context.fillStyle = 'rgb(0,0,255)';
this.context.fillRect(200, 200, 50, 50);
})
}.width('100%').height('55%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -32,64 +32,68 @@ struct SetCircle {
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('butt').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.lineWidth = 8;
this.context.beginPath();
this.context.lineCap = 'butt';
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('round').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.lineWidth = 8;
this.context.beginPath();
this.context.lineCap = 'round';
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('square').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.lineWidth = 8;
this.context.beginPath();
this.context.lineCap = 'square';
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.lineWidth = 8;
this.context.beginPath();
this.context.lineCap = 'round';
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
})
}.width('100%').height('70%')
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('butt').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.lineWidth = 8;
this.context.beginPath();
this.context.lineCap = 'butt';
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('round').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.lineWidth = 8;
this.context.beginPath();
this.context.lineCap = 'round';
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('square').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.lineWidth = 8;
this.context.beginPath();
this.context.lineCap = 'square';
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.lineWidth = 8;
this.context.beginPath();
this.context.lineCap = 'round';
this.context.moveTo(100, 100);
this.context.lineTo(250, 100);
this.context.stroke();
})
}.width('100%').height('70%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -30,46 +30,50 @@ struct SetCircle {
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
console.info('Pan start');
this.Vue = true;
})
.onActionUpdate((event: GestureEvent) => {
if(event.offsetX > 200){
event.offsetX = 200;
}
else if(event.offsetX < 20){
event.offsetX = 20;
}
this.X = event.offsetX;
this.context.clearRect(100, 90, 250, 200);
this.context.setLineDash([20,30]);
this.context.beginPath();
this.context.arc(180, 150, 50, 0, 6.28);
this.context.lineDashOffset = (this.X) * 0.2;
this.context.stroke();
})
.onActionEnd(() => {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('虚线偏移量: ' + (this.X)*0.2 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
})
}.width('100%').height('55%')
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
console.info('Pan start');
this.Vue = true;
})
.onActionUpdate((event: GestureEvent) => {
if(event.offsetX > 200){
event.offsetX = 200;
}
else if(event.offsetX < 20){
event.offsetX = 20;
}
this.X = event.offsetX;
this.context.clearRect(100, 90, 250, 200);
this.context.setLineDash([20,30]);
this.context.beginPath();
this.context.arc(180, 150, 50, 0, 6.28);
this.context.lineDashOffset = (this.X) * 0.2;
this.context.stroke();
})
.onActionEnd(() => {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('虚线偏移量: ' + (this.X)*0.2 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
})
}.width('100%').height('55%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -32,68 +32,72 @@ struct SetCircle {
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('round').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.beginPath();
this.context.lineWidth = 8;
this.context.lineJoin = 'round';
this.context.moveTo(120, 100);
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('bevel').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.beginPath();
this.context.lineWidth = 8;
this.context.lineJoin = 'bevel';
this.context.moveTo(120, 100);
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('miter').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.beginPath();
this.context.lineWidth = 8;
this.context.lineJoin = 'miter';
this.context.moveTo(120, 100);
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.beginPath();
this.context.lineWidth = 8;
this.context.lineJoin = 'miter';
this.context.moveTo(120, 100);
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
})
}.width('100%').height('70%')
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('round').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.beginPath();
this.context.lineWidth = 8;
this.context.lineJoin = 'round';
this.context.moveTo(120, 100);
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('bevel').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.beginPath();
this.context.lineWidth = 8;
this.context.lineJoin = 'bevel';
this.context.moveTo(120, 100);
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('miter').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120);
this.context.beginPath();
this.context.lineWidth = 8;
this.context.lineJoin = 'miter';
this.context.moveTo(120, 100);
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.beginPath();
this.context.lineWidth = 8;
this.context.lineJoin = 'miter';
this.context.moveTo(120, 100);
this.context.lineTo(210, 130);
this.context.lineTo(120, 180);
this.context.stroke();
})
}.width('100%').height('70%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -30,46 +30,50 @@ struct SetCircle {
@State X: number = 20;
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
console.info('Pan start');
this.Vue = true;
})
.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.context.lineWidth = (this.X)*0.1;
this.context.strokeRect(120, 120, 120, 120);
})
.onActionEnd(() => {
console.info('Pan end');
})
)
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
console.info('Pan start');
this.Vue = true;
})
.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.context.lineWidth = (this.X)*0.1;
this.context.strokeRect(120, 120, 120, 120);
})
.onActionEnd(() => {
console.info('Pan end');
})
)
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('边框粗细: ' + (this.X)*0.1 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.lineWidth = 1;
this.context.strokeRect(120, 120, 120, 120);
})
}.width('100%').height('50%')
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('边框粗细: ' + (this.X)*0.1 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.lineWidth = 1;
this.context.strokeRect(120, 120, 120, 120);
})
}.width('100%').height('50%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -30,51 +30,55 @@ struct SetCircle {
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
console.info('Pan start');
this.Vue = true;
})
.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.context.shadowBlur = this.X;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
.onActionEnd(() => {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('阴影模糊: ' + this.X )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.shadowBlur = 0;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('55%')
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
console.info('Pan start');
this.Vue = true;
})
.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.context.shadowBlur = this.X;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
.onActionEnd(() => {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text('阴影模糊: ' + this.X )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.shadowBlur = 0;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('55%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -33,54 +33,58 @@ struct SetCircle {
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Blue').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300);
this.context.shadowBlur = 30;
this.context.shadowColor = 'rgb(0,0,255)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
this.num1 = 1;
if ( this.num1 == 1 && this.num3 == 1 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300);
this.context.shadowBlur = 30;
this.context.shadowColor = '#fffffc3c';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == 1 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300);
this.context.shadowBlur = 30;
this.context.shadowColor = '#ff19fa00';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == 1 && this.num2 == 1 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('60%')
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Blue').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300);
this.context.shadowBlur = 30;
this.context.shadowColor = 'rgb(0,0,255)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
this.num1 = 1;
if ( this.num1 == 1 && this.num3 == 1 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300);
this.context.shadowBlur = 30;
this.context.shadowColor = '#fffffc3c';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == 1 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300);
this.context.shadowBlur = 30;
this.context.shadowColor = '#ff19fa00';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == 1 && this.num2 == 1 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('60%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -30,55 +30,59 @@ struct SetCircle {
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
console.info('Pan start');
this.Vue = true;
})
.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.context.shadowBlur = 10;
this.context.shadowOffsetX = (this.X)*0.05;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
.onActionEnd(() => {
console.info('Pan end');
})
)
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
console.info('Pan start');
this.Vue = true;
})
.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.context.shadowBlur = 10;
this.context.shadowOffsetX = (this.X)*0.05;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
.onActionEnd(() => {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }){
Text('阴影偏移: ' + (this.X)*0.05 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.shadowBlur = 10;
this.context.shadowOffsetX = 0;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('55%')
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }){
Text('阴影偏移: ' + (this.X)*0.05 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.shadowBlur = 10;
this.context.shadowOffsetX = 0;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('55%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -30,54 +30,58 @@ struct SetCircle {
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
console.info('Pan start');
this.Vue = true;
})
.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.context.shadowBlur = 10;
this.context.shadowOffsetY = (this.X)*0.05;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
.onActionEnd(() => {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }){
Text('阴影偏移: ' + (this.X)*0.05 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.shadowBlur = 10;
this.context.shadowOffsetY = 0;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('55%')
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('→').fontSize(16).border({width:2}).size({width:'20%',height:'20%'})
.translate({ x: this.X, y: 20, z: 5 })
.gesture(
PanGesture({})
.onActionStart((event: GestureEvent) => {
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
console.info('Pan start');
this.Vue = true;
})
.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.context.shadowBlur = 10;
this.context.shadowOffsetY = (this.X)*0.05;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
.onActionEnd(() => {
console.info('Pan end');
})
)
}.width('70%').height('25%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }){
Text('阴影偏移: ' + (this.X)*0.05 )
}.width('100%').height('20%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.shadowBlur = 10;
this.context.shadowOffsetY = 0;
this.context.shadowColor = 'rgb(0,0,0)';
this.context.fillStyle = 'rgb(255,0,0)';
this.context.fillRect(150, 150, 100, 100);
})
}.width('100%').height('55%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -32,55 +32,59 @@ struct SetCircle {
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Red').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 150, 170, 120);
this.FillColor = '#FFFF0000';
this.context.lineWidth = 10;
this.context.strokeStyle = '#FFFF0000';
this.context.strokeRect(100, 160, 150, 100);
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 150, 170, 120);
this.FillColor = '#fffffc3c';
this.context.lineWidth = 10;
this.context.strokeStyle = '#fffffc3c';
this.context.strokeRect(100, 160, 150, 100);
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 150, 170, 120);
this.FillColor = '#ff19fa00';
this.context.lineWidth = 10;
this.context.strokeStyle = '#ff19fa00';
this.context.strokeRect(100, 160, 150, 100);
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.lineWidth = 10;
this.context.strokeStyle = this.FillColor;
this.context.strokeRect(100, 160, 150, 100);
})
}.width('100%').height('70%')
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Red').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 150, 170, 120);
this.FillColor = '#FFFF0000';
this.context.lineWidth = 10;
this.context.strokeStyle = '#FFFF0000';
this.context.strokeRect(100, 160, 150, 100);
this.num1 = 1;
if ( this.num1 == this.num3 && this.num2 == 1 ){
this.Vue = true;
}
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 150, 170, 120);
this.FillColor = '#fffffc3c';
this.context.lineWidth = 10;
this.context.strokeStyle = '#fffffc3c';
this.context.strokeRect(100, 160, 150, 100);
this.num2 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
this.context.clearRect(90, 150, 170, 120);
this.FillColor = '#ff19fa00';
this.context.lineWidth = 10;
this.context.strokeStyle = '#ff19fa00';
this.context.strokeRect(100, 160, 150, 100);
this.num3 = 1;
if ( this.num1 == 1 && this.num3 == this.num2 ){
this.Vue = true;
}
})
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.lineWidth = 10;
this.context.strokeStyle = this.FillColor;
this.context.strokeRect(100, 160, 150, 100);
})
}.width('100%').height('70%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -34,91 +34,95 @@ struct SetCircle {
}
@Builder specificNoParam() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('start').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
this.context.textAlign = 'start';
this.context.font = '40px sans-serif'
this.context.fillText('textAlign=start', 250, 160);
this.num1 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('end').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
this.context.textAlign = 'end';
this.context.fillText('textAlign=end', 250, 160);
this.num2 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('left').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
this.context.textAlign = 'left';
this.context.fillText('textAlign=left', 250, 160);
this.num3 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('center').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
this.context.textAlign = 'center';
this.context.fillText('textAlign=center', 250, 160);
this.num4 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('right').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
this.context.textAlign = 'right';
this.context.fillText('textAlign=right', 250, 160);
this.num5 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
}.width('90%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
})
}.width('100%').height('70%')
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('start').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
this.context.textAlign = 'start';
this.context.font = '40px sans-serif'
this.context.fillText('textAlign=start', 250, 160);
this.num1 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('end').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
this.context.textAlign = 'end';
this.context.fillText('textAlign=end', 250, 160);
this.num2 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('left').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
this.context.textAlign = 'left';
this.context.fillText('textAlign=left', 250, 160);
this.num3 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('center').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
this.context.textAlign = 'center';
this.context.fillText('textAlign=center', 250, 160);
this.num4 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
Text('right').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
this.context.clearRect(0, 10, 500, 500);
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
this.context.textAlign = 'right';
this.context.fillText('textAlign=right', 250, 160);
this.num5 = 1;
if ( this.num1 == 1 && this.num2 == 1 && this.num3 == 1 && this.num4 == 1 && this.num5 == 1 ){
this.Vue = true;
}
})
}.width('90%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
.width('100%')
.height('100%')
.backgroundColor('#ffffffff')
.onReady(() =>{
this.context.lineWidth = 2;
this.context.moveTo(250, 10);
this.context.lineTo(250, 310);
this.context.stroke();
})
}.width('100%').height('70%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -34,6 +34,8 @@ struct SetCircle {
}
@Builder specificNoParam() {
Column() {
Scroll() {
Column() {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Top').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
......@@ -125,6 +127,8 @@ struct SetCircle {
this.context.stroke();
})
}.width('100%').height('70%')
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
}
build() {
......
......@@ -27,6 +27,8 @@ struct LongPressGestureExample {
}
@Builder specificNoParam() {
Column() {
Scroll() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.img")).height('60%').width('60%')
}
......@@ -46,6 +48,8 @@ struct LongPressGestureExample {
})
)
Text('长按动作连续触发:' + this.X).fontColor(Color.Black)
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
.justifyContent(FlexAlign.SpaceEvenly)
}
......
......@@ -28,6 +28,8 @@ struct PanGestureExample {
}
@Builder specificNoParam() {
Column() {
Scroll(){
Column(){
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.img")).height('60%').width('60%')
}
......@@ -48,6 +50,8 @@ struct PanGestureExample {
})
)
Text('偏移坐标x: ' + this.X + '\n' + '偏移坐标y: ' + this.Y)
}
}
}.width('100%').height('80%').backgroundColor(Color.White)
.justifyContent(FlexAlign.SpaceEvenly)
}
......
......@@ -27,6 +27,8 @@ struct PinchGuestureTest {
}
@Builder specificNoParam() {
Column(){
Scroll() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.img")).height('60%').width('60%')
}
......@@ -40,6 +42,8 @@ struct PinchGuestureTest {
})
)
Text('捏合放缩比例:'+this.X).fontColor(Color.Black)
}
}
} .width('100%').height('80%').backgroundColor(Color.White)
.justifyContent(FlexAlign.SpaceEvenly)
}
......
......@@ -27,6 +27,8 @@ struct RotationGuestureTest {
}
@Builder specificNoParam() {
Column(){
Scroll() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.img")).height('60%').width('60%')
}
......@@ -41,6 +43,8 @@ struct RotationGuestureTest {
})
)
Text('旋转角度:' + this.X)
}
}
}.height('80%').width('100%').backgroundColor(Color.White)
}
build() {
......
......@@ -27,18 +27,22 @@ struct TapGestureExample {
}
@Builder specificNoParam() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.img")).height('60%').width('60%')
Scroll() {
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Image($r("app.media.img")).height('60%').width('60%')
}
.height('350vp').width('350vp').padding(20)
.gesture(
TapGesture({ count: 2 })
.onAction(() => {
this.value = 'TapGesture onAction';
this.Vue = true;
})
)
Text(this.value)
}
}
.height('350vp').width('350vp').padding(20)
.gesture(
TapGesture({ count: 2 })
.onAction(() => {
this.value = 'TapGesture onAction';
this.Vue = true;
})
)
Text(this.value)
}.width('100%').height('80%').backgroundColor(Color.White)
.justifyContent(FlexAlign.SpaceEvenly)
}
......
......@@ -98,81 +98,83 @@ struct audioInputRouting {
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`是否设备支持TypeC耳机?`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`不支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.yesEnable)
.opacity(!this.yesEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
})
Scroll() {
Column(){
Row(){
Text(`是否设备支持TypeC耳机?`).fontColor(Color.White).fontSize('18fp')
}
Column(){
Button(`支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.onClick(async () => {
this.yesEnable = true
this.recorderEnable = true
})
Row(){
Column(){
Button(`不支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.yesEnable)
.opacity(!this.yesEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
})
}
Column(){
Button(`支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.onClick(async () => {
this.yesEnable = true
this.recorderEnable = true
})
}
}
}
Row(){
Text('测试目的:\n当设备连接TypeC耳机时,是否音频输入路由正确切换\n测试准备\n断连任何外设,保持设备常亮\n测试步骤:\n1. 验证设备是否支持TypeC耳机\n2. 连接TypeC耳机\n3. 按下录制按钮\n4. 对着耳机mic讲话\n5. 按下停止按钮\n6. 按下播放按钮\n测试标准:\n如果设备不支持TypeC耳机输入或者接收到输入路由通知、路由显示为TypeC耳机,通过TypeC可正常录制和播放,则用例pass').fontColor(Color.White).fontSize('18fp')
}
Row(){
Text(`Audio输入路由:${this.inputDevice}`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`录制`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.recorderEnable)
.opacity(this.recorderEnable ? 1 : 0.4)
.onClick(async () => {
this.stopEnable = true
this.recorderEnable = false
await AudioCapturer.createAudioCapturer()
await AudioCapturer.startCapturer()
})
Row(){
Text('测试目的:\n当设备连接TypeC耳机时,是否音频输入路由正确切换\n测试准备\n断连任何外设,保持设备常亮\n测试步骤:\n1. 验证设备是否支持TypeC耳机\n2. 连接TypeC耳机\n3. 按下录制按钮\n4. 对着耳机mic讲话\n5. 按下停止按钮\n6. 按下播放按钮\n测试标准:\n如果设备不支持TypeC耳机输入或者接收到输入路由通知、路由显示为TypeC耳机,通过TypeC可正常录制和播放,则用例pass').fontColor(Color.White).fontSize('18fp')
}
Column(){
Button(`停止`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.stopEnable)
.opacity(this.stopEnable ? 1 : 0.4)
.onClick(async () => {
this.recorderEnable = true
this.stopEnable = false
this.playEnable = true
await AudioCapturer.stopCapturer()
await AudioCapturer.releaseCapturer()
})
Row(){
Text(`Audio输入路由:${this.inputDevice}`).fontColor(Color.White).fontSize('18fp')
}
Column(){
Button(`播放`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.playEnable)
.opacity(this.playEnable ? 1 : 0.4)
.onClick(async () => {
this.playEnable = false
await mediaPlay.init()
this.Vue = true
})
Row(){
Column(){
Button(`录制`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.recorderEnable)
.opacity(this.recorderEnable ? 1 : 0.4)
.onClick(async () => {
this.stopEnable = true
this.recorderEnable = false
await AudioCapturer.createAudioCapturer()
await AudioCapturer.startCapturer()
})
}
Column(){
Button(`停止`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.stopEnable)
.opacity(this.stopEnable ? 1 : 0.4)
.onClick(async () => {
this.recorderEnable = true
this.stopEnable = false
this.playEnable = true
await AudioCapturer.stopCapturer()
await AudioCapturer.releaseCapturer()
})
}
Column(){
Button(`播放`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.playEnable)
.opacity(this.playEnable ? 1 : 0.4)
.onClick(async () => {
this.playEnable = false
await mediaPlay.init()
this.Vue = true
})
}
}
}
}
......
......@@ -98,81 +98,83 @@ struct audioInputRouting {
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`是否设备支持3.5mm耳机?`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`不支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.yesEnable)
.opacity(!this.yesEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
})
Scroll() {
Column(){
Row(){
Text(`是否设备支持3.5mm耳机?`).fontColor(Color.White).fontSize('18fp')
}
Column(){
Button(`支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.onClick(async () => {
this.yesEnable = true
this.recorderEnable = true
})
Row(){
Column(){
Button(`不支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.yesEnable)
.opacity(!this.yesEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
})
}
Column(){
Button(`支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.onClick(async () => {
this.yesEnable = true
this.recorderEnable = true
})
}
}
}
Row(){
Text('测试目的:\n当设备连接3.5mm有线耳机时,是否音频输入路由正确切换\n测试准备\n断连任何外设,保持设备常亮\n测试步骤:\n1. 验证设备是否支持3.5mm有线耳机\n2. 连接3.5mm有线耳机\n3. 按下录制按钮\n4. 对着耳机mic讲话\n5. 按下停止按钮\n6. 按下播放按钮\n测试标准:\n如果设备不支持3.5mm有线耳机输入或者接收到路由通知、路由显示为3.5mm耳机,通过3.5mm耳机可正常录制和播放,则用例pass').fontColor(Color.White).fontSize('18fp')
}
Row(){
Text(`Audio输入路由:${this.inputDevice}`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`录制`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.recorderEnable)
.opacity(this.recorderEnable ? 1 : 0.4)
.onClick(async () => {
this.stopEnable = true
this.recorderEnable = false
await AudioCapturer.createAudioCapturer()
await AudioCapturer.startCapturer()
})
Row(){
Text('测试目的:\n当设备连接3.5mm有线耳机时,是否音频输入路由正确切换\n测试准备\n断连任何外设,保持设备常亮\n测试步骤:\n1. 验证设备是否支持3.5mm有线耳机\n2. 连接3.5mm有线耳机\n3. 按下录制按钮\n4. 对着耳机mic讲话\n5. 按下停止按钮\n6. 按下播放按钮\n测试标准:\n如果设备不支持3.5mm有线耳机输入或者接收到路由通知、路由显示为3.5mm耳机,通过3.5mm耳机可正常录制和播放,则用例pass').fontColor(Color.White).fontSize('18fp')
}
Column(){
Button(`停止`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.stopEnable)
.opacity(this.stopEnable ? 1 : 0.4)
.onClick(async () => {
this.recorderEnable = true
this.stopEnable = false
this.playEnable = true
await AudioCapturer.stopCapturer()
await AudioCapturer.releaseCapturer()
})
Row(){
Text(`Audio输入路由:${this.inputDevice}`).fontColor(Color.White).fontSize('18fp')
}
Column(){
Button(`播放`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.playEnable)
.opacity(this.playEnable ? 1 : 0.4)
.onClick(async () => {
this.playEnable = false
await mediaPlay.init()
this.Vue = true
})
Row(){
Column(){
Button(`录制`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.recorderEnable)
.opacity(this.recorderEnable ? 1 : 0.4)
.onClick(async () => {
this.stopEnable = true
this.recorderEnable = false
await AudioCapturer.createAudioCapturer()
await AudioCapturer.startCapturer()
})
}
Column(){
Button(`停止`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.stopEnable)
.opacity(this.stopEnable ? 1 : 0.4)
.onClick(async () => {
this.recorderEnable = true
this.stopEnable = false
this.playEnable = true
await AudioCapturer.stopCapturer()
await AudioCapturer.releaseCapturer()
})
}
Column(){
Button(`播放`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.playEnable)
.opacity(this.playEnable ? 1 : 0.4)
.onClick(async () => {
this.playEnable = false
await mediaPlay.init()
this.Vue = true
})
}
}
}
}
......
......@@ -88,71 +88,73 @@ struct audioOutputRouting {
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`是否设备支持蓝牙耳机?`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`不支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.yesEnable)
.opacity(!this.yesEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
})
Scroll() {
Column(){
Row(){
Text(`是否设备支持蓝牙耳机?`).fontColor(Color.White).fontSize('18fp')
}
Column(){
Button(`支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.onClick(async () => {
this.yesEnable = true
this.playEnable = true
Row(){
Column(){
Button(`不支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.yesEnable)
.opacity(!this.yesEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
})
}
Column(){
Button(`支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.onClick(async () => {
this.yesEnable = true
this.playEnable = true
})
})
}
}
}
Row(){
Text('测试目的:\n当设备连接蓝牙耳机时,音频路由是否正确切换\n测试准备:\n断连任何外设,保持设备常亮\n测试步骤:\n1. 验证设备是否支持蓝牙外设\n2. 按下播放按钮\n3. 连接蓝牙耳机\n4. 拔出蓝牙耳机\n5. 按下停止按钮\n测试标准:\n如果设备不支持蓝牙耳机连接或者插拔蓝牙耳机后接收到路由通知、路由显示正确,且连接蓝牙后音频通过蓝牙耳机播放,则用例pass').fontColor(Color.White).fontSize('18fp')
Row(){
Text('测试目的:\n当设备连接蓝牙耳机时,音频路由是否正确切换\n测试准备:\n断连任何外设,保持设备常亮\n测试步骤:\n1. 验证设备是否支持蓝牙外设\n2. 按下播放按钮\n3. 连接蓝牙耳机\n4. 拔出蓝牙耳机\n5. 按下停止按钮\n测试标准:\n如果设备不支持蓝牙耳机连接或者插拔蓝牙耳机后接收到路由通知、路由显示正确,且连接蓝牙后音频通过蓝牙耳机播放,则用例pass').fontColor(Color.White).fontSize('18fp')
}
Row(){
Text(`Audio输出路由:${this.outputDevice}`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`播放`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.playEnable)
.opacity(this.playEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
this.stopEnable = true
this.playEnable = false
await AudioRenderer.createAudioRenderer()
await AudioRenderer.startRenderer()
})
}
Column(){
Button(`停止`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.stopEnable)
.opacity(this.stopEnable? 1 : 0.4)
.onClick(async () => {
await AudioRenderer.stopRenderer()
await AudioRenderer.releaseRenderer()
this.playEnable = true
this.stopEnable = false
})
Row(){
Text(`Audio输出路由:${this.outputDevice}`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`播放`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.playEnable)
.opacity(this.playEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
this.stopEnable = true
this.playEnable = false
await AudioRenderer.createAudioRenderer()
await AudioRenderer.startRenderer()
})
}
Column(){
Button(`停止`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.stopEnable)
.opacity(this.stopEnable? 1 : 0.4)
.onClick(async () => {
await AudioRenderer.stopRenderer()
await AudioRenderer.releaseRenderer()
this.playEnable = true
this.stopEnable = false
})
}
}
}
}
......
......@@ -88,71 +88,73 @@ struct audioOutputRouting {
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`是否设备支持TypeC耳机?`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`不支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.yesEnable)
.opacity(!this.yesEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
})
Scroll() {
Column(){
Row(){
Text(`是否设备支持TypeC耳机?`).fontColor(Color.White).fontSize('18fp')
}
Column(){
Button(`支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.onClick(async () => {
this.yesEnable = true
this.playEnable = true
Row(){
Column(){
Button(`不支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.yesEnable)
.opacity(!this.yesEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
})
}
Column(){
Button(`支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.onClick(async () => {
this.yesEnable = true
this.playEnable = true
})
})
}
}
}
Row(){
Text('测试目的:\n当设备连接TypeC耳机时,音频路由是否正确切换\n测试准备:\n断连任何外设,保持设备常亮\n测试步骤:\n1. 验证设备是否支持TypeC外设\n2. 按下播放按钮\n3. 连接TypeC耳机\n4. 拔出TypeC耳机\n5. 按下停止按钮\n测试标准:\n如果设备不支持TypeC耳机连接或者插拔TypeC耳机后接收到路由通知、路由显示正确,且连接TypeC后音频通过TypeC耳机播放,则用例pass').fontColor(Color.White).fontSize('18fp')
Row(){
Text('测试目的:\n当设备连接TypeC耳机时,音频路由是否正确切换\n测试准备:\n断连任何外设,保持设备常亮\n测试步骤:\n1. 验证设备是否支持TypeC外设\n2. 按下播放按钮\n3. 连接TypeC耳机\n4. 拔出TypeC耳机\n5. 按下停止按钮\n测试标准:\n如果设备不支持TypeC耳机连接或者插拔TypeC耳机后接收到路由通知、路由显示正确,且连接TypeC后音频通过TypeC耳机播放,则用例pass').fontColor(Color.White).fontSize('18fp')
}
Row(){
Text(`Audio输出路由:${this.outputDevice}`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`播放`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.playEnable)
.opacity(this.playEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
this.stopEnable = true
this.playEnable = false
await AudioRenderer.createAudioRenderer()
await AudioRenderer.startRenderer()
})
}
Column(){
Button(`停止`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.stopEnable)
.opacity(this.stopEnable? 1 : 0.4)
.onClick(async () => {
await AudioRenderer.stopRenderer()
await AudioRenderer.releaseRenderer()
this.playEnable = true
this.stopEnable = false
})
Row(){
Text(`Audio输出路由:${this.outputDevice}`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`播放`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.playEnable)
.opacity(this.playEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
this.stopEnable = true
this.playEnable = false
await AudioRenderer.createAudioRenderer()
await AudioRenderer.startRenderer()
})
}
Column(){
Button(`停止`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.stopEnable)
.opacity(this.stopEnable? 1 : 0.4)
.onClick(async () => {
await AudioRenderer.stopRenderer()
await AudioRenderer.releaseRenderer()
this.playEnable = true
this.stopEnable = false
})
}
}
}
}
......
......@@ -88,71 +88,73 @@ struct audioOutputRouting {
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
Column() {
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) {
Column(){
Row(){
Text(`是否设备支持3.5mm有线耳机?`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`不支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.yesEnable)
.opacity(!this.yesEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
})
Scroll() {
Column(){
Row(){
Text(`是否设备支持3.5mm有线耳机?`).fontColor(Color.White).fontSize('18fp')
}
Column(){
Button(`支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.onClick(async () => {
this.yesEnable = true
this.playEnable = true
Row(){
Column(){
Button(`不支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(!this.yesEnable)
.opacity(!this.yesEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
})
}
Column(){
Button(`支持`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.onClick(async () => {
this.yesEnable = true
this.playEnable = true
})
})
}
}
}
Row(){
Text('测试目的:\n当设备连接3.5mm有线耳机时,音频路由是否正确切换\n测试准备:\n断连任何外设,保持设备常亮\n测试步骤:\n1. 验证设备是否支持3.5mm耳机外设\n2. 按下播放按钮\n3. 连接3.5mm有线耳机\n4. 拔出3.5mm有线耳机\n5. 按下停止按钮\n测试标准:\n如果设备不支持有线耳机输入或者插入和拔出有线耳机后接收到路由通知,路由显示正确,且连接外设后音频通过外设播放,则用例pass').fontColor(Color.White).fontSize('18fp')
Row(){
Text('测试目的:\n当设备连接3.5mm有线耳机时,音频路由是否正确切换\n测试准备:\n断连任何外设,保持设备常亮\n测试步骤:\n1. 验证设备是否支持3.5mm耳机外设\n2. 按下播放按钮\n3. 连接3.5mm有线耳机\n4. 拔出3.5mm有线耳机\n5. 按下停止按钮\n测试标准:\n如果设备不支持有线耳机输入或者插入和拔出有线耳机后接收到路由通知,路由显示正确,且连接外设后音频通过外设播放,则用例pass').fontColor(Color.White).fontSize('18fp')
}
Row(){
Text(`Audio输出路由:${this.outputDevice}`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`播放`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.playEnable)
.opacity(this.playEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
this.stopEnable = true
this.playEnable = false
await AudioRenderer.createAudioRenderer()
await AudioRenderer.startRenderer()
})
}
Column(){
Button(`停止`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.stopEnable)
.opacity(this.stopEnable? 1 : 0.4)
.onClick(async () => {
await AudioRenderer.stopRenderer()
await AudioRenderer.releaseRenderer()
this.playEnable = true
this.stopEnable = false
})
Row(){
Text(`Audio输出路由:${this.outputDevice}`).fontColor(Color.White).fontSize('18fp')
}
Row(){
Column(){
Button(`播放`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.playEnable)
.opacity(this.playEnable? 1 : 0.4)
.onClick(async () => {
this.Vue = true
this.stopEnable = true
this.playEnable = false
await AudioRenderer.createAudioRenderer()
await AudioRenderer.startRenderer()
})
}
Column(){
Button(`停止`)
.borderRadius(8)
.backgroundColor(0x317aff)
.width('30%')
.enabled(this.stopEnable)
.opacity(this.stopEnable? 1 : 0.4)
.onClick(async () => {
await AudioRenderer.stopRenderer()
await AudioRenderer.releaseRenderer()
this.playEnable = true
this.stopEnable = false
})
}
}
}
}
......
......@@ -104,17 +104,21 @@ struct cameraOrientation {
}.size({ width: '10%', height: '30%' })
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Start, direction: FlexDirection.Column }) {
// Text(`提示:` + this.isFlash).fontSize('16fp').fontColor(Color.White)
Text(`提示:如果设备存在闪光灯,选择开启,否则选择无闪光灯`)
.fontSize('16fp').fontColor(Color.White).margin('20fp')
Row() {
Button(this.flashChange ? '关闭' : '开启').onClick(() => {
this.openFlash()
})
Button('无闪光灯').onClick(() => {
this.Vue = true
})
}.justifyContent(FlexAlign.SpaceEvenly).width('100%').margin('20fp')
Scroll() {
Column() {
// Text(`提示:` + this.isFlash).fontSize('16fp').fontColor(Color.White)
Text(`提示:如果设备存在闪光灯,选择开启,否则选择无闪光灯`)
.fontSize('16fp').fontColor(Color.White).margin('20fp')
Row() {
Button(this.flashChange ? '关闭' : '开启').onClick(() => {
this.openFlash()
})
Button('无闪光灯').onClick(() => {
this.Vue = true
})
}.justifyContent(FlexAlign.SpaceEvenly).width('100%').margin('20fp')
}
}
}.width('80%').height('50%')
......
......@@ -118,50 +118,55 @@ struct cameraOrientation {
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
Scroll() {
Column() {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex).then(() => {
this.cameraListFn()
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
Column() {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex).then(() => {
this.cameraListFn()
})
})
.size({ width: '100%', height: '100%' })
Text('预览').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '65%' })
Column() {
Image(this.assetUri || '').size({ width: '100%', height: '100%' }).border({ width: 1 })
Text('带旋转角度的图片').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '65%' })
}.width('100%').height('60%')
Flex({ direction: FlexDirection.Column }) {
Text(`Camera: ${this.cameraDeviceIndex}`).fontSize('16fp').fontColor(Color.White)
Text(`Orientation: ${this.imageRotation}°`).fontSize('16fp').fontColor(Color.White)
Text(`顺时针`).fontSize('16fp').fontColor(Color.White)
Text(`提示:`).fontSize('16fp').fontColor(Color.White)
Text(`如果左边预览窗口顺时针旋转后与右边窗口相同,选择pass,否则选择fail`)
.fontSize('16fp').fontColor(Color.White)
}.size({ width: '80%', height: '25%' })
Button(this.takeFlag ? '拍照' : '下一个')
.enabled(this.isEnabled)
.opacity(this.isEnabled ? 1 : 0.4)
.width('50%')
.height('5%')
.backgroundColor(0x317aff)
.onClick(async () => {
this.onChangeTake()
})
.size({ width: '100%', height: '100%' })
Text('预览').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '60%' })
}
}.height('80%')
Column() {
Image(this.assetUri || '').size({ width: '100%', height: '100%' }).border({ width: 1 })
Text('带旋转角度的图片').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '60%' })
}.width('100%').height('50%')
Flex({ direction: FlexDirection.Column }) {
Text(`Camera: ${this.cameraDeviceIndex}`).fontSize('16fp').fontColor(Color.White)
Text(`Orientation: ${this.imageRotation}°`).fontSize('16fp').fontColor(Color.White)
Text(`顺时针`).fontSize('16fp').fontColor(Color.White)
Text(`提示:`).fontSize('16fp').fontColor(Color.White)
Text(`如果左边预览窗口顺时针旋转后与右边窗口相同,选择pass,否则选择fail`)
.fontSize('16fp').fontColor(Color.White)
}.size({ width: '80%', height: '25%' })
Button(this.takeFlag ? '拍照' : '下一个')
.enabled(this.isEnabled)
.opacity(this.isEnabled ? 1 : 0.4)
.width('50%')
.height('5%')
.backgroundColor(0x317aff)
.onClick(async () => {
this.onChangeTake()
})
CustomContainer({
title: this.name,
......
......@@ -125,130 +125,137 @@ struct cameraOrientation {
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
Scroll() {
Column() {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.cameraInit()
})
.size({ width: '100%', height: '100%' })
Text('预览').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '60%' })
Column() {
Image(this.assetUri || '').size({ width: '100%', height: '100%' }).border({ width: 1 })
Text('图片').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '60%' })
}.width('100%').height('50%')
Flex({ direction: FlexDirection.Column }) {
Row() {
Select(this.resolution)
.selected(this.clickFrequency)
.value(this.resolutionSelectVal)
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number, value) => {
let indexOf = value.indexOf('x')
let objW = Number(value.slice(0, indexOf))
let objH = Number(value.slice(indexOf + 1))
let obj = {
format: 2000,
size: {
"width": objW,
"height": objH
}
}
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex, obj)
Logger.info(this.tag, `onSelect Rotation index: ${index}, value: ${value}, obj: ${obj}`)
})
.backgroundColor(Color.Black)
Select(this.cameraList)
.selected(this.cameraDeviceIndex)
.value(this.cameraDeviceIndex ? 'Camera 1' : 'Camera 0')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number) => {
this.cameraDeviceIndex = index
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex).then(() => {
this.cameraListFn()
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
Column() {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
})
.backgroundColor(Color.Black)
}.justifyContent(FlexAlign.SpaceEvenly)
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.cameraInit()
})
.size({ width: '100%', height: '100%' })
Text('预览').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '65%' })
Text(`提示:不同拍照分辨率下进行拍摄,图片拍摄成功且与预览画面一致则选择pass,否则选择fail`)
.fontSize('16fp').fontColor(Color.White).margin({ top: 20 })
}.size({ width: '80%', height: '20%' })
Column() {
Image(this.assetUri || '').size({ width: '100%', height: '100%' }).border({ width: 1 })
Text('图片').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '65%' })
}.width('100%').height('60%')
Row() {
Button('拍照')
.enabled(this.isEnabled)
.opacity(this.isEnabled ? 1 : 0.4)
.width('40%')
.backgroundColor(0x317aff)
.onClick(async () => {
this.isEnabled = false
this.isNextEnabled = false
CameraService.takePicture()
})
Button('下一个')
.enabled(!this.isNextEnabled)
.opacity(!this.isNextEnabled ? 1 : 0.4)
.width('40%')
.backgroundColor(0x317aff)
.onClick(async () => {
this.clickFrequency++
Logger.info(this.tag, `nextClickFn new clickFrequency: ${this.clickFrequency}`)
if (this.resolution.length == this.clickFrequency || this.resolution.length < this.clickFrequency){
if (this.isCameraChange){
this.Vue = true
this.isEnabled = false
this.isNextEnabled = true
return
}
this.clickFrequency = 0
if (this.cameraListLength > 1) {
this.cameraDeviceIndex = Number(!this.cameraDeviceIndex)
await this.cameraInit().then(() => {
this.isCameraChange = true
Flex({ direction: FlexDirection.Column }) {
Row() {
Select(this.resolution)
.selected(this.clickFrequency)
.value(this.resolutionSelectVal)
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number, value) => {
let indexOf = value.indexOf('x')
let objW = Number(value.slice(0, indexOf))
let objH = Number(value.slice(indexOf + 1))
let obj = {
format: 2000,
size: {
"width": objW,
"height": objH
}
}
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex, obj)
Logger.info(this.tag, `onSelect Rotation index: ${index}, value: ${value}, obj: ${obj}`)
})
.backgroundColor(Color.Black)
Select(this.cameraList)
.selected(this.cameraDeviceIndex)
.value(this.cameraDeviceIndex ? 'Camera 1' : 'Camera 0')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number) => {
this.cameraDeviceIndex = index
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex).then(() => {
this.cameraListFn()
})
})
} else {
this.Vue = true
.backgroundColor(Color.Black)
}.justifyContent(FlexAlign.SpaceEvenly)
Text(`提示:不同拍照分辨率下进行拍摄,图片拍摄成功且与预览画面一致则选择pass,否则选择fail`)
.fontSize('16fp').fontColor(Color.White).margin({ top: 20 })
}.size({ width: '80%', height: '25%' })
Row() {
Button('拍照')
.enabled(this.isEnabled)
.opacity(this.isEnabled ? 1 : 0.4)
.width('40%')
.backgroundColor(0x317aff)
.onClick(async () => {
this.isEnabled = false
this.isNextEnabled = false
CameraService.takePicture()
})
Button('下一个')
.enabled(!this.isNextEnabled)
.opacity(!this.isNextEnabled ? 1 : 0.4)
.width('40%')
.backgroundColor(0x317aff)
.onClick(async () => {
this.clickFrequency++
Logger.info(this.tag, `nextClickFn new clickFrequency: ${this.clickFrequency}`)
if (this.resolution.length == this.clickFrequency || this.resolution.length < this.clickFrequency){
if (this.isCameraChange){
this.Vue = true
this.isEnabled = false
this.isNextEnabled = true
return
}
this.clickFrequency = 0
if (this.cameraListLength > 1) {
this.cameraDeviceIndex = Number(!this.cameraDeviceIndex)
await this.cameraInit().then(() => {
this.isCameraChange = true
})
} else {
this.Vue = true
this.isEnabled = false
this.isNextEnabled = true
return
}
}
this.isEnabled = true
this.isNextEnabled = true
return
}
}
this.isEnabled = true
this.isNextEnabled = true
if (this.clickFrequency){
let newResolution = this.dealWithResolutionFn(this.resolution)
Logger.info(this.tag, `nextClickFn new Resolution: ${newResolution}`)
this.cameraInit(newResolution[this.clickFrequency])
this.resolutionSelectVal = String(this.resolution[this.clickFrequency].value)
}
if (this.clickFrequency){
let newResolution = this.dealWithResolutionFn(this.resolution)
Logger.info(this.tag, `nextClickFn new Resolution: ${newResolution}`)
this.cameraInit(newResolution[this.clickFrequency])
this.resolutionSelectVal = String(this.resolution[this.clickFrequency].value)
}
})
}.width('100%').justifyContent(FlexAlign.SpaceEvenly)
.height('10%')
}
}.height('80%')
})
}.width('100%').justifyContent(FlexAlign.SpaceEvenly)
.height('10%')
CustomContainer({
title: this.name,
......
......@@ -131,90 +131,94 @@ struct cameraFormat {
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround, direction: FlexDirection.Column }) {
Column() {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.cameraInit()
})
.size({ width: '100%', height: '100%' })
Text('预览').fontSize('20fp').fontColor(Color.White)
}.size({ width: '80%', height: '70%' })
Column() {
Row() {
Select(this.resolution)
.selected(this.clickFrequency)
.value(this.resolutionSelectVal)
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number, value) => {
let indexOf = value.indexOf('x')
let objW = Number(value.slice(0, indexOf))
let objH = Number(value.slice(indexOf + 1))
let obj = {
format: 1003,
size: {
"width": objW,
"height": objH
}
}
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex, undefined, undefined, obj)
Logger.info(this.tag, `onSelect Rotation index: ${index}, value: ${value}, obj: ${obj}`)
})
.backgroundColor(Color.Black)
Select(this.cameraList)
.selected(this.cameraDeviceIndex)
.value(this.cameraDeviceIndex ? 'Camera 1' : 'Camera 0')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number) => {
this.cameraDeviceIndex = index
this.cameraInit()
})
.backgroundColor(Color.Black)
}.size({ width: '100%', height: '50%' }).justifyContent(FlexAlign.SpaceEvenly)
Row() {
Select([{ value: 'YUV' }])
.selected(0)
.value('YUV')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number, value) => {
Logger.info(this.tag, `onSelect format index: ${index}, value: ${value}`)
Scroll() {
Column() {
Column() {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.backgroundColor(Color.Black)
Button('下一个')
.borderRadius(8)
.backgroundColor(0x317aff)
.enabled(this.nextEnabled)
.opacity(this.nextEnabled ? 1 : 0.4)
.width('20%')
.onClick(async () => {
this.nextClickFn()
})
}.size({ width: '100%', height: '50%' }).justifyContent(FlexAlign.SpaceEvenly)
}.size({ width: '100%', height: '20%' })
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.cameraInit()
})
.size({ width: '100%', height: '70%' })
Text('预览').fontSize('20fp').fontColor(Color.White)
}.size({ width: '80%' })
Column() {
Row() {
Select(this.resolution)
.selected(this.clickFrequency)
.value(this.resolutionSelectVal)
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number, value) => {
let indexOf = value.indexOf('x')
let objW = Number(value.slice(0, indexOf))
let objH = Number(value.slice(indexOf + 1))
let obj = {
format: 1003,
size: {
"width": objW,
"height": objH
}
}
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex, undefined, undefined, obj)
Logger.info(this.tag, `onSelect Rotation index: ${index}, value: ${value}, obj: ${obj}`)
})
.backgroundColor(Color.Black)
Select(this.cameraList)
.selected(this.cameraDeviceIndex)
.value(this.cameraDeviceIndex ? 'Camera 1' : 'Camera 0')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number) => {
this.cameraDeviceIndex = index
this.cameraInit()
})
.backgroundColor(Color.Black)
}.size({ width: '100%', height: '50%' }).justifyContent(FlexAlign.SpaceEvenly)
Row() {
Select([{ value: 'YUV' }])
.selected(0)
.value('YUV')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number, value) => {
Logger.info(this.tag, `onSelect format index: ${index}, value: ${value}`)
})
.backgroundColor(Color.Black)
Button('下一个')
.borderRadius(8)
.backgroundColor(0x317aff)
.enabled(this.nextEnabled)
.opacity(this.nextEnabled ? 1 : 0.4)
.width('20%')
.onClick(async () => {
this.nextClickFn()
})
}.size({ width: '100%', height: '50%' }).justifyContent(FlexAlign.SpaceEvenly)
}.size({ width: '100%', height: '20%' })
}
}
}.height('80%').width('100%')
CustomContainer({
......
......@@ -116,66 +116,72 @@ struct cameraOrientation {
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
Scroll() {
Column() {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex).then(() => {
this.cameraListFn()
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) {
Column() {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex).then(() => {
this.cameraListFn()
})
})
.size({ width: '100%', height: '100%' })
Text('预览').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '65%' })
Column() {
Image(this.assetUri || '').size({ width: '100%', height: '100%' }).border({ width: 1 })
Text('图片').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '65%' })
}.width('100%').height('60%')
Flex({ direction: FlexDirection.Column }) {
Select(this.cameraList)
.selected(this.cameraDeviceIndex)
.value(this.cameraDeviceIndex ? 'Camera 1' : 'Camera 0')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number) => {
this.cameraDeviceIndex = index
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex).then(() => {
this.cameraListFn()
})
})
.backgroundColor(Color.Black)
Text(`提示:`).fontSize('16fp').fontColor(Color.White)
Text(`期望拍摄${this.cameraListLength*10}张照片,实际拍摄${this.clickSerialPhotoVal}张,如果一致请选择pass,否则选择fail`)
.fontSize('16fp').fontColor(Color.White)
}.size({ width: '80%', height: '25%' })
Button('拍照')
.enabled(this.isEnabled)
.opacity(this.isEnabled ? 1 : 0.4)
.width('50%')
.height('5%')
.backgroundColor(0x317aff)
.onClick(async () => {
this.isEnabled = false
this.timer = setInterval(() => {
this.clickSerialPhotoVal++
}, 1000)
})
.size({ width: '100%', height: '100%' })
Text('预览').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '60%' })
}
}.height('80%')
Column() {
Image(this.assetUri || '').size({ width: '100%', height: '100%' }).border({ width: 1 })
Text('图片').fontSize('20fp').fontColor(Color.White)
}.size({ width: '40%', height: '60%' })
}.width('100%').height('50%')
Flex({ direction: FlexDirection.Column }) {
Select(this.cameraList)
.selected(this.cameraDeviceIndex)
.value(this.cameraDeviceIndex ? 'Camera 1' : 'Camera 0')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number) => {
this.cameraDeviceIndex = index
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex).then(() => {
this.cameraListFn()
})
})
.backgroundColor(Color.Black)
Text(`提示:`).fontSize('16fp').fontColor(Color.White)
Text(`期望拍摄${this.cameraListLength*10}张照片,实际拍摄${this.clickSerialPhotoVal}张,如果一致请选择pass,否则选择fail`)
.fontSize('16fp').fontColor(Color.White)
}.size({ width: '80%', height: '25%' })
Button('拍照')
.enabled(this.isEnabled)
.opacity(this.isEnabled ? 1 : 0.4)
.width('50%')
.height('5%')
.backgroundColor(0x317aff)
.onClick(async () => {
this.isEnabled = false
this.timer = setInterval(() => {
this.clickSerialPhotoVal++
}, 1000)
})
CustomContainer({
title: this.name,
......
......@@ -141,135 +141,140 @@ struct cameraOrientation {
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
Flex({ justifyContent: FlexAlign.SpaceEvenly }) {
Scroll() {
Column() {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.cameraInit()
})
.size({ width: '100%', height: '100%' })
Text('视频录制').fontSize('20fp').fontColor(Color.White)
}.size({ width: '45%', height: '100%' })
Flex({ justifyContent: FlexAlign.SpaceEvenly }) {
Column() {
if(!this.isVideoPlayback){
XComponent({
id: '',
type: 'surface',
controller: this.mXComponentController1
})
.onLoad(() => {
})
.size({ width: '100%', height: '100%' })
Text('视频回放').fontSize('20fp').fontColor(Color.White)
}
}.size({ width: '45%', height: '100%' })
}.size({ width: '100%', height: '50%' })
Column() {
XComponent({
id: 'componentId',
type: 'surface',
controller: this.mXComponentController
})
.onLoad(async () => {
Logger.info(this.tag, 'onLoad is called')
// @ts-ignore
this.surfaceId = this.mXComponentController.getXComponentSurfaceId()
Logger.info(this.tag, `onLoad surfaceId: ${this.surfaceId}`)
this.cameraInit()
})
.size({ width: '100%', height: '100%' })
Text('视频录制').fontSize('20fp').fontColor(Color.White)
}.size({ width: '45%', height: '100%' })
Column() {
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceEvenly }) {
Select(this.resolution)
.selected(this.clickFrequency)
.value(this.resolutionSelectVal)
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.margin({ top: 50 })
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number, value) => {
let indexOf = value.indexOf('x')
let objW = Number(value.slice(0, indexOf))
let objH = Number(value.slice(indexOf + 1))
let obj = {
format: 1003,
size: {
"width": objW,
"height": objH
}
Column() {
if(!this.isVideoPlayback){
XComponent({
id: '',
type: 'surface',
controller: this.mXComponentController1
})
.onLoad(() => {
})
.size({ width: '100%', height: '100%' })
Text('视频回放').fontSize('20fp').fontColor(Color.White)
}
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
Logger.info(this.tag, `onSelect Rotation index: ${index}, value: ${value}, obj: ${obj}`)
})
.backgroundColor(Color.Black)
Select(this.cameraList)
.selected(this.cameraDeviceIndex)
.value(this.cameraDeviceIndex ? 'Camera 1' : 'Camera 0')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.margin({ top: 50 })
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number) => {
this.cameraDeviceIndex = index
this.cameraInit()
})
.backgroundColor(Color.Black)
Select([{ value: 'YUV' }])
.selected(0)
.value('YUV')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.margin({ top: 50 })
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number, value) => {
Logger.info(this.tag, `onSelect format index: ${index}, value: ${value}`)
})
.backgroundColor(Color.Black)
}.size({ width: '100%', height: '50%' })
}.size({ width: '45%', height: '100%' })
}.size({ width: '100%', height: '60%' })
Column() {
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceEvenly }) {
Select(this.resolution)
.selected(this.clickFrequency)
.value(this.resolutionSelectVal)
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.margin({ top: 50 })
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number, value) => {
let indexOf = value.indexOf('x')
let objW = Number(value.slice(0, indexOf))
let objH = Number(value.slice(indexOf + 1))
let obj = {
format: 1003,
size: {
"width": objW,
"height": objH
}
}
CameraService.initCamera(this.surfaceId, this.cameraDeviceIndex)
Logger.info(this.tag, `onSelect Rotation index: ${index}, value: ${value}, obj: ${obj}`)
})
.backgroundColor(Color.Black)
Select(this.cameraList)
.selected(this.cameraDeviceIndex)
.value(this.cameraDeviceIndex ? 'Camera 1' : 'Camera 0')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.margin({ top: 50 })
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number) => {
this.cameraDeviceIndex = index
this.cameraInit()
})
.backgroundColor(Color.Black)
Select([{ value: 'YUV' }])
.selected(0)
.value('YUV')
.font({ size: 16, weight: 500 })
.fontColor(Color.White)
.margin({ top: 50 })
.selectedOptionBgColor(Color.Black)
.optionBgColor(Color.Black)
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.onSelect((index: number, value) => {
Logger.info(this.tag, `onSelect format index: ${index}, value: ${value}`)
})
.backgroundColor(Color.Black)
}.size({ width: '100%', height: '50%' })
Row() {
Button('录制')
.borderRadius(8)
.backgroundColor(0x317aff)
.margin(15)
.enabled(this.testEnabled)
.opacity(this.testEnabled ? 1 : 0.4)
.size({ width: '30%', height: '40%' })
.onClick(async () => {
this.testEnabled = false
this.nextEnabled = true
prompt.showToast({
message: '录制中,请等待三秒', duration: 1000
});
CameraService.startVideo().then(() => {
setTimeout(() => {
// @ts-ignore
let sufferID = this.mXComponentController1.getXComponentSurfaceId()
Logger.info(this.tag, `onSelect format sufferID: ${sufferID}`)
mediaPlay.init(sufferID)
}, 4000)
})
})
Button('下一个')
.borderRadius(8)
.backgroundColor(0x317aff)
.margin(15)
.enabled(this.nextEnabled)
.opacity(this.nextEnabled ? 1 : 0.4)
.size({ width: '30%', height: '40%' })
.onClick(async () => {
this.testEnabled = true
this.nextClickFn()
})
}.size({ width: '100%', height: '50%' }).justifyContent(FlexAlign.SpaceEvenly)
}.size({ width: '100%', height: '30%' })
}
}.height('80%')
Row() {
Button('录制')
.borderRadius(8)
.backgroundColor(0x317aff)
.margin(15)
.enabled(this.testEnabled)
.opacity(this.testEnabled ? 1 : 0.4)
.size({ width: '30%', height: '40%' })
.onClick(async () => {
this.testEnabled = false
this.nextEnabled = true
prompt.showToast({
message: '录制中,请等待三秒', duration: 1000
});
CameraService.startVideo().then(() => {
setTimeout(() => {
// @ts-ignore
let sufferID = this.mXComponentController1.getXComponentSurfaceId()
Logger.info(this.tag, `onSelect format sufferID: ${sufferID}`)
mediaPlay.init(sufferID)
}, 4000)
})
})
Button('下一个')
.borderRadius(8)
.backgroundColor(0x317aff)
.margin(15)
.enabled(this.nextEnabled)
.opacity(this.nextEnabled ? 1 : 0.4)
.size({ width: '30%', height: '40%' })
.onClick(async () => {
this.testEnabled = true
this.nextClickFn()
})
}.size({ width: '100%', height: '50%' }).justifyContent(FlexAlign.SpaceEvenly)
}.size({ width: '100%', height: '30%' })
CustomContainer({
title: this.name,
......
......@@ -37,7 +37,6 @@ struct CustomContainerUser {
async aboutToAppear(){
await FirstDialog.ChooseDialog(this.StepTips,this.name);
this.Vue = false;
globalThis.resultNum = 'time:-1000';
globalThis.SendMessage = this.toSP_daemon;
globalThis.HideFloatingWindow();
}
......@@ -54,7 +53,8 @@ struct CustomContainerUser {
Row(){
Text(`测试步骤:`+ '\n' + '\n' + '\n' + '\n' + `1.点击开始键进入系统桌面` + '\n' + '\n'
+ `2.清空后台应用` + '\n' + '\n' + `3.快速点击桌面相机应用` + '\n' + '\n' +`4.测试应用拉起后手动返回validator界面`
+ '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试` + '\n' + '\n' )
+ '\n' + '\n' + '5.点击结束键观察测试结果' + '\n' + '\n' + `6.若冷启动测试在规定时延内完成则通过测试`
+ '\n' + '\n' + 'PS:双击悬浮球中断测试,长按悬浮球快速结束测试')
.fontColor(Color.White).fontSize('20fp')
}
Row(){
......@@ -90,15 +90,18 @@ struct CustomContainerUser {
.onClick(() => {
this.StartEnable = !this.StartEnable;
// /*
// camera
// */
/*
camera
*/
console.log('result num: ' + globalThis.resultNum);
let CameraReport = globalThis.resultNum;
let CameraHead = CameraReport.indexOf('time:');
let CameraTime = CameraReport.substring(CameraHead+5);
this.cameraNum = parseFloat(CameraTime);
if( 0 < this.cameraNum && this.cameraNum < 2300 ) {
this.num++
} else if ( isNaN(this.cameraNum )){
this.cameraNum = -1000;
}
if( this.num === 1 ) {
this.Vue = true;
......
......@@ -97,6 +97,8 @@ struct CustomContainerUser {
this.contactsNum = parseFloat(ContactsTime);
if( 0 < this.contactsNum && this.contactsNum < 2300 ) {
this.num++
} else if ( isNaN(this.contactsNum )){
this.contactsNum = -1000;
}
if( this.num === 1 ) {
this.Vue = true;
......
......@@ -97,6 +97,8 @@ struct CustomContainerUser {
this.contactsNum = parseFloat(ContactsTime);
if( 0 < this.contactsNum && this.contactsNum < 600 ) {
this.num++
} else if ( isNaN(this.contactsNum )){
this.contactsNum = -1000;
}
if( this.num === 1 ) {
this.Vue = true;
......
......@@ -89,6 +89,8 @@ struct CustomContainerUser {
let time = parseFloat(this.time);
if( 0 < time && time < 1000 ) {
this.Vue = true;
}else if ( isNaN(this.time )){
this.time = -1000;
}
globalThis.HideFloatingWindow();
})
......
......@@ -97,6 +97,8 @@ struct CustomContainerUser {
this.mmsNum = parseFloat(MmsTime);
if( 0 < this.mmsNum && this.mmsNum < 2300 ) {
this.num++
} else if ( isNaN(this.mmsNum )){
this.mmsNum = -1000;
}
if( this.num === 1 ) {
this.Vue = true;
......
......@@ -98,6 +98,8 @@ struct CustomContainerUser {
this.mmsNum = parseFloat(MmsTime);
if( 0 < this.mmsNum && this.mmsNum < 600 ) {
this.num++
} else if ( isNaN(this.mmsNum )){
this.mmsNum = -1000;
}
if( this.num === 1 ) {
this.Vue = true;
......
......@@ -97,6 +97,8 @@ struct CustomContainerUser {
this.photosNum = parseFloat(photosTime);
if( 0 < this.photosNum && this.photosNum < 2300 ) {
this.num++
} else if ( isNaN(this.photosNum )){
this.photosNum = -1000;
}
if( this.num === 1 ) {
this.Vue = true;
......
......@@ -98,6 +98,8 @@ struct CustomContainerUser {
this.photosNum = parseFloat(photosTime);
if( 0 < this.photosNum && this.photosNum < 600 ) {
this.num++
} else if ( isNaN(this.photosNum )){
this.photosNum = -1000;
}
if( this.num === 1 ) {
this.Vue = true;
......
......@@ -97,6 +97,8 @@ struct CustomContainerUser {
this.setNum = parseFloat(setTime);
if( 0 < this.setNum && this.setNum < 2300 ) {
this.num++
} else if ( isNaN(this.setNum )){
this.setNum = -1000;
}
if( this.num === 1 ) {
this.Vue = true;
......
......@@ -98,6 +98,8 @@ struct CustomContainerUser {
this.setNum = parseFloat(setTime);
if( 0 < this.setNum && this.setNum < 600 ) {
this.num++
} else if ( isNaN(this.setNum )){
this.setNum = -1000;
}
if( this.num === 1 ) {
this.Vue = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册