提交 a953187b 编写于 作者: G guoenquan

add arkui test

Signed-off-by: Nguoenquan <guoenquan1@huawei-partners.com>
上级 2eb5d0ba
...@@ -226,6 +226,14 @@ ...@@ -226,6 +226,14 @@
<text class="sub-title"> <text class="sub-title">
方法30 方法30
</text> </text>
<canvas style="width: 100%; height: 60px;margin-top: 5px;" ref="function30"></canvas>
<text class="sub-title">
方法31
</text>
<canvas style="width: 100%; height: 60px;margin-top: 5px;" ref="function30"></canvas>
<text class="sub-title">
方法32
</text>
<canvas style="width: 100%; height: 60px;margin-top: 5px;" ref="function30"></canvas> <canvas style="width: 100%; height: 60px;margin-top: 5px;" ref="function30"></canvas>
</div> </div>
......
...@@ -398,6 +398,31 @@ ...@@ -398,6 +398,31 @@
ctx.rotateZ(10); ctx.rotateZ(10);
ctx.fillRect(10, 10, 30, 30); ctx.fillRect(10, 10, 30, 30);
}, },
functionTouch30() {
const el =this.$refs.function15;
const ctx = el.getContext('2d');
ctx.fillRect(10, 10, 30, 30);
ctx.rotateZ(10);
ctx.fillRect(10, 10, 30, 30);
},
functionTouch31() {
let mat = new Matix2D();
mat.multiply();
let stack = new StackAttribute();
stack.alignContent();
const el =this.$refs.function15;
const ctx = el.getContext('2d');
ctx.fillRect(10, 10, 30, 30);
ctx.multiply();
ctx.fillRect(10, 10, 30, 30);
},
functionTouch32() {
const el =this.$refs.function15;
const ctx = el.getContext('2d');
ctx.fillRect(10, 10, 30, 30);
ctx.translateZ(50);
ctx.fillRect(10, 10, 30, 30);
},
} }
\ No newline at end of file
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import prompt from '@ohos.prompt';
import promptAction from '@ohos.promptAction';
import events_emitter from '@ohos.events.emitter';
@Entry
@Component
struct promptExample {
@State text: string = 'item1'
@State color: string = '#000000'
build(){
Column(){
Button('showActionMenu')
.key('button1')
.backgroundColor('#FF0B8FE2')
.fontSize(20)
.margin({top: 20})
.onClick(()=>{
prompt.showActionMenu({
title: 'Title Info',
buttons: [
{
text: this.text,
color: this.color,
},
],
success: function(data) {
console.log('dialog success callback,click button : ' + data.tapIndex);
},
fail: function(data) {
console.log('dialog fail callback' + data.errMsg);
},
});
})
Button('showDialog')
.key('button2')
.backgroundColor('#FF0B8FE2')
.fontSize(20)
.margin({top: 20})
.onClick(()=> {
prompt.showDialog({
title: 'Title Info',
message: 'Message Info',
buttons: [
{
text: this.text,
color: this.color,
},
],
success: function(data) {
console.log('dialog success callback,click button : ' + data.index);
},
cancel: function() {
console.log('dialog cancel callback');
},
});
})
Button('showActionMenu1')
.key('button3')
.backgroundColor('#ffe20b48')
.fontSize(20)
.margin({top: 20})
.onClick(()=>{
prompt.showDialog({
title: 'Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000',
},
{
text: 'button2',
color: '#000000',
}
],
})
.then(data => {
Utils.emitEvent('sucessful',422)
console.info('showDialog success, click button: ' + data.index);
})
.catch(err => {
console.info('showDialog error: ' + err);
})
})
Button('showActionMenu2')
.key('button6')
.backgroundColor('#ffe20b48')
.fontSize(20)
.margin({top: 20})
.onClick(()=>{
prompt.showActionMenu({
title: 'showActionMenu Title Info',
buttons: [
{
text: 'item1',
color: '#666666',
},
{
text: 'item2',
color: '#000000',
},
]
})
.then(data => {
console.info('showActionMenu success, click button: ' + data.index);
})
.catch(err => {
console.info('showActionMenu error: ' + err);
})
})
Button('showDialog2')
.key('button5')
.backgroundColor('#ffe20b56')
.fontSize(20)
.margin({top: 20})
.onClick(()=> {
promptAction.showDialog({
title: 'Title Info',
message: 'Message Info',
buttons: [
{
text: this.text,
color: this.color,
},
],
})
.then(data => {
console.info('showDialog success, click button: ' + data.tapIndex);
Utils.emitEvent('sucessful',422)
})
.catch(data => {
console.info('showDialog error: ' + data.errMsg);
});
})
Button('showDialog2')
.key('button5')
.backgroundColor('#ffe20b56')
.fontSize(20)
.margin({top: 20})
.onClick(()=> {
try {
promptAction.showDialog({
title: 'showDialog Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000',
},
{
text: 'button2',
color: '#000000',
}
]
}, (err, data) => {
if (err) {
console.info('showDialog err: ' + err);
return;
}
console.info('showDialog success callback, click button: ' + data.index);
});
} catch (error) {
console.error(`showDialog args error code is ${error.code}, message is ${error.message}`);
};
})
Button('showDialog2')
.key('button5')
.backgroundColor('#ffe20b56')
.fontSize(20)
.margin({top: 20})
.onClick(()=> {
try {
promptAction.showActionMenu({
title: 'showActionMenu Title Info',
buttons: [
{
text: 'item1',
color: '#666666',
},
{
text: 'item2',
color: '#000000',
},
]
})
.then(data => {
console.info('showActionMenu success, click button: ' + data.index);
})
.catch(err => {
console.info('showActionMenu error: ' + err);
})
} catch (error) {
console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`);
};
})
Button('showDialog2')
.key('button5')
.backgroundColor('#ffe20b56')
.fontSize(20)
.margin({top: 20})
.onClick(()=> {
try {
promptAction.showActionMenu({
title: 'showActionMenu Title Info',
buttons: [
{
text: 'item1',
color: '#666666',
},
{
text: 'item2',
color: '#000000',
},
]
})
.then(data => {
console.info('showActionMenu success, click button: ' + data.index);
})
.catch(err => {
console.info('showActionMenu error: ' + err);
})
} catch (error) {
console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`);
};
})
}
}
}
\ No newline at end of file
...@@ -70,84 +70,171 @@ struct promptExample { ...@@ -70,84 +70,171 @@ struct promptExample {
}, },
}); });
}) })
Button('showActionMenu1')
.key('button3') Button('protshowDialog')
.backgroundColor('#ffe20b48') .key('buttonp')
.backgroundColor('#FF0B8FE2')
.fontSize(20) .fontSize(20)
.margin({top: 20}) .margin({top: 20})
.onClick(()=>{ .onClick(()=> {
prompt.showDialog({ prompt.showDialog({
title: 'Title Info', title: 'Title Info',
message: 'Message Info', message: 'Message Info',
buttons: [ buttons: [
{ {
text: this.text, text: 'button1',
color: this.color, color: '#000000',
}, },
{
text: 'button2',
color: '#000000',
}
], ],
}) })
.then(data => { .then(data => {
console.info('showDialog success, click button: ' + data.tapIndex); console.info('showDialog success, click button: ' + data.index);
Utils.emitEvent('sucessful',422) })
.catch(err => {
console.info('showDialog error: ' + err);
}) })
.catch(data => {
console.info('showDialog error: ' + data.errMsg);
});
}) })
Button('showDialog1') Button('protshowDialog')
.key('button4') .key('buttonp')
.backgroundColor('#ffe20b56') .backgroundColor('#FF0B8FE2')
.fontSize(20) .fontSize(20)
.margin({top: 20}) .margin({top: 20})
.onClick(()=> { .onClick(()=> {
prompt.showDialog({ prompt.showDialog({
title: 'Title Info', title: 'showDialog Title Info',
message: 'Message Info', message: 'Message Info',
buttons: [ buttons: [
{ {
text: this.text, text: 'button1',
color: this.color, color: '#000000',
}, },
], {
}) text: 'button2',
.then(data => { color: '#000000',
console.info('showDialog success, click button: ' + data.tapIndex); }
Utils.emitEvent('sucessful',422) ]
}, (err, data) => {
if (err) {
console.info('showDialog err: ' + err);
return;
}
console.info('showDialog success callback, click button: ' + data.index);
});
}) Button('protshowActionMenu1')
.catch(data => { .key('buttons1')
console.info('showDialog error: ' + data.errMsg); .backgroundColor('#FF0B8FE2')
}); .fontSize(20)
}) .margin({top: 20})
.onClick(()=> {
prompt.showActionMenu({
title: 'Title Info',
buttons: [
{
text: 'item1',
color: '#666666',
},
{
text: 'item2',
color: '#000000',
},
]
}, (err, data) => {
if (err) {
console.info('showActionMenu err: ' + err);
return;
}
console.info('showActionMenu success callback, click button: ' + data.index);
});
Button('showActionMenu2') Button('protshowActionMenu2')
.key('button6') .key('buttons2')
.backgroundColor('#ffe20b48') .backgroundColor('#FF0B8FE2')
.fontSize(20) .fontSize(20)
.margin({top: 20}) .margin({top: 20})
.onClick(()=>{ .onClick(()=> {
promptAction.showDialog({ prompt.showActionMenu({
title: 'Title Info', title: 'showActionMenu Title Info',
message: 'Message Info',
buttons: [ buttons: [
{ {
text: this.text, text: 'item1',
color: this.color, color: '#666666',
}, },
], {
text: 'item2',
color: '#000000',
},
]
}) })
.then(data => { .then(data => {
console.info('showDialog success, click button: ' + data.tapIndex); console.info('showActionMenu success, click button: ' + data.index);
Utils.emitEvent('sucessful',422)
}) })
.catch(data => { .catch(err => {
console.info('showDialog error: ' + data.errMsg); console.info('showActionMenu error: ' + err);
}); })
})
in({top: 20})
.onClick(()=>{
prompt.showActionMenu({
title: 'showActionMenu Title Info',
buttons: [
{
text: 'item1',
color: '#666666',
},
{
text: 'item2',
color: '#000000',
},
]
})
.then(data => {
console.info('showActionMenu success, click button: ' + data.index);
})
.catch(err => {
console.info('showActionMenu error: ' + err);
})
}) })
Button('showDialog2') Button('showDialog2')
......
...@@ -58,24 +58,24 @@ struct OhosRouterA { ...@@ -58,24 +58,24 @@ struct OhosRouterA {
.margin({top: 20}) .margin({top: 20})
.onClick(() => { .onClick(() => {
try { try {
routery.pushUrl({ routery.pushUrl({
url: 'pages/routerpage2', url: 'pages/routerpage2',
params: { params: {
data1: 'message', data1: 'message',
data2: { data2: {
data3: [123, 456, 789] data3: [123, 456, 789]
}, },
}, },
}, (err) => { })
if (err) { .then(() => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); // success
return; })
} .catch(err => {
console.info('pushUrl success'); console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
}); })
} catch (error) { } catch (error) {
console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`); console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`);
}; };
}); });
Button('pushUrl') Button('pushUrl')
.key('pushButtonA1') .key('pushButtonA1')
...@@ -84,48 +84,48 @@ struct OhosRouterA { ...@@ -84,48 +84,48 @@ struct OhosRouterA {
.margin({top: 20}) .margin({top: 20})
.onClick(() => { .onClick(() => {
try { try {
routery.pushUrl({ routery.pushUrl({
url: 'pages/routerpage2', url: 'pages/routerpage2',
params: { params: {
data1: 'message', data1: 'message',
data2: { data2: {
data3: [123, 456, 789] data3: [123, 456, 789]
}, },
}, },
}, (err) => { }, routery.RouterMode.Standard)
if (err) { .then(() => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); // success
return; })
} .catch(err => {
console.info('pushUrl success'); console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
}); })
} catch (error) { } catch (error) {
console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`); console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`);
}; };
}); });
Button('replaceUrl') Button('replaceUr2')
.key('pushButtonA1') .key('pushButtonA2')
.backgroundColor('#FF0B8FE2') .backgroundColor('#FF0B8FE2')
.fontSize(20) .fontSize(20)
.margin({top: 20}) .margin({top: 20})
.onClick(() => { .onClick(() => {
try { try {
routery.replaceUrl({ routery.replaceUrl({
url: 'pages/detail', url: 'pages/detail',
params: { params: {
data1: 'message', data1: 'message',
}, },
}, routery.RouterMode.Standard, (err) => { }, routery.RouterMode.Standard)
if (err) { .then(() => {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); // success
return; })
} .catch(err => {
console.info('replaceUrl success'); console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
}); })
} catch (error) { } catch (error) {
console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`); console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`);
}; };
}); });
Button('replaceUrl') Button('replaceUrl')
.key('pushButtonA1') .key('pushButtonA1')
...@@ -134,21 +134,21 @@ struct OhosRouterA { ...@@ -134,21 +134,21 @@ struct OhosRouterA {
.margin({top: 20}) .margin({top: 20})
.onClick(() => { .onClick(() => {
try { try {
routery.replaceUrl({ routery.replaceUrl({
url: 'pages/detail', url: 'pages/detail',
params: { params: {
data1: 'message', data1: 'message',
}, },
}, (err) => { })
if (err) { .then(() => {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); // success
return; })
} .catch(err => {
console.info('replaceUrl success'); console.info(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
}); })
} catch (error) { } catch (error) {
console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`); console.info(`replaceUrl args error code is ${error.code}, message is ${error.message}`);
}; };
}); });
Button('clear') Button('clear')
......
...@@ -23,73 +23,38 @@ struct ClipAndMaskExample { ...@@ -23,73 +23,38 @@ struct ClipAndMaskExample {
@State isClipCircle:boolean = true; @State isClipCircle:boolean = true;
@State maskType: CommonShapeMethod= new Rect({ width: 280, height: 280 }); @State maskType: CommonShapeMethod= new Rect({ width: 280, height: 280 });
@State clipType: CommonShapeMethod= new Circle({ width: 280, height: 280 }); @State clipType: CommonShapeMethod= new Circle({ width: 280, height: 280 });
@State shape_Type: CommonShapeMethod= new elliptical({ width: 200, height: 280 }); polygonInterface:PolygonInterface = Polygon
@State lengthType: CommonShapeMethod= new line({ width: 0, height: 10 });
@State pathType: CommonShapeMethod= new path({ width: 10, height: 10 });
@State shape_2_Type: CommonShapeMethod= new polygon({ width: 5, height: 10 });
@State shape_3_Type: CommonShapeMethod= new polyine({ width: 5, height: 10 });
@State shape_4_Type: CommonShapeMethod= new rect_({ width: 5, height: 10 ,radius : 5});
pathInterface : PathInterface = Path
private stateChangCallBack = (eventData) => { shape:ShapeInterface = Shape
if (eventData != null) {
console.info("shapeClipping page state change called:" + JSON.stringify(eventData));
if(eventData.data.maskValue != null) {
this.maskType = new Circle({ width: 280, height: 280 });
}
}
}
private stateChangCallBack = (eventData) => { rect: RectInterface = Rect
if (eventData != null) {
console.info("shapeClipping page state change called:" + JSON.stringify(eventData));
if(eventData.data.maskValue != null) {
this.shape_Type = new elliptical({ width: 200, height: 280 });
}
}
}
polylineInterface:PolylineInterface = Polyline
ellsple: EllipseAttribute = new Ellipse({
width:'150px',
height: '150px'
})
circle : CircleAttribute = new Circle({
width:'150px',
height: '150px'
})
line : LineAttribute = new Line({
width:'15px',
height: '15px'
})
private stateChangCallBack = (eventData) => { private stateChangCallBack = (eventData) => {
if (eventData != null) { if (eventData != null) {
console.info("shapeClipping page state change called:" + JSON.stringify(eventData)); console.info("shapeClipping page state change called:" + JSON.stringify(eventData));
if(eventData.data.maskValue != null) { if(eventData.data.maskValue != null) {
this.lengthType = new line({ width: 200, height: 280 }); this.maskType = new Circle({ width: 280, height: 280 });
}
}
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("shapeClipping page state change called:" + JSON.stringify(eventData));
if(eventData.data.maskValue != null) {
this.shape_4_Type = new rect_({ width: 200, height: 280 });
}
}
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("shapeClipping page state change called:" + JSON.stringify(eventData));
if(eventData.data.maskValue != null) {
this.pathType = new path({ width: 200, height: 280 });
}
}
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("shapeClipping page state change called:" + JSON.stringify(eventData));
if(eventData.data.maskValue != null) {
this.shape_2_Type = new polygon({ width: 200, height: 280 });
}
}
}
private stateChangCallBack = (eventData) => {
if (eventData != null) {
console.info("shapeClipping page state change called:" + JSON.stringify(eventData));
if(eventData.data.maskValue != null) {
this.shape_3_Type = new polyine({ width: 200, height: 280 });
} }
} }
} }
private shapeChangCallBack = (eventData) => { private shapeChangCallBack = (eventData) => {
if (eventData != null) { if (eventData != null) {
console.info("shapeClipping page shape change called:" + JSON.stringify(eventData)); console.info("shapeClipping page shape change called:" + JSON.stringify(eventData));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册