提交 a953187b 编写于 作者: G guoenquan

add arkui test

Signed-off-by: Nguoenquan <guoenquan1@huawei-partners.com>
上级 2eb5d0ba
......@@ -226,6 +226,14 @@
<text class="sub-title">
方法30
</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>
</div>
......
......@@ -398,6 +398,31 @@
ctx.rotateZ(10);
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 {
},
});
})
Button('showActionMenu1')
.key('button3')
.backgroundColor('#ffe20b48')
Button('protshowDialog')
.key('buttonp')
.backgroundColor('#FF0B8FE2')
.fontSize(20)
.margin({top: 20})
.onClick(()=>{
.onClick(()=> {
prompt.showDialog({
title: 'Title Info',
message: 'Message Info',
buttons: [
{
text: this.text,
color: this.color,
text: 'button1',
color: '#000000',
},
{
text: 'button2',
color: '#000000',
}
],
})
.then(data => {
console.info('showDialog success, click button: ' + data.tapIndex);
Utils.emitEvent('sucessful',422)
console.info('showDialog success, click button: ' + data.index);
})
.catch(data => {
console.info('showDialog error: ' + data.errMsg);
});
.catch(err => {
console.info('showDialog error: ' + err);
})
Button('showDialog1')
.key('button4')
.backgroundColor('#ffe20b56')
})
Button('protshowDialog')
.key('buttonp')
.backgroundColor('#FF0B8FE2')
.fontSize(20)
.margin({top: 20})
.onClick(()=> {
prompt.showDialog({
title: 'Title Info',
title: 'showDialog Title Info',
message: 'Message Info',
buttons: [
{
text: this.text,
color: this.color,
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);
});
Button('protshowActionMenu1')
.key('buttons1')
.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('protshowActionMenu2')
.key('buttons2')
.backgroundColor('#FF0B8FE2')
.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('showDialog success, click button: ' + data.tapIndex);
Utils.emitEvent('sucessful',422)
console.info('showActionMenu success, click button: ' + data.index);
})
.catch(data => {
console.info('showDialog error: ' + data.errMsg);
});
.catch(err => {
console.info('showActionMenu error: ' + err);
})
Button('showActionMenu2')
.key('button6')
.backgroundColor('#ffe20b48')
.fontSize(20)
.margin({top: 20})
})
in({top: 20})
.onClick(()=>{
promptAction.showDialog({
title: 'Title Info',
message: 'Message Info',
prompt.showActionMenu({
title: 'showActionMenu Title Info',
buttons: [
{
text: this.text,
color: this.color,
text: 'item1',
color: '#666666',
},
],
{
text: 'item2',
color: '#000000',
},
]
})
.then(data => {
console.info('showDialog success, click button: ' + data.tapIndex);
Utils.emitEvent('sucessful',422)
console.info('showActionMenu success, click button: ' + data.index);
})
.catch(err => {
console.info('showActionMenu error: ' + err);
})
.catch(data => {
console.info('showDialog error: ' + data.errMsg);
});
})
Button('showDialog2')
......
......@@ -66,13 +66,13 @@ struct OhosRouterA {
data3: [123, 456, 789]
},
},
}, (err) => {
if (err) {
})
.then(() => {
// success
})
.catch(err => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info('pushUrl success');
});
})
} catch (error) {
console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`);
};
......@@ -92,20 +92,20 @@ struct OhosRouterA {
data3: [123, 456, 789]
},
},
}, (err) => {
if (err) {
}, routery.RouterMode.Standard)
.then(() => {
// success
})
.catch(err => {
console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info('pushUrl success');
});
})
} catch (error) {
console.error(`pushUrl args error code is ${error.code}, message is ${error.message}`);
};
});
Button('replaceUrl')
.key('pushButtonA1')
Button('replaceUr2')
.key('pushButtonA2')
.backgroundColor('#FF0B8FE2')
.fontSize(20)
.margin({top: 20})
......@@ -116,13 +116,13 @@ struct OhosRouterA {
params: {
data1: 'message',
},
}, routery.RouterMode.Standard, (err) => {
if (err) {
}, routery.RouterMode.Standard)
.then(() => {
// success
})
.catch(err => {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info('replaceUrl success');
});
})
} catch (error) {
console.error(`replaceUrl args error code is ${error.code}, message is ${error.message}`);
};
......@@ -139,15 +139,15 @@ struct OhosRouterA {
params: {
data1: 'message',
},
}, (err) => {
if (err) {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.info('replaceUrl success');
});
})
.then(() => {
// success
})
.catch(err => {
console.info(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
})
} 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}`);
};
});
......
......@@ -23,73 +23,38 @@ struct ClipAndMaskExample {
@State isClipCircle:boolean = true;
@State maskType: CommonShapeMethod= new Rect({ width: 280, height: 280 });
@State clipType: CommonShapeMethod= new Circle({ width: 280, height: 280 });
@State shape_Type: CommonShapeMethod= new elliptical({ width: 200, height: 280 });
@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});
polygonInterface:PolygonInterface = Polygon
pathInterface : PathInterface = Path
private stateChangCallBack = (eventData) => {
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 });
}
}
}
shape:ShapeInterface = Shape
private stateChangCallBack = (eventData) => {
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 });
}
}
}
rect: RectInterface = Rect
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) => {
if (eventData != null) {
console.info("shapeClipping page state change called:" + JSON.stringify(eventData));
if(eventData.data.maskValue != null) {
this.lengthType = new line({ 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_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 });
this.maskType = new Circle({ width: 280, height: 280 });
}
}
}
private shapeChangCallBack = (eventData) => {
if (eventData != null) {
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.
先完成此消息的编辑!
想要评论请 注册