Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
bc3828c4
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bc3828c4
编写于
1月 05, 2023
作者:
T
tianwenzhe
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ;
Signed-off-by:
N
tian-wenzhe411
<
tianwenzhe2@huawei.com
>
上级
3993995c
变更
38
隐藏空白更改
内联
并排
Showing
38 changed file
with
759 addition
and
780 deletion
+759
-780
validator/acts_validator/src/main/ets/pages/ArkUI/ArkUI_index.ets
...r/acts_validator/src/main/ets/pages/ArkUI/ArkUI_index.ets
+14
-15
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasFillStyle.ets
...ts_validator/src/main/ets/pages/ArkUI/CanvasFillStyle.ets
+16
-16
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasFont.ets
...or/acts_validator/src/main/ets/pages/ArkUI/CanvasFont.ets
+70
-76
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasGlobalAlpha.ets
..._validator/src/main/ets/pages/ArkUI/CanvasGlobalAlpha.ets
+11
-11
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasGlobalCompositeOperation.ets
...c/main/ets/pages/ArkUI/CanvasGlobalCompositeOperation.ets
+73
-73
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasImageSmoothingEnabled.ets
.../src/main/ets/pages/ArkUI/CanvasImageSmoothingEnabled.ets
+10
-10
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineCap.ets
...acts_validator/src/main/ets/pages/ArkUI/CanvasLineCap.ets
+29
-29
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineDashOffset.ets
...lidator/src/main/ets/pages/ArkUI/CanvasLineDashOffset.ets
+8
-8
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineJoin.ets
...cts_validator/src/main/ets/pages/ArkUI/CanvasLineJoin.ets
+33
-33
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineWidth.ets
...ts_validator/src/main/ets/pages/ArkUI/CanvasLineWidth.ets
+8
-8
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasMiterLimit.ets
...s_validator/src/main/ets/pages/ArkUI/CanvasMiterLimit.ets
+13
-13
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowBlur.ets
...s_validator/src/main/ets/pages/ArkUI/CanvasShadowBlur.ets
+12
-12
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowColor.ets
..._validator/src/main/ets/pages/ArkUI/CanvasShadowColor.ets
+21
-23
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowOffsetX.ets
...alidator/src/main/ets/pages/ArkUI/CanvasShadowOffsetX.ets
+14
-14
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowOffsetY.ets
...alidator/src/main/ets/pages/ArkUI/CanvasShadowOffsetY.ets
+14
-14
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasStrokeStyle.ets
..._validator/src/main/ets/pages/ArkUI/CanvasStrokeStyle.ets
+20
-20
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasTextAlign.ets
...ts_validator/src/main/ets/pages/ArkUI/CanvasTextAlign.ets
+44
-46
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasTextBaseline.ets
...validator/src/main/ets/pages/ArkUI/CanvasTextBaseline.ets
+50
-52
validator/acts_validator/src/main/ets/pages/ArkUI/LongPressGesture.ets
...s_validator/src/main/ets/pages/ArkUI/LongPressGesture.ets
+2
-2
validator/acts_validator/src/main/ets/pages/ArkUI/PanGesture.ets
...or/acts_validator/src/main/ets/pages/ArkUI/PanGesture.ets
+4
-4
validator/acts_validator/src/main/ets/pages/ArkUI/PinchGestureTest.ets
...s_validator/src/main/ets/pages/ArkUI/PinchGestureTest.ets
+1
-1
validator/acts_validator/src/main/ets/pages/ArkUI/RotationGestureTest.ets
...alidator/src/main/ets/pages/ArkUI/RotationGestureTest.ets
+1
-1
validator/acts_validator/src/main/ets/pages/ArkUI/ScrollListTest.ets
...cts_validator/src/main/ets/pages/ArkUI/ScrollListTest.ets
+1
-1
validator/acts_validator/src/main/ets/pages/ArkUI/SwipeGestureTest.ets
...s_validator/src/main/ets/pages/ArkUI/SwipeGestureTest.ets
+2
-2
validator/acts_validator/src/main/ets/pages/ArkUI/TapGesture.ets
...or/acts_validator/src/main/ets/pages/ArkUI/TapGesture.ets
+1
-1
validator/acts_validator/src/main/ets/pages/ArkUI/TouchMoveTest.ets
...acts_validator/src/main/ets/pages/ArkUI/TouchMoveTest.ets
+35
-39
validator/acts_validator/src/main/ets/pages/MediaLibrary/MediaLibrary_index.ets
...or/src/main/ets/pages/MediaLibrary/MediaLibrary_index.ets
+20
-24
validator/acts_validator/src/main/ets/pages/common/CanvasCustomContainer1.ets
...ator/src/main/ets/pages/common/CanvasCustomContainer1.ets
+25
-25
validator/acts_validator/src/main/ets/pages/common/CanvasCustomContainer2.ets
...ator/src/main/ets/pages/common/CanvasCustomContainer2.ets
+27
-27
validator/acts_validator/src/main/ets/pages/common/CustomContainer.ets
...s_validator/src/main/ets/pages/common/CustomContainer.ets
+27
-27
validator/acts_validator/src/main/ets/pages/common/CustomContainer2.ets
..._validator/src/main/ets/pages/common/CustomContainer2.ets
+27
-27
validator/acts_validator/src/main/ets/pages/common/CustomContainer3.ets
..._validator/src/main/ets/pages/common/CustomContainer3.ets
+27
-27
validator/acts_validator/src/main/ets/pages/common/CustomContainer4.ets
..._validator/src/main/ets/pages/common/CustomContainer4.ets
+27
-27
validator/acts_validator/src/main/ets/pages/common/CustomContainer5.ets
..._validator/src/main/ets/pages/common/CustomContainer5.ets
+27
-27
validator/acts_validator/src/main/ets/pages/common/MediaCustomContainer.ets
...idator/src/main/ets/pages/common/MediaCustomContainer.ets
+27
-27
validator/acts_validator/src/main/ets/pages/index.ets
validator/acts_validator/src/main/ets/pages/index.ets
+2
-2
validator/acts_validator/src/main/ets/pages/model/FirstDialog.ets
...r/acts_validator/src/main/ets/pages/model/FirstDialog.ets
+5
-5
validator/acts_validator/src/main/ets/pages/model/Logger.ts
validator/acts_validator/src/main/ets/pages/model/Logger.ts
+11
-11
未找到文件。
validator/acts_validator/src/main/ets/pages/ArkUI/ArkUI_index.ets
浏览文件 @
bc3828c4
...
@@ -27,11 +27,11 @@ path1 = path + '/report1';
...
@@ -27,11 +27,11 @@ path1 = path + '/report1';
@Entry
@Entry
@Component
@Component
struct IndexPage {
struct IndexPage {
@State BackColor: string = '#ff808080'
@State BackColor: string = '#ff808080'
;
@State ClearAll : boolean = false
@State ClearAll : boolean = false
;
private current : number = undefined
private current : number = undefined
;
@State count : number = 0
@State count : number = 0
;
@State result : string = ''
@State result : string = ''
;
private TestCaseList = [
private TestCaseList = [
{title:'Scroll List',uri:'pages/ArkUI/ScrollListTest'},
{title:'Scroll List',uri:'pages/ArkUI/ScrollListTest'},
{title:'TouchMove',uri:'pages/ArkUI/TouchMoveTest'},
{title:'TouchMove',uri:'pages/ArkUI/TouchMoveTest'},
...
@@ -57,7 +57,6 @@ struct IndexPage {
...
@@ -57,7 +57,6 @@ struct IndexPage {
{title:'CanvasShadowOffsetX',uri:'pages/ArkUI/CanvasShadowOffsetX'},
{title:'CanvasShadowOffsetX',uri:'pages/ArkUI/CanvasShadowOffsetX'},
{title:'CanvasShadowOffsetY',uri:'pages/ArkUI/CanvasShadowOffsetY'},
{title:'CanvasShadowOffsetY',uri:'pages/ArkUI/CanvasShadowOffsetY'},
{title:'CanvasImageSmoothingEnabled',uri:'pages/ArkUI/CanvasImageSmoothingEnabled'},
{title:'CanvasImageSmoothingEnabled',uri:'pages/ArkUI/CanvasImageSmoothingEnabled'},
// {title:'',uri:'',bgc:Color.Black},
]
]
@State ColorObject : string[] = ['#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080',
@State ColorObject : string[] = ['#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080',
'#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080',
'#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080',
...
@@ -74,10 +73,10 @@ struct IndexPage {
...
@@ -74,10 +73,10 @@ struct IndexPage {
}
}
else if (this.result === 'Fail'){
else if (this.result === 'Fail'){
this.ColorObject[this.current] = '#ffff0000';
this.ColorObject[this.current] = '#ffff0000';
filewrite(name1,results,titles)
filewrite(name1,results,titles)
;
}
}
else if (this.result === 'None'){
else if (this.result === 'None'){
this.ColorObject[this.current] = this.ColorObject[this.current]
this.ColorObject[this.current] = this.ColorObject[this.current]
;
}
}
}
}
...
@@ -89,7 +88,7 @@ struct IndexPage {
...
@@ -89,7 +88,7 @@ struct IndexPage {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black)
}.backgroundColor(Color.Black)
.onClick(() => {
.onClick(() => {
router.back()
router.back()
;
})
})
Row(){
Row(){
Text('ArkUI SubSystem')
Text('ArkUI SubSystem')
...
@@ -105,12 +104,12 @@ struct IndexPage {
...
@@ -105,12 +104,12 @@ struct IndexPage {
.onClick(() => {
.onClick(() => {
this.ClearAll = true;
this.ClearAll = true;
this.ColorObject.forEach((value, index) => {
this.ColorObject.forEach((value, index) => {
this.ColorObject[index] = '#ff808080'
this.ColorObject[index] = '#ff808080'
;
});
});
this.ClearText();
this.ClearText();
prompt.showToast({
prompt.showToast({
message: '结果已删除', duration: 1000
message: '结果已删除', duration: 1000
})
})
;
})
})
Button(){
Button(){
Image($r('app.media.ic_public_save'))
Image($r('app.media.ic_public_save'))
...
@@ -134,9 +133,9 @@ struct IndexPage {
...
@@ -134,9 +133,9 @@ struct IndexPage {
Text(this.BackColor.toString()).visibility(Visibility.None)
Text(this.BackColor.toString()).visibility(Visibility.None)
}.width('100%').height(50).alignItems(VerticalAlign.Center).backgroundColor(this.ColorObject[index])
}.width('100%').height(50).alignItems(VerticalAlign.Center).backgroundColor(this.ColorObject[index])
.onClick(( )=>{
.onClick(( )=>{
this.count = 1
this.count = 1
;
this.ClearAll=false
this.ClearAll=false
;
this.current = index
this.current = index
;
router.push({
router.push({
url: item.uri,
url: item.uri,
})
})
...
@@ -199,7 +198,7 @@ struct IndexPage {
...
@@ -199,7 +198,7 @@ struct IndexPage {
}finally{
}finally{
fileIO.closeSync(xmlfd);
fileIO.closeSync(xmlfd);
}
}
return
return
;
}
}
}
}
}
}
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasFillStyle.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer1'
import {CustomContainer} from '../common/CanvasCustomContainer1'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -31,24 +31,24 @@ struct SetCircle {
...
@@ -31,24 +31,24 @@ struct SetCircle {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Red').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('Red').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(100, 160, 150, 100)
this.context.clearRect(100, 160, 150, 100)
;
this.FillColor = '#FFFF0000'
this.FillColor = '#FFFF0000'
;
this.context.fillStyle = this.FillColor
this.context.fillStyle = this.FillColor
;
this.context.fillRect(100, 160, 150, 100)
this.context.fillRect(100, 160, 150, 100)
;
})
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(100, 160, 150, 100)
this.context.clearRect(100, 160, 150, 100)
;
this.FillColor = '#fffffc3c'
this.FillColor = '#fffffc3c'
;
this.context.fillStyle = this.FillColor
this.context.fillStyle = this.FillColor
;
this.context.fillRect(100, 160, 150, 100)
this.context.fillRect(100, 160, 150, 100)
;
})
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(100, 160, 150, 100)
this.context.clearRect(100, 160, 150, 100)
;
this.FillColor = '#ff19fa00'
this.FillColor = '#ff19fa00'
;
this.context.fillStyle = this.FillColor
this.context.fillStyle = this.FillColor
;
this.context.fillRect(100, 160, 150, 100)
this.context.fillRect(100, 160, 150, 100)
;
})
})
}.width('70%').height('30%')
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
@@ -57,8 +57,8 @@ struct SetCircle {
...
@@ -57,8 +57,8 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.fillStyle = this.FillColor
this.context.fillStyle = this.FillColor
;
this.context.fillRect(100, 160, 150, 100)
this.context.fillRect(100, 160, 150, 100)
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasFont.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer1'
import {CustomContainer} from '../common/CanvasCustomContainer1'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -33,156 +33,150 @@ struct SetCircle {
...
@@ -33,156 +33,150 @@ struct SetCircle {
}
}
Row({space:10}){
Row({space:10}){
Text('font-style').fontSize(13).border({width:0}).size({width:'24%',height:'18%'})
Text('font-style').fontSize(13).border({width:0}).size({width:'24%',height:'18%'})
Text('normal').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
Text('normal').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal normal 120px sans-serif'
this.context.font = 'normal normal 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('italic').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
Text('italic').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'italic normal 120px sans-serif'
this.context.font = 'italic normal 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
}
}
Row({space:8}) {
Row({space:8}) {
Text('font-weight').fontSize(13).border({ width: 0 }).size({ width: '24%', height: '18%' })
Text('font-weight').fontSize(13).border({ width: 0 }).size({ width: '24%', height: '18%' })
Text('normal').fontSize(13).border({ width: 2 }).size({ width: '16%', height: '18%' })
Text('normal').fontSize(13).border({ width: 2 }).size({ width: '16%', height: '18%' })
.onClick(() => {
.onClick(() => {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal normal 120px sans-serif'
this.context.font = 'normal normal 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('bold').fontSize(13).border({width:2}).size({width:'16%',height:'18%'})
Text('bold').fontSize(13).border({width:2}).size({width:'16%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal bold 120px sans-serif'
this.context.font = 'normal bold 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('bolder').fontSize(13).border({width:2}).size({width:'16%',height:'18%'})
Text('bolder').fontSize(13).border({width:2}).size({width:'16%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal bolder 120px sans-serif'
this.context.font = 'normal bolder 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('lighter').fontSize(13).border({width:2}).size({width:'16%',height:'18%'})
Text('lighter').fontSize(13).border({width:2}).size({width:'16%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal lighter 120px sans-serif'
this.context.font = 'normal lighter 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
}
}
Row({space:5}) {
Row({space:5}) {
Text('100').fontSize(13).border({ width: 2 }).size({ width: '10%', height: '18%' })
Text('100').fontSize(13).border({ width: 2 }).size({ width: '10%', height: '18%' })
.onClick(() => {
.onClick(() => {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal 100 120px sans-serif'
this.context.font = 'normal 100 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('200').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
Text('200').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal 200 120px sans-serif'
this.context.font = 'normal 200 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('300').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
Text('300').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal 300 120px sans-serif'
this.context.font = 'normal 300 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('400').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
Text('400').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal 400 120px sans-serif'
this.context.font = 'normal 400 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('500').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
Text('500').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal 500 120px sans-serif'
this.context.font = 'normal 500 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('600').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
Text('600').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal 600 120px sans-serif'
this.context.font = 'normal 600 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('700').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
Text('700').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal 700 120px sans-serif'
this.context.font = 'normal 700 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('800').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
Text('800').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal 800 120px sans-serif'
this.context.font = 'normal 800 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('900').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
Text('900').fontSize(13).border({width:2}).size({width:'10%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal 900 120px sans-serif'
this.context.font = 'normal 900 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
}
}
Row({space:10}){
Row({space:10}){
Text('font-family').fontSize(13).border({width:0}).size({width:'24%',height:'18%'})
Text('font-family').fontSize(13).border({width:0}).size({width:'24%',height:'18%'})
Text('sans-serif').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
Text('sans-serif').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal normal 120px sans-serif'
this.context.font = 'normal normal 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('serif').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
Text('serif').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal normal 120px serif'
this.context.font = 'normal normal 120px serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('monospace').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
Text('monospace').fontSize(13).border({width:2}).size({width:'24%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal normal 120px monospace'
this.context.font = 'normal normal 120px monospace'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
}
}
Row({space:10}) {
Row({space:10}) {
Text('font-size').fontSize(13).border({ width: 0 }).size({ width: '18%', height: '18%' })
Text('font-size').fontSize(13).border({ width: 0 }).size({ width: '18%', height: '18%' })
Text('small').fontSize(13).border({ width: 2 }).size({ width: '18%', height: '18%' })
Text('small').fontSize(13).border({ width: 2 }).size({ width: '18%', height: '18%' })
.onClick(() => {
.onClick(() => {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal normal 10px sans-serif'
this.context.font = 'normal normal 10px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('medium').fontSize(13).border({width:2}).size({width:'18%',height:'18%'})
Text('medium').fontSize(13).border({width:2}).size({width:'18%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal normal 50px sans-serif'
this.context.font = 'normal normal 50px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('large').fontSize(13).border({width:2}).size({width:'18%',height:'18%'})
Text('large').fontSize(13).border({width:2}).size({width:'18%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal normal 80px sans-serif'
this.context.font = 'normal normal 80px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
Text('extra').fontSize(13).border({width:2}).size({width:'18%',height:'18%'})
Text('extra').fontSize(13).border({width:2}).size({width:'18%',height:'18%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.font = 'normal normal 120px sans-serif'
this.context.font = 'normal normal 120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
}
}
}.width('90%').height('30%')
}.width('90%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
Canvas(this.context)
...
@@ -190,8 +184,8 @@ struct SetCircle {
...
@@ -190,8 +184,8 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.font = '120px sans-serif'
this.context.font = '120px sans-serif'
;
this.context.fillText("Hello World", 80, 120)
this.context.fillText("Hello World", 80, 120)
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasGlobalAlpha.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer2'
import {CustomContainer} from '../common/CanvasCustomContainer2'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -35,14 +35,14 @@ struct SetCircle {
...
@@ -35,14 +35,14 @@ struct SetCircle {
.gesture(
.gesture(
PanGesture({})
PanGesture({})
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent) => {
this.context.clearRect(100, 100, 250, 200)
this.context.clearRect(100, 100, 250, 200)
;
console.info('Pan start')
console.info('Pan start')
;
})
})
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.X = event.offsetX
this.X = event.offsetX
;
})
})
.onActionEnd(() => {
.onActionEnd(() => {
console.info('Pan end')
console.info('Pan end')
;
})
})
)
)
Text('透明度: ' + (this.X)*0.005 )
Text('透明度: ' + (this.X)*0.005 )
...
@@ -53,11 +53,11 @@ struct SetCircle {
...
@@ -53,11 +53,11 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalAlpha = (this.X)*0.005
this.context.globalAlpha = (this.X)*0.005
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(200, 200, 50, 50)
this.context.fillRect(200, 200, 50, 50)
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasGlobalCompositeOperation.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer1'
import {CustomContainer} from '../common/CanvasCustomContainer1'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -34,106 +34,106 @@ struct SetCircle {
...
@@ -34,106 +34,106 @@ struct SetCircle {
Row({space:10}){
Row({space:10}){
Text('s-over').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('s-over').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'source-over'
this.context.globalCompositeOperation = 'source-over'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
Text('s-atop').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('s-atop').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'source-atop'
this.context.globalCompositeOperation = 'source-atop'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
Text('s-in').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('s-in').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'source-in'
this.context.globalCompositeOperation = 'source-in'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
Text('s-out').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('s-out').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'source-out'
this.context.globalCompositeOperation = 'source-out'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
}
}
Row({space:10}){
Row({space:10}){
Text('d-over').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('d-over').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
.onClick(()=> {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'destination-over'
this.context.globalCompositeOperation = 'destination-over'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
Text('d-atop').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('d-atop').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
.onClick(()=> {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'destination-atop'
this.context.globalCompositeOperation = 'destination-atop'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
Text('d-in').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('d-in').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
.onClick(()=> {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'destination-in'
this.context.globalCompositeOperation = 'destination-in'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
Text('d-out').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('d-out').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
.onClick(()=> {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'destination-out'
this.context.globalCompositeOperation = 'destination-out'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
}
}
Row({space:10}){
Row({space:10}){
Text('lighter').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('lighter').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
.onClick(()=> {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'lighter'
this.context.globalCompositeOperation = 'lighter'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
Text('copy').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('copy').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
.onClick(()=> {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'copy'
this.context.globalCompositeOperation = 'copy'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
Text('xor').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('xor').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
.onClick(()=> {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'xor'
this.context.globalCompositeOperation = 'xor'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
Text('').fontSize(0).border({width:0}).size({width:'18%',height:'20%'})
Text('').fontSize(0).border({width:0}).size({width:'18%',height:'20%'})
}
}
...
@@ -144,11 +144,11 @@ struct SetCircle {
...
@@ -144,11 +144,11 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 50, 50)
this.context.fillRect(150, 150, 50, 50)
;
this.context.globalCompositeOperation = 'source-over'
this.context.globalCompositeOperation = 'source-over'
;
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillStyle = 'rgb(0,0,255)'
;
this.context.fillRect(180, 180, 50, 50)
this.context.fillRect(180, 180, 50, 50)
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasImageSmoothingEnabled.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer2'
import {CustomContainer} from '../common/CanvasCustomContainer2'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -32,15 +32,15 @@ struct SetCircle {
...
@@ -32,15 +32,15 @@ struct SetCircle {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('True').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('True').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300)
this.context.clearRect(10, 100, 400, 300)
;
this.context.imageSmoothingEnabled = true
this.context.imageSmoothingEnabled = true
;
this.context.drawImage( this.img,0,0,400,200)
this.context.drawImage( this.img,0,0,400,200)
;
})
})
Text('False').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('False').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300)
this.context.clearRect(10, 100, 400, 300)
;
this.context.imageSmoothingEnabled = false
this.context.imageSmoothingEnabled = false
;
this.context.drawImage( this.img,0,0,400,200)
this.context.drawImage( this.img,0,0,400,200)
;
})
})
}.width('70%').height('30%')
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
@@ -49,8 +49,8 @@ struct SetCircle {
...
@@ -49,8 +49,8 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.imageSmoothingEnabled = false
this.context.imageSmoothingEnabled = false
;
this.context.drawImage( this.img,0,0,200,200)
this.context.drawImage( this.img,0,0,200,200)
;
})
})
}.width('100%').height('60%')
}.width('100%').height('60%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineCap.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer1'
import {CustomContainer} from '../common/CanvasCustomContainer1'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -30,33 +30,33 @@ struct SetCircle {
...
@@ -30,33 +30,33 @@ struct SetCircle {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('butt').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('butt').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120)
this.context.clearRect(90, 90, 170, 120)
;
this.context.lineWidth = 8
this.context.lineWidth = 8
;
this.context.beginPath()
this.context.beginPath()
;
this.context.lineCap = 'butt'
this.context.lineCap = 'butt'
;
this.context.moveTo(100, 100)
this.context.moveTo(100, 100)
;
this.context.lineTo(250, 100)
this.context.lineTo(250, 100)
;
this.context.stroke()
this.context.stroke()
;
})
})
Text('round').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('round').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120)
this.context.clearRect(90, 90, 170, 120)
;
this.context.lineWidth = 8
this.context.lineWidth = 8
;
this.context.beginPath()
this.context.beginPath()
;
this.context.lineCap = 'round'
this.context.lineCap = 'round'
;
this.context.moveTo(100, 100)
this.context.moveTo(100, 100)
;
this.context.lineTo(250, 100)
this.context.lineTo(250, 100)
;
this.context.stroke()
this.context.stroke()
;
})
})
Text('square').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('square').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120)
this.context.clearRect(90, 90, 170, 120)
;
this.context.lineWidth = 8
this.context.lineWidth = 8
;
this.context.beginPath()
this.context.beginPath()
;
this.context.lineCap = 'square'
this.context.lineCap = 'square'
;
this.context.moveTo(100, 100)
this.context.moveTo(100, 100)
;
this.context.lineTo(250, 100)
this.context.lineTo(250, 100)
;
this.context.stroke()
this.context.stroke()
;
})
})
}.width('70%').height('30%')
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
@@ -65,12 +65,12 @@ struct SetCircle {
...
@@ -65,12 +65,12 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.lineWidth = 8
this.context.lineWidth = 8
;
this.context.beginPath()
this.context.beginPath()
;
this.context.lineCap = 'round'
this.context.lineCap = 'round'
;
this.context.moveTo(100, 100)
this.context.moveTo(100, 100)
;
this.context.lineTo(250, 100)
this.context.lineTo(250, 100)
;
this.context.stroke()
this.context.stroke()
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineDashOffset.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer2'
import {CustomContainer} from '../common/CanvasCustomContainer2'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -34,14 +34,14 @@ struct SetCircle {
...
@@ -34,14 +34,14 @@ struct SetCircle {
.gesture(
.gesture(
PanGesture({})
PanGesture({})
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent) => {
this.context.clearRect(100, 100, 250, 200)
this.context.clearRect(100, 100, 250, 200)
;
console.info('Pan start')
console.info('Pan start')
;
})
})
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.X = event.offsetX
this.X = event.offsetX
;
})
})
.onActionEnd(() => {
.onActionEnd(() => {
console.info('Pan end')
console.info('Pan end')
;
})
})
)
)
Text('虚线偏移量: ' + (this.X)*0.1 )
Text('虚线偏移量: ' + (this.X)*0.1 )
...
@@ -52,8 +52,8 @@ struct SetCircle {
...
@@ -52,8 +52,8 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.arc(180, 150, 50, 0, 6.28)
this.context.arc(180, 150, 50, 0, 6.28)
;
this.context.setLineDash([20,30])
this.context.setLineDash([20,30])
;
this.context.lineDashOffset = (this.X)*0.1;
this.context.lineDashOffset = (this.X)*0.1;
this.context.stroke();
this.context.stroke();
})
})
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineJoin.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer1'
import {CustomContainer} from '../common/CanvasCustomContainer1'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -30,36 +30,36 @@ struct SetCircle {
...
@@ -30,36 +30,36 @@ struct SetCircle {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('round').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('round').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120)
this.context.clearRect(90, 90, 170, 120)
;
this.context.beginPath()
this.context.beginPath()
;
this.context.lineWidth = 8
this.context.lineWidth = 8
;
this.context.lineJoin = 'round'
this.context.lineJoin = 'round'
;
this.context.moveTo(120, 100)
this.context.moveTo(120, 100)
;
this.context.lineTo(210, 130)
this.context.lineTo(210, 130)
;
this.context.lineTo(120, 180)
this.context.lineTo(120, 180)
;
this.context.stroke()
this.context.stroke()
;
})
})
Text('bevel').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('bevel').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120)
this.context.clearRect(90, 90, 170, 120)
;
this.context.beginPath()
this.context.beginPath()
;
this.context.lineWidth = 8
this.context.lineWidth = 8
;
this.context.lineJoin = 'bevel'
this.context.lineJoin = 'bevel'
;
this.context.moveTo(120, 100)
this.context.moveTo(120, 100)
;
this.context.lineTo(210, 130)
this.context.lineTo(210, 130)
;
this.context.lineTo(120, 180)
this.context.lineTo(120, 180)
;
this.context.stroke()
this.context.stroke()
;
})
})
Text('miter').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('miter').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(90, 90, 170, 120)
this.context.clearRect(90, 90, 170, 120)
;
this.context.beginPath()
this.context.beginPath()
;
this.context.lineWidth = 8
this.context.lineWidth = 8
;
this.context.lineJoin = 'miter'
this.context.lineJoin = 'miter'
;
this.context.moveTo(120, 100)
this.context.moveTo(120, 100)
;
this.context.lineTo(210, 130)
this.context.lineTo(210, 130)
;
this.context.lineTo(120, 180)
this.context.lineTo(120, 180)
;
this.context.stroke()
this.context.stroke()
;
})
})
}.width('70%').height('30%')
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
@@ -68,13 +68,13 @@ struct SetCircle {
...
@@ -68,13 +68,13 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.beginPath()
this.context.beginPath()
;
this.context.lineWidth = 8
this.context.lineWidth = 8
;
this.context.lineJoin = 'miter'
this.context.lineJoin = 'miter'
;
this.context.moveTo(120, 100)
this.context.moveTo(120, 100)
;
this.context.lineTo(210, 130)
this.context.lineTo(210, 130)
;
this.context.lineTo(120, 180)
this.context.lineTo(120, 180)
;
this.context.stroke()
this.context.stroke()
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasLineWidth.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer2'
import {CustomContainer} from '../common/CanvasCustomContainer2'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -34,14 +34,14 @@ struct SetCircle {
...
@@ -34,14 +34,14 @@ struct SetCircle {
.gesture(
.gesture(
PanGesture({})
PanGesture({})
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent) => {
this.context.clearRect(100, 100, 250, 200)
this.context.clearRect(100, 100, 250, 200)
;
console.info('Pan start')
console.info('Pan start')
;
})
})
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.X = event.offsetX
this.X = event.offsetX
;
})
})
.onActionEnd(() => {
.onActionEnd(() => {
console.info('Pan end')
console.info('Pan end')
;
})
})
)
)
Text('边框粗细: ' + (this.X)*0.05 )
Text('边框粗细: ' + (this.X)*0.05 )
...
@@ -52,8 +52,8 @@ struct SetCircle {
...
@@ -52,8 +52,8 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.lineWidth = (this.X)*0.05
this.context.lineWidth = (this.X)*0.05
;
this.context.strokeRect(120, 120, 120, 120)
this.context.strokeRect(120, 120, 120, 120)
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasMiterLimit.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer2'
import {CustomContainer} from '../common/CanvasCustomContainer2'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -34,14 +34,14 @@ struct SetCircle {
...
@@ -34,14 +34,14 @@ struct SetCircle {
.gesture(
.gesture(
PanGesture({})
PanGesture({})
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent) => {
this.context.clearRect(100, 100, 250, 200)
this.context.clearRect(100, 100, 250, 200)
;
console.info('Pan start')
console.info('Pan start')
;
})
})
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.X = event.offsetX
this.X = event.offsetX
;
})
})
.onActionEnd(() => {
.onActionEnd(() => {
console.info('Pan end')
console.info('Pan end')
;
})
})
)
)
Text('边框粗细: ' + (this.X)*0.05 )
Text('边框粗细: ' + (this.X)*0.05 )
...
@@ -52,13 +52,13 @@ struct SetCircle {
...
@@ -52,13 +52,13 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.lineWidth = 8
this.context.lineWidth = 8
;
this.context.lineJoin = 'miter'
this.context.lineJoin = 'miter'
;
this.context.miterLimit = (this.X)*0.05
this.context.miterLimit = (this.X)*0.05
;
this.context.moveTo(160, 100)
this.context.moveTo(160, 100)
;
this.context.lineTo(190, 105)
this.context.lineTo(190, 105)
;
this.context.lineTo(160, 107)
this.context.lineTo(160, 107)
;
this.context.stroke()
this.context.stroke()
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowBlur.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer2'
import {CustomContainer} from '../common/CanvasCustomContainer2'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -34,16 +34,16 @@ struct SetCircle {
...
@@ -34,16 +34,16 @@ struct SetCircle {
.gesture(
.gesture(
PanGesture({})
PanGesture({})
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent) => {
this.context.clearRect(10, 50, 400, 300)
this.context.clearRect(10, 50, 400, 300)
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 100, 100)
this.context.fillRect(150, 150, 100, 100)
;
console.info('Pan start')
console.info('Pan start')
;
})
})
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.X = event.offsetX
this.X = event.offsetX
;
})
})
.onActionEnd(() => {
.onActionEnd(() => {
console.info('Pan end')
console.info('Pan end')
;
})
})
)
)
Text('阴影模糊: ' + this.X )
Text('阴影模糊: ' + this.X )
...
@@ -54,10 +54,10 @@ struct SetCircle {
...
@@ -54,10 +54,10 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.shadowBlur = this.X
this.context.shadowBlur = this.X
;
this.context.shadowColor = 'rgb(0,0,0)'
this.context.shadowColor = 'rgb(0,0,0)'
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 100, 100)
this.context.fillRect(150, 150, 100, 100)
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowColor.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer2'
import {CustomContainer} from '../common/CanvasCustomContainer2'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -31,41 +31,39 @@ struct SetCircle {
...
@@ -31,41 +31,39 @@ struct SetCircle {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Blue').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('Blue').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300)
this.context.clearRect(10, 100, 400, 300)
;
this.context.shadowBlur = 30
this.context.shadowBlur = 30
;
this.context.shadowColor = 'rgb(0,0,255)'
this.context.shadowColor = 'rgb(0,0,255)'
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 100, 100)
this.context.fillRect(150, 150, 100, 100)
;
})
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300)
this.context.clearRect(10, 100, 400, 300)
;
this.context.shadowBlur = 30
this.context.shadowBlur = 30
;
this.context.shadowColor = '#fffffc3c'
this.context.shadowColor = '#fffffc3c'
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 100, 100)
this.context.fillRect(150, 150, 100, 100)
;
})
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(10, 100, 400, 300)
this.context.clearRect(10, 100, 400, 300)
;
this.context.shadowBlur = 30
this.context.shadowBlur = 30
;
this.context.shadowColor = '#ff19fa00'
this.context.shadowColor = '#ff19fa00'
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 100, 100)
this.context.fillRect(150, 150, 100, 100)
;
})
})
}.width('70%').height('30%')
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Canvas(this.context)
Canvas(this.context)
.width('100%')
.width('100%')
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.shadowBlur = 30
this.context.shadowBlur = 30
;
this.context.shadowColor = 'rgb(0,0,255)'
this.context.shadowColor = 'rgb(0,0,255)'
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 100, 100)
this.context.fillRect(150, 150, 100, 100)
;
})
})
}.width('100%').height('60%')
}.width('100%').height('60%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowOffsetX.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer2'
import {CustomContainer} from '../common/CanvasCustomContainer2'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -34,17 +34,17 @@ struct SetCircle {
...
@@ -34,17 +34,17 @@ struct SetCircle {
.gesture(
.gesture(
PanGesture({})
PanGesture({})
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent) => {
this.context.clearRect(10, 50, 400, 300)
this.context.clearRect(10, 50, 400, 300)
;
this.context.shadowColor = 'rgb(0,0,0)'
this.context.shadowColor = 'rgb(0,0,0)'
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 100, 100)
this.context.fillRect(150, 150, 100, 100)
;
console.info('Pan start')
console.info('Pan start')
;
})
})
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.X = event.offsetX
this.X = event.offsetX
;
})
})
.onActionEnd(() => {
.onActionEnd(() => {
console.info('Pan end')
console.info('Pan end')
;
})
})
)
)
Text('阴影偏移: ' + (this.X)*0.05 )
Text('阴影偏移: ' + (this.X)*0.05 )
...
@@ -55,11 +55,11 @@ struct SetCircle {
...
@@ -55,11 +55,11 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.shadowBlur = 10
this.context.shadowBlur = 10
;
this.context.shadowOffsetX = (this.X)*0.05
this.context.shadowOffsetX = (this.X)*0.05
;
this.context.shadowColor = 'rgb(0,0,0)'
this.context.shadowColor = 'rgb(0,0,0)'
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 100, 100)
this.context.fillRect(150, 150, 100, 100)
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasShadowOffsetY.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer2'
import {CustomContainer} from '../common/CanvasCustomContainer2'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -34,17 +34,17 @@ struct SetCircle {
...
@@ -34,17 +34,17 @@ struct SetCircle {
.gesture(
.gesture(
PanGesture({})
PanGesture({})
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent) => {
this.context.clearRect(10, 50, 400, 300)
this.context.clearRect(10, 50, 400, 300)
;
this.context.shadowColor = 'rgb(0,0,0)'
this.context.shadowColor = 'rgb(0,0,0)'
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 100, 100)
this.context.fillRect(150, 150, 100, 100)
;
console.info('Pan start')
console.info('Pan start')
;
})
})
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.X = event.offsetX
this.X = event.offsetX
;
})
})
.onActionEnd(() => {
.onActionEnd(() => {
console.info('Pan end')
console.info('Pan end')
;
})
})
)
)
Text('阴影偏移: ' + (this.X)*0.05 )
Text('阴影偏移: ' + (this.X)*0.05 )
...
@@ -55,11 +55,11 @@ struct SetCircle {
...
@@ -55,11 +55,11 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.shadowBlur = 10
this.context.shadowBlur = 10
;
this.context.shadowOffsetY = (this.X)*0.05
this.context.shadowOffsetY = (this.X)*0.05
;
this.context.shadowColor = 'rgb(0,0,0)'
this.context.shadowColor = 'rgb(0,0,0)'
;
this.context.fillStyle = 'rgb(255,0,0)'
this.context.fillStyle = 'rgb(255,0,0)'
;
this.context.fillRect(150, 150, 100, 100)
this.context.fillRect(150, 150, 100, 100)
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasStrokeStyle.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer1'
import {CustomContainer} from '../common/CanvasCustomContainer1'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -30,27 +30,27 @@ struct SetCircle {
...
@@ -30,27 +30,27 @@ struct SetCircle {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Red').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('Red').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(90, 150, 170, 120)
this.context.clearRect(90, 150, 170, 120)
;
this.FillColor = '#FFFF0000'
this.FillColor = '#FFFF0000'
;
this.context.lineWidth = 10
this.context.lineWidth = 10
;
this.context.strokeStyle = '#FFFF0000'
this.context.strokeStyle = '#FFFF0000'
;
this.context.strokeRect(100, 160, 150, 100)
this.context.strokeRect(100, 160, 150, 100)
;
})
})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('Yellow').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(90, 150, 170, 120)
this.context.clearRect(90, 150, 170, 120)
;
this.FillColor = '#fffffc3c'
this.FillColor = '#fffffc3c'
;
this.context.lineWidth = 10
this.context.lineWidth = 10
;
this.context.strokeStyle = '#fffffc3c'
this.context.strokeStyle = '#fffffc3c'
;
this.context.strokeRect(100, 160, 150, 100)
this.context.strokeRect(100, 160, 150, 100)
;
})
})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
Text('Green').fontSize(16).border({width:2}).size({width:'25%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(90, 150, 170, 120)
this.context.clearRect(90, 150, 170, 120)
;
this.FillColor = '#ff19fa00'
this.FillColor = '#ff19fa00'
;
this.context.lineWidth = 10
this.context.lineWidth = 10
;
this.context.strokeStyle = '#ff19fa00'
this.context.strokeStyle = '#ff19fa00'
;
this.context.strokeRect(100, 160, 150, 100)
this.context.strokeRect(100, 160, 150, 100)
;
})
})
}.width('70%').height('30%')
}.width('70%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
@@ -59,9 +59,9 @@ struct SetCircle {
...
@@ -59,9 +59,9 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.lineWidth = 10
this.context.lineWidth = 10
;
this.context.strokeStyle = this.FillColor
this.context.strokeStyle = this.FillColor
;
this.context.strokeRect(100, 160, 150, 100)
this.context.strokeRect(100, 160, 150, 100)
;
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasTextAlign.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer1'
import {CustomContainer} from '../common/CanvasCustomContainer1'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -30,53 +30,53 @@ struct SetCircle {
...
@@ -30,53 +30,53 @@ struct SetCircle {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('start').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('start').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.lineWidth = 2
this.context.lineWidth = 2
;
this.context.moveTo(180, 10)
this.context.moveTo(180, 10)
;
this.context.lineTo(180, 310)
this.context.lineTo(180, 310)
;
this.context.stroke()
this.context.stroke()
;
this.context.textAlign = 'start'
this.context.textAlign = 'start'
;
this.context.fillText('textAlign=start', 180, 160)
this.context.fillText('textAlign=start', 180, 160)
;
})
})
Text('end').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('end').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.lineWidth = 2
this.context.lineWidth = 2
;
this.context.moveTo(180, 10)
this.context.moveTo(180, 10)
;
this.context.lineTo(180, 310)
this.context.lineTo(180, 310)
;
this.context.stroke()
this.context.stroke()
;
this.context.textAlign = 'end'
this.context.textAlign = 'end'
;
this.context.fillText('textAlign=end', 180, 160)
this.context.fillText('textAlign=end', 180, 160)
;
})
})
Text('left').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('left').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.lineWidth = 2
this.context.lineWidth = 2
;
this.context.moveTo(180, 10)
this.context.moveTo(180, 10)
;
this.context.lineTo(180, 310)
this.context.lineTo(180, 310)
;
this.context.stroke()
this.context.stroke()
;
this.context.textAlign = 'left'
this.context.textAlign = 'left'
;
this.context.fillText('textAlign=left', 180, 160)
this.context.fillText('textAlign=left', 180, 160)
;
})
})
Text('center').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('center').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.lineWidth = 2
this.context.lineWidth = 2
;
this.context.moveTo(180, 10)
this.context.moveTo(180, 10)
;
this.context.lineTo(180, 310)
this.context.lineTo(180, 310)
;
this.context.stroke()
this.context.stroke()
;
this.context.textAlign = 'center'
this.context.textAlign = 'center'
;
this.context.fillText('textAlign=center', 180, 160)
this.context.fillText('textAlign=center', 180, 160)
;
})
})
Text('right').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('right').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
.onClick(()=> {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.lineWidth = 2
this.context.lineWidth = 2
;
this.context.moveTo(180, 10)
this.context.moveTo(180, 10)
;
this.context.lineTo(180, 310)
this.context.lineTo(180, 310)
;
this.context.stroke()
this.context.stroke()
;
this.context.textAlign = 'right'
this.context.textAlign = 'right'
;
this.context.fillText('textAlign=right', 180, 160)
this.context.fillText('textAlign=right', 180, 160)
;
})
})
}.width('90%').height('30%')
}.width('90%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
@@ -85,15 +85,13 @@ struct SetCircle {
...
@@ -85,15 +85,13 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.lineWidth = 2
this.context.lineWidth = 2;
this.context.moveTo(180, 10)
this.context.moveTo(180, 10);
this.context.lineTo(180, 310)
this.context.lineTo(180, 310);
this.context.stroke()
this.context.stroke();
this.context.font = '60px sans-serif';
this.context.font = '60px sans-serif'
this.context.textAlign = 'start';
this.context.fillText('textAlign=start', 180, 160);
this.context.textAlign = 'start'
this.context.fillText('textAlign=start', 180, 160)
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/CanvasTextBaseline.ets
浏览文件 @
bc3828c4
...
@@ -12,8 +12,8 @@
...
@@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import {CustomContainer} from '../common/CanvasCustomContainer1'
import {CustomContainer} from '../common/CanvasCustomContainer1'
;
import FirstDialog from '../model/FirstDialog'
import FirstDialog from '../model/FirstDialog'
;
@Entry
@Entry
@Component
@Component
struct SetCircle {
struct SetCircle {
...
@@ -30,58 +30,58 @@ struct SetCircle {
...
@@ -30,58 +30,58 @@ struct SetCircle {
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Text('Top').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('Top').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.strokeStyle = '#0000ff'
this.context.strokeStyle = '#0000ff'
;
this.context.lineWidth = 2
this.context.lineWidth = 2
;
this.context.moveTo(0, 120)
this.context.moveTo(0, 120)
;
this.context.lineTo(400, 120)
this.context.lineTo(400, 120)
;
this.context.stroke()
this.context.stroke()
;
this.context.textBaseline = 'top'
this.context.textBaseline = 'top'
;
this.context.fillText('Top', 160, 120)
this.context.fillText('Top', 160, 120)
;
})
})
Text('Bottom').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('Bottom').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.strokeStyle = '#0000ff'
this.context.strokeStyle = '#0000ff'
;
this.context.lineWidth = 2
this.context.lineWidth = 2
;
this.context.moveTo(0, 120)
this.context.moveTo(0, 120)
;
this.context.lineTo(400, 120)
this.context.lineTo(400, 120)
;
this.context.stroke()
this.context.stroke()
;
this.context.textBaseline = 'bottom'
this.context.textBaseline = 'bottom'
;
this.context.fillText('Bottom', 160, 120)
this.context.fillText('Bottom', 160, 120)
;
})
})
Text('Middle').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('Middle').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.strokeStyle = '#0000ff'
this.context.strokeStyle = '#0000ff'
;
this.context.lineWidth = 2
this.context.lineWidth = 2
;
this.context.moveTo(0, 120)
this.context.moveTo(0, 120)
;
this.context.lineTo(400, 120)
this.context.lineTo(400, 120)
;
this.context.stroke()
this.context.stroke()
;
this.context.textBaseline = 'middle'
this.context.textBaseline = 'middle'
;
this.context.fillText('Middle', 160, 120)
this.context.fillText('Middle', 160, 120)
;
})
})
Text('Alphabetic').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('Alphabetic').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=>{
.onClick(()=>{
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.strokeStyle = '#0000ff'
this.context.strokeStyle = '#0000ff'
;
this.context.lineWidth = 2
this.context.lineWidth = 2
;
this.context.moveTo(0, 120)
this.context.moveTo(0, 120)
;
this.context.lineTo(400, 120)
this.context.lineTo(400, 120)
;
this.context.stroke()
this.context.stroke()
;
this.context.textBaseline = 'alphabetic'
this.context.textBaseline = 'alphabetic'
;
this.context.fillText('Alphabetic', 160, 120)
this.context.fillText('Alphabetic', 160, 120)
;
})
})
Text('Hanging').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
Text('Hanging').fontSize(13).border({width:2}).size({width:'18%',height:'20%'})
.onClick(()=> {
.onClick(()=> {
this.context.clearRect(0, 10, 350, 300)
this.context.clearRect(0, 10, 350, 300)
;
this.context.strokeStyle = '#0000ff'
this.context.strokeStyle = '#0000ff'
;
this.context.lineWidth = 2
this.context.lineWidth = 2
;
this.context.moveTo(0, 120)
this.context.moveTo(0, 120)
;
this.context.lineTo(400, 120)
this.context.lineTo(400, 120)
;
this.context.stroke()
this.context.stroke()
;
this.context.textBaseline = 'hanging'
this.context.textBaseline = 'hanging'
;
this.context.fillText('Hanging', 160, 120)
this.context.fillText('Hanging', 160, 120)
;
})
})
}.width('90%').height('30%')
}.width('90%').height('30%')
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
...
@@ -90,16 +90,14 @@ struct SetCircle {
...
@@ -90,16 +90,14 @@ struct SetCircle {
.height('100%')
.height('100%')
.backgroundColor('#ffffffff')
.backgroundColor('#ffffffff')
.onReady(() =>{
.onReady(() =>{
this.context.strokeStyle = '#0000ff'
this.context.strokeStyle = '#0000ff';
this.context.lineWidth = 2
this.context.lineWidth = 2;
this.context.moveTo(0, 120)
this.context.moveTo(0, 120);
this.context.lineTo(400, 120)
this.context.lineTo(400, 120);
this.context.stroke()
this.context.stroke();
this.context.font = '60px sans-serif';
this.context.font = '60px sans-serif'
this.context.textBaseline = 'top';
this.context.fillText('Top', 160, 120);
this.context.textBaseline = 'top'
this.context.fillText('Top', 160, 120)
})
})
}.width('100%').height('70%')
}.width('100%').height('70%')
}.width('100%').height('80%').backgroundColor(Color.White)
}.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/LongPressGesture.ets
浏览文件 @
bc3828c4
...
@@ -33,11 +33,11 @@ struct LongPressGestureExample {
...
@@ -33,11 +33,11 @@ struct LongPressGestureExample {
LongPressGesture({ repeat: true })
LongPressGesture({ repeat: true })
.onAction((event: GestureEvent) => {
.onAction((event: GestureEvent) => {
if (event.repeat) {
if (event.repeat) {
this.X++
this.X++
;
}
}
})
})
.onActionEnd(() => {
.onActionEnd(() => {
this.X = 0
this.X = 0
;
})
})
)
)
Text('长按动作连续触发:' + this.X).fontColor(Color.Black)
Text('长按动作连续触发:' + this.X).fontColor(Color.Black)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/PanGesture.ets
浏览文件 @
bc3828c4
...
@@ -34,14 +34,14 @@ struct PanGestureExample {
...
@@ -34,14 +34,14 @@ struct PanGestureExample {
.gesture(
.gesture(
PanGesture({})
PanGesture({})
.onActionStart((event: GestureEvent) => {
.onActionStart((event: GestureEvent) => {
console.info('Pan start')
console.info('Pan start')
;
})
})
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.X = event.offsetX
this.X = event.offsetX
;
this.Y = event.offsetY
this.Y = event.offsetY
;
})
})
.onActionEnd(() => {
.onActionEnd(() => {
console.info('Pan end')
console.info('Pan end')
;
})
})
)
)
Text('偏移坐标x: ' + this.X + '\n' + '偏移坐标y: ' + this.Y)
Text('偏移坐标x: ' + this.X + '\n' + '偏移坐标y: ' + this.Y)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/PinchGestureTest.ets
浏览文件 @
bc3828c4
...
@@ -33,7 +33,7 @@ struct PinchGuestureTest {
...
@@ -33,7 +33,7 @@ struct PinchGuestureTest {
.gesture(
.gesture(
PinchGesture()
PinchGesture()
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.X = event.scale
this.X = event.scale
;
})
})
)
)
Text('捏合放缩比例:'+this.X).fontColor(Color.Black)
Text('捏合放缩比例:'+this.X).fontColor(Color.Black)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/RotationGestureTest.ets
浏览文件 @
bc3828c4
...
@@ -34,7 +34,7 @@ struct RotationGuestureTest {
...
@@ -34,7 +34,7 @@ struct RotationGuestureTest {
.gesture(
.gesture(
RotationGesture()
RotationGesture()
.onActionUpdate((event: GestureEvent) => {
.onActionUpdate((event: GestureEvent) => {
this.X = event.angle
this.X = event.angle
;
})
})
)
)
Text('旋转角度:' + this.X)
Text('旋转角度:' + this.X)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/ScrollListTest.ets
浏览文件 @
bc3828c4
...
@@ -17,7 +17,7 @@ import FirstDialog from '../model/FirstDialog';
...
@@ -17,7 +17,7 @@ import FirstDialog from '../model/FirstDialog';
@Entry
@Entry
@Component
@Component
struct CustomContainerUser {
struct CustomContainerUser {
private listArr: number[] = Array.from(new Array(50).keys())
private listArr: number[] = Array.from(new Array(50).keys())
;
@State name: string = 'ScrollingList';
@State name: string = 'ScrollingList';
@State StepTips: string = '操作步骤:滑动列表观察是否能正常滑动'+'\n'+'预期结果:列表滑动正常';
@State StepTips: string = '操作步骤:滑动列表观察是否能正常滑动'+'\n'+'预期结果:列表滑动正常';
async aboutToAppear(){
async aboutToAppear(){
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/SwipeGestureTest.ets
浏览文件 @
bc3828c4
...
@@ -34,8 +34,8 @@ struct SwipeGestureTest {
...
@@ -34,8 +34,8 @@ struct SwipeGestureTest {
.gesture(
.gesture(
SwipeGesture({fingers: 1, direction: SwipeDirection.Vertical})
SwipeGesture({fingers: 1, direction: SwipeDirection.Vertical})
.onAction((event: GestureEvent) => {
.onAction((event: GestureEvent) => {
this.Y = event.speed
this.Y = event.speed
;
this.X = event.angle
this.X = event.angle
;
})
})
)
)
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
Flex({direction:FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }){
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/TapGesture.ets
浏览文件 @
bc3828c4
...
@@ -32,7 +32,7 @@ struct TapGestureExample {
...
@@ -32,7 +32,7 @@ struct TapGestureExample {
.gesture(
.gesture(
TapGesture({ count: 2 })
TapGesture({ count: 2 })
.onAction(() => {
.onAction(() => {
this.value = 'TapGesture onAction'
this.value = 'TapGesture onAction'
;
})
})
)
)
Text(this.value)
Text(this.value)
...
...
validator/acts_validator/src/main/ets/pages/ArkUI/TouchMoveTest.ets
浏览文件 @
bc3828c4
...
@@ -20,8 +20,8 @@ import image from '@ohos.multimedia.image';
...
@@ -20,8 +20,8 @@ import image from '@ohos.multimedia.image';
import Logger from '../model/Logger'
import Logger from '../model/Logger'
import FirstDialog from '../model/FirstDialog';
import FirstDialog from '../model/FirstDialog';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
const TAG = '[Screenshot]'
const TAG = '[Screenshot]'
;
let path = globalThis.dir
let path = globalThis.dir
;
@Component
@Component
struct CustomContainer1 {
struct CustomContainer1 {
@Link x: number;
@Link x: number;
...
@@ -36,28 +36,28 @@ struct CustomContainer1 {
...
@@ -36,28 +36,28 @@ struct CustomContainer1 {
PassBtn(text: Resource, isFullScreen: boolean) {
PassBtn(text: Resource, isFullScreen: boolean) {
Button() {
Button() {
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
Image($r('app.media.ic_public_pass')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
//Pass Button
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(()=>{
.onClick(()=>{
router.back({
router.back({
url:this.Url,
url:this.Url,
params: {result : 'Pass', title : this.name,
params: {result : 'Pass', title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
@Builder
@Builder
FailBtn(text: Resource, isFullScreen: boolean) {
FailBtn(text: Resource, isFullScreen: boolean) {
Button(){
Button(){
Image($r('app.media.ic_public_fail')).width('20vp').height('20vp')
Image($r('app.media.ic_public_fail')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
//Fail Button
}.width('30%').height('30vp').backgroundColor(Color.Grey)
.onClick(()=>{
.onClick(()=>{
router.back({
router.back({
url:this.Url,
url:this.Url,
params: {result : 'Fail',title : this.name,
params: {result : 'Fail',title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
build() {
build() {
...
@@ -75,10 +75,10 @@ struct CustomContainer1 {
...
@@ -75,10 +75,10 @@ struct CustomContainer1 {
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content()
this.content()
;
Blank()
Blank()
Row() {
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true)
this.PassBtn($r('app.string.btn_fullscreen'), true)
;
Button(){
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
}.width('30%').height('30vp').backgroundColor(Color.Grey)
...
@@ -95,7 +95,7 @@ struct CustomContainer1 {
...
@@ -95,7 +95,7 @@ struct CustomContainer1 {
}
}
)
)
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true)
this.FailBtn($r('app.string.btn_fullscreen'), true)
;
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}.height('98%').width('100%')
}
}
...
@@ -103,27 +103,27 @@ struct CustomContainer1 {
...
@@ -103,27 +103,27 @@ struct CustomContainer1 {
Logger.info(TAG, `savePicture`)
Logger.info(TAG, `savePicture`)
let packOpts: image.PackingOption = {
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
format: "image/jpeg", quality: 100
}
}
;
let info = {
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
}
}
;
let name = this.name
let name = this.name
;
let displayName = `${info.prefix}${name}${info.suffix}`
let displayName = `${info.prefix}${name}${info.suffix}`
;
let dirPath = path + '/' + displayName;
let dirPath = path + '/' + displayName;
let imagePackerApi = image.createImagePacker()
let imagePackerApi = image.createImagePacker()
;
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
;
let fd = fileio.openSync(dirPath,0o102,0o666);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release()
imagePackerApi.release()
;
try {
try {
await fileio.write(fd, arrayBuffer)
await fileio.write(fd, arrayBuffer)
;
} catch (err) {
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
;
}
}
await fileio.close(fd)
await fileio.close(fd)
;
Logger.info(TAG, `write done`)
Logger.info(TAG, `write done`)
;
prompt.showToast({
prompt.showToast({
message: '图片保存成功', duration: 1000
message: '图片保存成功', duration: 1000
})
})
;
}
}
getScreen = (isFullScreen: boolean) => {
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
let screenshotOptions: screenshot.ScreenshotOptions = {
...
@@ -131,7 +131,7 @@ struct CustomContainer1 {
...
@@ -131,7 +131,7 @@ struct CustomContainer1 {
imageSize: { width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
rotation: 0,
displayId: 0
displayId: 0
}
}
;
if (isFullScreen) {
if (isFullScreen) {
screenshotOptions = {
screenshotOptions = {
rotation: 0
rotation: 0
...
@@ -140,13 +140,13 @@ struct CustomContainer1 {
...
@@ -140,13 +140,13 @@ struct CustomContainer1 {
try {
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
;
}
}
Logger.info(TAG, 'save callback')
Logger.info(TAG, 'save callback')
;
this.savePicture(data, getContext(this) as any)
this.savePicture(data, getContext(this) as any)
;
})
})
} catch (err) {
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
;
}
}
}
}
}
}
...
@@ -168,24 +168,20 @@ struct SetCircle {
...
@@ -168,24 +168,20 @@ struct SetCircle {
.width('20vp').height('20vp').position({ x: this.x, y: this.y }).visibility(this.isshow)
.width('20vp').height('20vp').position({ x: this.x, y: this.y }).visibility(this.isshow)
.fill(Color.Red)
.fill(Color.Red)
}.onTouch((event: TouchEvent) => {
}.onTouch((event: TouchEvent) => {
//console.info('11')
let x = event.touches[0].x;
// x坐标
let y = event.touches[0].y;
let x = event.touches[0].x
// y坐标
let y = event.touches[0].y
//console.info('this is ' + JSON.stringify(this))
if (event.type === TouchType.Down) {
if (event.type === TouchType.Down) {
this.x = x
this.x = x
;
this.y = y
this.y = y
;
this.isshow = Visibility.Visible
this.isshow = Visibility.Visible
;
}
}
else if (event.type === TouchType.Move) {
else if (event.type === TouchType.Move) {
this.x = x
this.x = x
;
this.y = y
this.y = y
;
this.isshow = Visibility.Visible
this.isshow = Visibility.Visible
;
}
}
else if (event.type === TouchType.Up) {
else if (event.type === TouchType.Up) {
this.isshow = Visibility.None
this.isshow = Visibility.None
;
}
}
})
})
.width('100%').height('80%').backgroundColor(Color.White)
.width('100%').height('80%').backgroundColor(Color.White)
...
...
validator/acts_validator/src/main/ets/pages/MediaLibrary/MediaLibrary_index.ets
浏览文件 @
bc3828c4
...
@@ -27,11 +27,11 @@ path1 = path + '/report2';
...
@@ -27,11 +27,11 @@ path1 = path + '/report2';
@Entry
@Entry
@Component
@Component
struct IndexPage {
struct IndexPage {
@State BackColor: string = '#ff808080'
@State BackColor: string = '#ff808080'
;
@State ClearAll : boolean = false
@State ClearAll : boolean = false
;
private current : number = undefined
private current : number = undefined
;
@State count : number = 0
@State count : number = 0
;
@State result : string = ''
@State result : string = ''
;
private TestCaseList = [
private TestCaseList = [
{title:'SUB_MULTIMEDIA_MEDIALIBRARY_STARTIMAGEPREVIEW_PR_0100',uri:'pages/MediaLibrary/startImagePreviewPromise1'},
{title:'SUB_MULTIMEDIA_MEDIALIBRARY_STARTIMAGEPREVIEW_PR_0100',uri:'pages/MediaLibrary/startImagePreviewPromise1'},
{title:'SUB_MULTIMEDIA_MEDIALIBRARY_STARTIMAGEPREVIEW_PR_0200',uri:'pages/MediaLibrary/startImagePreviewPromise2'},
{title:'SUB_MULTIMEDIA_MEDIALIBRARY_STARTIMAGEPREVIEW_PR_0200',uri:'pages/MediaLibrary/startImagePreviewPromise2'},
...
@@ -61,7 +61,6 @@ struct IndexPage {
...
@@ -61,7 +61,6 @@ struct IndexPage {
{title:'SUB_MULTIMEDIA_MEDIALIBRARY_STOREMEDIAASSET_CB_0200',uri:'pages/MediaLibrary/storeMediaAssetCallback2'},
{title:'SUB_MULTIMEDIA_MEDIALIBRARY_STOREMEDIAASSET_CB_0200',uri:'pages/MediaLibrary/storeMediaAssetCallback2'},
{title:'SUB_MULTIMEDIA_MEDIALIBRARY_STOREMEDIAASSET_CB_0300',uri:'pages/MediaLibrary/storeMediaAssetCallback3'},
{title:'SUB_MULTIMEDIA_MEDIALIBRARY_STOREMEDIAASSET_CB_0300',uri:'pages/MediaLibrary/storeMediaAssetCallback3'},
{title:'SUB_MULTIMEDIA_MEDIALIBRARY_STOREMEDIAASSET_CB_0400',uri:'pages/MediaLibrary/storeMediaAssetCallback4'},
{title:'SUB_MULTIMEDIA_MEDIALIBRARY_STOREMEDIAASSET_CB_0400',uri:'pages/MediaLibrary/storeMediaAssetCallback4'},
{title:'',uri:'',bgc:Color.Black},
]
]
@State ColorObject : string[] = ['#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080',
@State ColorObject : string[] = ['#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080',
'#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080',
'#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080','#ff808080',
...
@@ -74,14 +73,14 @@ struct IndexPage {
...
@@ -74,14 +73,14 @@ struct IndexPage {
let results = this.result;
let results = this.result;
if (this.result === 'Pass'){
if (this.result === 'Pass'){
this.ColorObject[this.current] = '#ff008000';
this.ColorObject[this.current] = '#ff008000';
filewrite(name1,results,titles)
filewrite(name1,results,titles)
;
}
}
else if (this.result === 'Fail'){
else if (this.result === 'Fail'){
this.ColorObject[this.current] = '#ffff0000';
this.ColorObject[this.current] = '#ffff0000';
filewrite(name1,results,titles)
filewrite(name1,results,titles)
;
}
}
else if (this.result === 'None'){
else if (this.result === 'None'){
this.ColorObject[this.current] = this.ColorObject[this.current]
this.ColorObject[this.current] = this.ColorObject[this.current]
;
}
}
}
}
...
@@ -93,7 +92,7 @@ struct IndexPage {
...
@@ -93,7 +92,7 @@ struct IndexPage {
Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
Image($r('app.media.ic_public_back')).width('20vp').height('18vp')
}.backgroundColor(Color.Black)
}.backgroundColor(Color.Black)
.onClick(() => {
.onClick(() => {
router.back()
router.back()
;
})
})
Row(){
Row(){
Text('MediaLibrary')
Text('MediaLibrary')
...
@@ -107,14 +106,14 @@ struct IndexPage {
...
@@ -107,14 +106,14 @@ struct IndexPage {
.height('30vp')
.height('30vp')
}.backgroundColor(Color.Black)
}.backgroundColor(Color.Black)
.onClick(() => {
.onClick(() => {
this.ClearAll = true
this.ClearAll = true
;
this.TestCaseList.forEach((value, index) => {
this.TestCaseList.forEach((value, index) => {
this.ColorObject[index] = '#ff808080'
this.ColorObject[index] = '#ff808080'
;
})
;
})
this.ClearText();
this.ClearText();
prompt.showToast({
prompt.showToast({
message: '结果已删除', duration: 1000
message: '结果已删除', duration: 1000
})
})
;
})
})
Button(){
Button(){
Image($r('app.media.ic_public_save'))
Image($r('app.media.ic_public_save'))
...
@@ -126,7 +125,7 @@ struct IndexPage {
...
@@ -126,7 +125,7 @@ struct IndexPage {
this.ReadTextParseXml();
this.ReadTextParseXml();
prompt.showToast({
prompt.showToast({
message: '报告已生成', duration: 1000
message: '报告已生成', duration: 1000
})
})
;
})
})
}
}
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%').backgroundColor(Color.Black)
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%').backgroundColor(Color.Black)
...
@@ -138,17 +137,16 @@ struct IndexPage {
...
@@ -138,17 +137,16 @@ struct IndexPage {
Text(this.BackColor.toString()).visibility(Visibility.None)
Text(this.BackColor.toString()).visibility(Visibility.None)
}.width('100%').height(50).alignItems(VerticalAlign.Center).backgroundColor(this.ColorObject[index])
}.width('100%').height(50).alignItems(VerticalAlign.Center).backgroundColor(this.ColorObject[index])
.onClick(( )=>{
.onClick(( )=>{
this.count = 1
this.count = 1;
this.ClearAll=false
this.ClearAll=false;
this.current = index
this.current = index;
console.info('current:'+this.current+'当前背景色:'+this.TestCaseList[index].bgc+'Index:'+index)
router.push({
router.push({
url: item.uri,
url: item.uri,
})
})
;
})
})
}
}
},item => item.title)
},item => item.title)
}.width('100%')
}.width('100%')
.height('92%')
}.width('100%').height('100%').backgroundColor(Color.Black)
}.width('100%').height('100%').backgroundColor(Color.Black)
}
}
ClearText(){
ClearText(){
...
@@ -165,11 +163,9 @@ struct IndexPage {
...
@@ -165,11 +163,9 @@ struct IndexPage {
let RD = fileio.readSync(OP,buf);
let RD = fileio.readSync(OP,buf);
console.info("ddddd"+RD);
console.info("ddddd"+RD);
let report;
let report;
function ab2str(buf) {
function ab2str(buf) {
return report = String.fromCharCode.apply(null, new Uint8Array(buf));
return report = String.fromCharCode.apply(null, new Uint8Array(buf));
}
}
ab2str(buf);
ab2str(buf);
let str1 = report.split(";");
let str1 = report.split(";");
let title = [];
let title = [];
...
@@ -206,7 +202,7 @@ struct IndexPage {
...
@@ -206,7 +202,7 @@ struct IndexPage {
} finally {
} finally {
fileIO.closeSync(xmlfd);
fileIO.closeSync(xmlfd);
}
}
return
return
;
}
}
}
}
}
}
...
...
validator/acts_validator/src/main/ets/pages/common/CanvasCustomContainer1.ets
浏览文件 @
bc3828c4
...
@@ -20,8 +20,8 @@ import image from '@ohos.multimedia.image';
...
@@ -20,8 +20,8 @@ import image from '@ohos.multimedia.image';
import Logger from '../model/Logger';
import Logger from '../model/Logger';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
let path = globalThis.dir
let path = globalThis.dir
;
const TAG = '[Screenshot]'
const TAG = '[Screenshot]'
;
@Component
@Component
export struct CustomContainer {
export struct CustomContainer {
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private settings: RenderingContextSettings = new RenderingContextSettings(true);
...
@@ -43,7 +43,7 @@ export struct CustomContainer {
...
@@ -43,7 +43,7 @@ export struct CustomContainer {
params: {result : 'Pass', title : this.name,
params: {result : 'Pass', title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
@Builder
@Builder
...
@@ -57,7 +57,7 @@ export struct CustomContainer {
...
@@ -57,7 +57,7 @@ export struct CustomContainer {
params: {result : 'Fail',title : this.name,
params: {result : 'Fail',title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
build() {
build() {
...
@@ -75,10 +75,10 @@ export struct CustomContainer {
...
@@ -75,10 +75,10 @@ export struct CustomContainer {
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content()
this.content()
;
Blank()
Blank()
Row() {
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true)
this.PassBtn($r('app.string.btn_fullscreen'), true)
;
Button(){
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
}.width('30%').height('30vp').backgroundColor(Color.Grey)
...
@@ -95,35 +95,35 @@ export struct CustomContainer {
...
@@ -95,35 +95,35 @@ export struct CustomContainer {
}
}
)
)
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true)
this.FailBtn($r('app.string.btn_fullscreen'), true)
;
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}.height('98%').width('100%')
}
}
async savePicture(data: image.PixelMap, context: any) {
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`)
Logger.info(TAG, `savePicture`)
;
let packOpts: image.PackingOption = {
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
format: "image/jpeg", quality: 100
}
}
;
let info = {
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
}
}
;
let name = this.name
let name = this.name
;
let displayName = `${info.prefix}${name}${info.suffix}`
let displayName = `${info.prefix}${name}${info.suffix}`
;
let dirPath = path + '/' + displayName;
let dirPath = path + '/' + displayName;
let imagePackerApi = image.createImagePacker()
let imagePackerApi = image.createImagePacker()
;
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
;
let fd = fileio.openSync(dirPath,0o102,0o666);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release()
imagePackerApi.release()
;
try {
try {
await fileio.write(fd, arrayBuffer)
await fileio.write(fd, arrayBuffer)
;
} catch (err) {
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
;
}
}
await fileio.close(fd)
await fileio.close(fd)
;
Logger.info(TAG, `write done`)
Logger.info(TAG, `write done`)
;
prompt.showToast({
prompt.showToast({
message: '结果保存成功', duration: 1000
message: '结果保存成功', duration: 1000
})
})
;
}
}
getScreen = (isFullScreen: boolean) => {
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
let screenshotOptions: screenshot.ScreenshotOptions = {
...
@@ -131,7 +131,7 @@ export struct CustomContainer {
...
@@ -131,7 +131,7 @@ export struct CustomContainer {
imageSize: { width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
rotation: 0,
displayId: 0
displayId: 0
}
}
;
if (isFullScreen) {
if (isFullScreen) {
screenshotOptions = {
screenshotOptions = {
rotation: 0
rotation: 0
...
@@ -140,13 +140,13 @@ export struct CustomContainer {
...
@@ -140,13 +140,13 @@ export struct CustomContainer {
try {
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
;
}
}
Logger.info(TAG, 'save callback')
Logger.info(TAG, 'save callback')
;
this.savePicture(data, getContext(this) as any)
this.savePicture(data, getContext(this) as any)
;
})
})
} catch (err) {
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
;
}
}
}
}
}
}
validator/acts_validator/src/main/ets/pages/common/CanvasCustomContainer2.ets
浏览文件 @
bc3828c4
...
@@ -17,12 +17,12 @@ import prompt from '@ohos.prompt';
...
@@ -17,12 +17,12 @@ import prompt from '@ohos.prompt';
import router from '@ohos.router';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger'
import Logger from '../model/Logger'
;
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
;
let path = globalThis.dir
let path = globalThis.dir
;
const TAG = '[Screenshot]'
const TAG = '[Screenshot]'
;
@Component
@Component
export struct CustomContainer {
export struct CustomContainer {
private settings: RenderingContextSettings = new RenderingContextSettings(true);
private settings: RenderingContextSettings = new RenderingContextSettings(true);
...
@@ -45,7 +45,7 @@ export struct CustomContainer {
...
@@ -45,7 +45,7 @@ export struct CustomContainer {
params: {result : 'Pass', title : this.name,
params: {result : 'Pass', title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
@Builder
@Builder
...
@@ -59,7 +59,7 @@ export struct CustomContainer {
...
@@ -59,7 +59,7 @@ export struct CustomContainer {
params: {result : 'Fail',title : this.name,
params: {result : 'Fail',title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
build() {
build() {
...
@@ -77,10 +77,10 @@ export struct CustomContainer {
...
@@ -77,10 +77,10 @@ export struct CustomContainer {
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content()
this.content()
;
Blank()
Blank()
Row() {
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true)
this.PassBtn($r('app.string.btn_fullscreen'), true)
;
Button(){
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
}.width('30%').height('30vp').backgroundColor(Color.Grey)
...
@@ -97,35 +97,35 @@ export struct CustomContainer {
...
@@ -97,35 +97,35 @@ export struct CustomContainer {
}
}
)
)
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true)
this.FailBtn($r('app.string.btn_fullscreen'), true)
;
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}.height('98%').width('100%')
}
}
async savePicture(data: image.PixelMap, context: any) {
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`)
Logger.info(TAG, `savePicture`)
;
let packOpts: image.PackingOption = {
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
format: "image/jpeg", quality: 100
}
}
;
let info = {
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
}
}
;
let name = this.name
let name = this.name
;
let displayName = `${info.prefix}${name}${info.suffix}`
let displayName = `${info.prefix}${name}${info.suffix}`
;
let dirPath = path + '/' + displayName;
let dirPath = path + '/' + displayName;
let imagePackerApi = image.createImagePacker()
let imagePackerApi = image.createImagePacker()
;
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
;
let fd = fileio.openSync(dirPath,0o102,0o666);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release()
imagePackerApi.release()
;
try {
try {
await fileio.write(fd, arrayBuffer)
await fileio.write(fd, arrayBuffer)
;
} catch (err) {
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
;
}
}
await fileio.close(fd)
await fileio.close(fd)
;
Logger.info(TAG, `write done`)
Logger.info(TAG, `write done`)
;
prompt.showToast({
prompt.showToast({
message: '结果保存成功', duration: 1000
message: '结果保存成功', duration: 1000
})
})
;
}
}
getScreen = (isFullScreen: boolean) => {
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
let screenshotOptions: screenshot.ScreenshotOptions = {
...
@@ -133,7 +133,7 @@ export struct CustomContainer {
...
@@ -133,7 +133,7 @@ export struct CustomContainer {
imageSize: { width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
rotation: 0,
displayId: 0
displayId: 0
}
}
;
if (isFullScreen) {
if (isFullScreen) {
screenshotOptions = {
screenshotOptions = {
rotation: 0
rotation: 0
...
@@ -142,13 +142,13 @@ export struct CustomContainer {
...
@@ -142,13 +142,13 @@ export struct CustomContainer {
try {
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
;
}
}
Logger.info(TAG, 'save callback')
Logger.info(TAG, 'save callback')
;
this.savePicture(data, getContext(this) as any)
this.savePicture(data, getContext(this) as any)
;
})
})
} catch (err) {
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
;
}
}
}
}
}
}
validator/acts_validator/src/main/ets/pages/common/CustomContainer.ets
浏览文件 @
bc3828c4
...
@@ -17,12 +17,12 @@ import fileio from '@ohos.fileio';
...
@@ -17,12 +17,12 @@ import fileio from '@ohos.fileio';
import router from '@ohos.router';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger'
import Logger from '../model/Logger'
;
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
;
let path = globalThis.dir
let path = globalThis.dir
;
const TAG = '[Screenshot]'
const TAG = '[Screenshot]'
;
@Component
@Component
export struct CustomContainer {
export struct CustomContainer {
@Link name : string;
@Link name : string;
...
@@ -41,7 +41,7 @@ export struct CustomContainer {
...
@@ -41,7 +41,7 @@ export struct CustomContainer {
params: {result : 'Pass', title : this.name,
params: {result : 'Pass', title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
@Builder
@Builder
...
@@ -55,7 +55,7 @@ export struct CustomContainer {
...
@@ -55,7 +55,7 @@ export struct CustomContainer {
params: {result : 'Fail',title : this.name,
params: {result : 'Fail',title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
build() {
build() {
...
@@ -73,10 +73,10 @@ export struct CustomContainer {
...
@@ -73,10 +73,10 @@ export struct CustomContainer {
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content()
this.content()
;
Blank()
Blank()
Row() {
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true)
this.PassBtn($r('app.string.btn_fullscreen'), true)
;
Button(){
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
}.width('30%').height('30vp').backgroundColor(Color.Grey)
...
@@ -91,35 +91,35 @@ export struct CustomContainer {
...
@@ -91,35 +91,35 @@ export struct CustomContainer {
}
}
})
})
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true)
this.FailBtn($r('app.string.btn_fullscreen'), true)
;
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}.height('98%').width('100%')
}
}
async savePicture(data: image.PixelMap, context: any) {
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`)
Logger.info(TAG, `savePicture`)
;
let packOpts: image.PackingOption = {
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
format: "image/jpeg", quality: 100
}
}
;
let info = {
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
}
}
;
let name = this.name
let name = this.name
;
let displayName = `${info.prefix}${name}${info.suffix}`
let displayName = `${info.prefix}${name}${info.suffix}`
;
let dirPath = path + '/' + displayName;
let dirPath = path + '/' + displayName;
let imagePackerApi = image.createImagePacker()
let imagePackerApi = image.createImagePacker()
;
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
;
let fd = fileio.openSync(dirPath,0o102,0o666);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release()
imagePackerApi.release()
;
try {
try {
await fileio.write(fd, arrayBuffer)
await fileio.write(fd, arrayBuffer)
;
} catch (err) {
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
;
}
}
await fileio.close(fd)
await fileio.close(fd)
;
Logger.info(TAG, `write done`)
Logger.info(TAG, `write done`)
;
prompt.showToast({
prompt.showToast({
message: '结果保存成功', duration: 1000
message: '结果保存成功', duration: 1000
})
})
;
}
}
getScreen = (isFullScreen: boolean) => {
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
let screenshotOptions: screenshot.ScreenshotOptions = {
...
@@ -127,7 +127,7 @@ export struct CustomContainer {
...
@@ -127,7 +127,7 @@ export struct CustomContainer {
imageSize: { width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
rotation: 0,
displayId: 0
displayId: 0
}
}
;
if (isFullScreen) {
if (isFullScreen) {
screenshotOptions = {
screenshotOptions = {
rotation: 0
rotation: 0
...
@@ -136,13 +136,13 @@ export struct CustomContainer {
...
@@ -136,13 +136,13 @@ export struct CustomContainer {
try {
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
;
}
}
Logger.info(TAG, 'save callback')
Logger.info(TAG, 'save callback')
;
this.savePicture(data, getContext(this) as any)
this.savePicture(data, getContext(this) as any)
;
})
})
} catch (err) {
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
;
}
}
}
}
}
}
validator/acts_validator/src/main/ets/pages/common/CustomContainer2.ets
浏览文件 @
bc3828c4
...
@@ -17,11 +17,11 @@ import prompt from '@ohos.prompt';
...
@@ -17,11 +17,11 @@ import prompt from '@ohos.prompt';
import router from '@ohos.router';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger'
import Logger from '../model/Logger'
;
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
;
let path = globalThis.dir
let path = globalThis.dir
;
const TAG = '[Screenshot]'
const TAG = '[Screenshot]'
;
@Component
@Component
export struct CustomContainer {
export struct CustomContainer {
@Link X: number;
@Link X: number;
...
@@ -41,7 +41,7 @@ export struct CustomContainer {
...
@@ -41,7 +41,7 @@ export struct CustomContainer {
params: {result : 'Pass', title : this.name,
params: {result : 'Pass', title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
@Builder
@Builder
...
@@ -55,7 +55,7 @@ export struct CustomContainer {
...
@@ -55,7 +55,7 @@ export struct CustomContainer {
params: {result : 'Fail',title : this.name,
params: {result : 'Fail',title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
build() {
build() {
...
@@ -73,10 +73,10 @@ export struct CustomContainer {
...
@@ -73,10 +73,10 @@ export struct CustomContainer {
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content()
this.content()
;
Blank()
Blank()
Row() {
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true)
this.PassBtn($r('app.string.btn_fullscreen'), true)
;
Button(){
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
}.width('30%').height('30vp').backgroundColor(Color.Grey)
...
@@ -93,35 +93,35 @@ export struct CustomContainer {
...
@@ -93,35 +93,35 @@ export struct CustomContainer {
}
}
)
)
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true)
this.FailBtn($r('app.string.btn_fullscreen'), true)
;
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}.height('98%').width('100%')
}
}
async savePicture(data: image.PixelMap, context: any) {
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`)
Logger.info(TAG, `savePicture`)
;
let packOpts: image.PackingOption = {
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
format: "image/jpeg", quality: 100
}
}
;
let info = {
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
}
}
;
let name = this.name
let name = this.name
;
let displayName = `${info.prefix}${name}${info.suffix}`
let displayName = `${info.prefix}${name}${info.suffix}`
;
let dirPath = path + '/' + displayName;
let dirPath = path + '/' + displayName;
let imagePackerApi = image.createImagePacker()
let imagePackerApi = image.createImagePacker()
;
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
;
let fd = fileio.openSync(dirPath,0o102,0o666);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release()
imagePackerApi.release()
;
try {
try {
await fileio.write(fd, arrayBuffer)
await fileio.write(fd, arrayBuffer)
;
} catch (err) {
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
;
}
}
await fileio.close(fd)
await fileio.close(fd)
;
Logger.info(TAG, `write done`)
Logger.info(TAG, `write done`)
;
prompt.showToast({
prompt.showToast({
message: '结果保存成功', duration: 1000
message: '结果保存成功', duration: 1000
})
})
;
}
}
getScreen = (isFullScreen: boolean) => {
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
let screenshotOptions: screenshot.ScreenshotOptions = {
...
@@ -129,7 +129,7 @@ export struct CustomContainer {
...
@@ -129,7 +129,7 @@ export struct CustomContainer {
imageSize: { width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
rotation: 0,
displayId: 0
displayId: 0
}
}
;
if (isFullScreen) {
if (isFullScreen) {
screenshotOptions = {
screenshotOptions = {
rotation: 0
rotation: 0
...
@@ -138,13 +138,13 @@ export struct CustomContainer {
...
@@ -138,13 +138,13 @@ export struct CustomContainer {
try {
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
;
}
}
Logger.info(TAG, 'save callback')
Logger.info(TAG, 'save callback')
;
this.savePicture(data, getContext(this) as any)
this.savePicture(data, getContext(this) as any)
;
})
})
} catch (err) {
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
;
}
}
}
}
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/common/CustomContainer3.ets
浏览文件 @
bc3828c4
...
@@ -17,11 +17,11 @@ import prompt from '@ohos.prompt';
...
@@ -17,11 +17,11 @@ import prompt from '@ohos.prompt';
import router from '@ohos.router';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger'
import Logger from '../model/Logger'
;
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
;
let path = globalThis.dir
let path = globalThis.dir
;
const TAG = '[Screenshot]'
const TAG = '[Screenshot]'
;
@Component
@Component
export struct CustomContainer {
export struct CustomContainer {
@Link X: number;
@Link X: number;
...
@@ -42,7 +42,7 @@ export struct CustomContainer {
...
@@ -42,7 +42,7 @@ export struct CustomContainer {
params: {result : 'Pass', title : this.name,
params: {result : 'Pass', title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
@Builder
@Builder
...
@@ -56,7 +56,7 @@ export struct CustomContainer {
...
@@ -56,7 +56,7 @@ export struct CustomContainer {
params: {result : 'Fail',title : this.name,
params: {result : 'Fail',title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
build() {
build() {
...
@@ -74,10 +74,10 @@ export struct CustomContainer {
...
@@ -74,10 +74,10 @@ export struct CustomContainer {
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content()
this.content()
;
Blank()
Blank()
Row() {
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true)
this.PassBtn($r('app.string.btn_fullscreen'), true)
;
Button(){
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
}.width('30%').height('30vp').backgroundColor(Color.Grey)
...
@@ -94,35 +94,35 @@ export struct CustomContainer {
...
@@ -94,35 +94,35 @@ export struct CustomContainer {
}
}
)
)
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true)
this.FailBtn($r('app.string.btn_fullscreen'), true)
;
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}.height('98%').width('100%')
}
}
async savePicture(data: image.PixelMap, context: any) {
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`)
Logger.info(TAG, `savePicture`)
;
let packOpts: image.PackingOption = {
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
format: "image/jpeg", quality: 100
}
}
;
let info = {
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
}
}
;
let name = this.name
let name = this.name
;
let displayName = `${info.prefix}${name}${info.suffix}`
let displayName = `${info.prefix}${name}${info.suffix}`
;
let dirPath = path + '/' + displayName;
let dirPath = path + '/' + displayName;
let imagePackerApi = image.createImagePacker()
let imagePackerApi = image.createImagePacker()
;
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
;
let fd = fileio.openSync(dirPath,0o102,0o666);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release()
imagePackerApi.release()
;
try {
try {
await fileio.write(fd, arrayBuffer)
await fileio.write(fd, arrayBuffer)
;
} catch (err) {
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
;
}
}
await fileio.close(fd)
await fileio.close(fd)
;
Logger.info(TAG, `write done`)
Logger.info(TAG, `write done`)
;
prompt.showToast({
prompt.showToast({
message: '结果保存成功', duration: 1000
message: '结果保存成功', duration: 1000
})
})
;
}
}
getScreen = (isFullScreen: boolean) => {
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
let screenshotOptions: screenshot.ScreenshotOptions = {
...
@@ -130,7 +130,7 @@ export struct CustomContainer {
...
@@ -130,7 +130,7 @@ export struct CustomContainer {
imageSize: { width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
rotation: 0,
displayId: 0
displayId: 0
}
}
;
if (isFullScreen) {
if (isFullScreen) {
screenshotOptions = {
screenshotOptions = {
rotation: 0
rotation: 0
...
@@ -139,13 +139,13 @@ export struct CustomContainer {
...
@@ -139,13 +139,13 @@ export struct CustomContainer {
try {
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
;
}
}
Logger.info(TAG, 'save callback')
Logger.info(TAG, 'save callback')
;
this.savePicture(data, getContext(this) as any)
this.savePicture(data, getContext(this) as any)
;
})
})
} catch (err) {
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
;
}
}
}
}
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/common/CustomContainer4.ets
浏览文件 @
bc3828c4
...
@@ -17,11 +17,11 @@ import prompt from '@ohos.prompt';
...
@@ -17,11 +17,11 @@ import prompt from '@ohos.prompt';
import router from '@ohos.router';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger'
import Logger from '../model/Logger'
;
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
;
let path = globalThis.dir
let path = globalThis.dir
;
const TAG = '[Screenshot]'
const TAG = '[Screenshot]'
;
@Component
@Component
export struct CustomContainer {
export struct CustomContainer {
@Link value: string;
@Link value: string;
...
@@ -41,7 +41,7 @@ export struct CustomContainer {
...
@@ -41,7 +41,7 @@ export struct CustomContainer {
params: {result : 'Pass', title : this.name,
params: {result : 'Pass', title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
@Builder
@Builder
...
@@ -55,7 +55,7 @@ export struct CustomContainer {
...
@@ -55,7 +55,7 @@ export struct CustomContainer {
params: {result : 'Fail',title : this.name,
params: {result : 'Fail',title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
build() {
build() {
...
@@ -73,10 +73,10 @@ export struct CustomContainer {
...
@@ -73,10 +73,10 @@ export struct CustomContainer {
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content()
this.content()
;
Blank()
Blank()
Row() {
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true)
this.PassBtn($r('app.string.btn_fullscreen'), true)
;
Button(){
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
}.width('30%').height('30vp').backgroundColor(Color.Grey)
...
@@ -91,35 +91,35 @@ export struct CustomContainer {
...
@@ -91,35 +91,35 @@ export struct CustomContainer {
}
}
})
})
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true)
this.FailBtn($r('app.string.btn_fullscreen'), true)
;
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}.height('98%').width('100%')
}
}
async savePicture(data: image.PixelMap, context: any) {
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`)
Logger.info(TAG, `savePicture`)
;
let packOpts: image.PackingOption = {
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
format: "image/jpeg", quality: 100
}
}
;
let info = {
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
}
}
;
let name = this.name
let name = this.name
;
let displayName = `${info.prefix}${name}${info.suffix}`
let displayName = `${info.prefix}${name}${info.suffix}`
;
let dirPath = path + '/' + displayName;
let dirPath = path + '/' + displayName;
let imagePackerApi = image.createImagePacker()
let imagePackerApi = image.createImagePacker()
;
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
;
let fd = fileio.openSync(dirPath,0o102,0o666);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release()
imagePackerApi.release()
;
try {
try {
await fileio.write(fd, arrayBuffer)
await fileio.write(fd, arrayBuffer)
;
} catch (err) {
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
;
}
}
await fileio.close(fd)
await fileio.close(fd)
;
Logger.info(TAG, `write done`)
Logger.info(TAG, `write done`)
;
prompt.showToast({
prompt.showToast({
message: '结果保存成功', duration: 1000
message: '结果保存成功', duration: 1000
})
})
;
}
}
getScreen = (isFullScreen: boolean) => {
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
let screenshotOptions: screenshot.ScreenshotOptions = {
...
@@ -127,7 +127,7 @@ export struct CustomContainer {
...
@@ -127,7 +127,7 @@ export struct CustomContainer {
imageSize: { width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
rotation: 0,
displayId: 0
displayId: 0
}
}
;
if (isFullScreen) {
if (isFullScreen) {
screenshotOptions = {
screenshotOptions = {
rotation: 0
rotation: 0
...
@@ -136,13 +136,13 @@ export struct CustomContainer {
...
@@ -136,13 +136,13 @@ export struct CustomContainer {
try {
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
;
}
}
Logger.info(TAG, 'save callback')
Logger.info(TAG, 'save callback')
;
this.savePicture(data, getContext(this) as any)
this.savePicture(data, getContext(this) as any)
;
})
})
} catch (err) {
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
;
}
}
}
}
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/common/CustomContainer5.ets
浏览文件 @
bc3828c4
...
@@ -17,11 +17,11 @@ import prompt from '@ohos.prompt';
...
@@ -17,11 +17,11 @@ import prompt from '@ohos.prompt';
import router from '@ohos.router';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger'
import Logger from '../model/Logger'
;
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
;
let path = globalThis.dir
let path = globalThis.dir
;
const TAG = '[Screenshot]'
const TAG = '[Screenshot]'
;
@Component
@Component
export struct CustomContainer {
export struct CustomContainer {
@Link X: number;
@Link X: number;
...
@@ -43,7 +43,7 @@ export struct CustomContainer {
...
@@ -43,7 +43,7 @@ export struct CustomContainer {
params: {result : 'Pass', title : this.name,
params: {result : 'Pass', title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
@Builder
@Builder
...
@@ -57,7 +57,7 @@ export struct CustomContainer {
...
@@ -57,7 +57,7 @@ export struct CustomContainer {
params: {result : 'Fail',title : this.name,
params: {result : 'Fail',title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
build() {
build() {
...
@@ -75,10 +75,10 @@ export struct CustomContainer {
...
@@ -75,10 +75,10 @@ export struct CustomContainer {
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content()
this.content()
;
Blank()
Blank()
Row() {
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true)
this.PassBtn($r('app.string.btn_fullscreen'), true)
;
Button(){
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
}.width('30%').height('30vp').backgroundColor(Color.Grey)
...
@@ -95,35 +95,35 @@ export struct CustomContainer {
...
@@ -95,35 +95,35 @@ export struct CustomContainer {
}
}
)
)
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true)
this.FailBtn($r('app.string.btn_fullscreen'), true)
;
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}.height('98%').width('100%')
}
}
async savePicture(data: image.PixelMap, context: any) {
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`)
Logger.info(TAG, `savePicture`)
;
let packOpts: image.PackingOption = {
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
format: "image/jpeg", quality: 100
}
}
;
let info = {
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
}
}
;
let name = this.name
let name = this.name
;
let displayName = `${info.prefix}${name}${info.suffix}`
let displayName = `${info.prefix}${name}${info.suffix}`
;
let dirPath = path + '/' + displayName;
let dirPath = path + '/' + displayName;
let imagePackerApi = image.createImagePacker()
let imagePackerApi = image.createImagePacker()
;
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
;
let fd = fileio.openSync(dirPath,0o102,0o666);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release()
imagePackerApi.release()
;
try {
try {
await fileio.write(fd, arrayBuffer)
await fileio.write(fd, arrayBuffer)
;
} catch (err) {
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
;
}
}
await fileio.close(fd)
await fileio.close(fd)
;
Logger.info(TAG, `write done`)
Logger.info(TAG, `write done`)
;
prompt.showToast({
prompt.showToast({
message: '结果保存成功', duration: 1000
message: '结果保存成功', duration: 1000
})
})
;
}
}
getScreen = (isFullScreen: boolean) => {
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
let screenshotOptions: screenshot.ScreenshotOptions = {
...
@@ -131,7 +131,7 @@ export struct CustomContainer {
...
@@ -131,7 +131,7 @@ export struct CustomContainer {
imageSize: { width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
rotation: 0,
displayId: 0
displayId: 0
}
}
;
if (isFullScreen) {
if (isFullScreen) {
screenshotOptions = {
screenshotOptions = {
rotation: 0
rotation: 0
...
@@ -140,13 +140,13 @@ export struct CustomContainer {
...
@@ -140,13 +140,13 @@ export struct CustomContainer {
try {
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
;
}
}
Logger.info(TAG, 'save callback')
Logger.info(TAG, 'save callback')
;
this.savePicture(data, getContext(this) as any)
this.savePicture(data, getContext(this) as any)
;
})
})
} catch (err) {
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
;
}
}
}
}
}
}
validator/acts_validator/src/main/ets/pages/common/MediaCustomContainer.ets
浏览文件 @
bc3828c4
...
@@ -17,11 +17,11 @@ import prompt from '@ohos.prompt';
...
@@ -17,11 +17,11 @@ import prompt from '@ohos.prompt';
import router from '@ohos.router';
import router from '@ohos.router';
import screenshot from '@ohos.screenshot';
import screenshot from '@ohos.screenshot';
import image from '@ohos.multimedia.image';
import image from '@ohos.multimedia.image';
import Logger from '../model/Logger'
import Logger from '../model/Logger'
;
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
;
let path = globalThis.dir
let path = globalThis.dir
;
const TAG = '[Screenshot]'
const TAG = '[Screenshot]'
;
@Component
@Component
export struct CustomContainer {
export struct CustomContainer {
@Link FillColor: string;
@Link FillColor: string;
...
@@ -41,7 +41,7 @@ export struct CustomContainer {
...
@@ -41,7 +41,7 @@ export struct CustomContainer {
params: {result : 'Pass', title : this.name,
params: {result : 'Pass', title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
@Builder
@Builder
...
@@ -55,7 +55,7 @@ export struct CustomContainer {
...
@@ -55,7 +55,7 @@ export struct CustomContainer {
params: {result : 'Fail',title : this.name,
params: {result : 'Fail',title : this.name,
}
}
})
})
this.getScreen(isFullScreen)
this.getScreen(isFullScreen)
;
})
})
}
}
build() {
build() {
...
@@ -73,10 +73,10 @@ export struct CustomContainer {
...
@@ -73,10 +73,10 @@ export struct CustomContainer {
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text(this.title).fontColor(Color.White).fontSize('18fp').margin({left:'-20vp'})
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
Text('hello').fontColor(Color.White).visibility(Visibility.Hidden)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
}.backgroundColor(Color.Black).height('10%').width('100%').justifyContent(FlexAlign.SpaceBetween)
this.content()
this.content()
;
Blank()
Blank()
Row() {
Row() {
this.PassBtn($r('app.string.btn_fullscreen'), true)
this.PassBtn($r('app.string.btn_fullscreen'), true)
;
Button(){
Button(){
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
Image($r('app.media.ic_public_help')).width('20vp').height('20vp')
}.width('30%').height('30vp').backgroundColor(Color.Grey)
}.width('30%').height('30vp').backgroundColor(Color.Grey)
...
@@ -93,35 +93,35 @@ export struct CustomContainer {
...
@@ -93,35 +93,35 @@ export struct CustomContainer {
}
}
)
)
})
})
this.FailBtn($r('app.string.btn_fullscreen'), true)
this.FailBtn($r('app.string.btn_fullscreen'), true)
;
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.width('100%').justifyContent(FlexAlign.SpaceEvenly).backgroundColor(Color.Black)
}.height('98%').width('100%')
}.height('98%').width('100%')
}
}
async savePicture(data: image.PixelMap, context: any) {
async savePicture(data: image.PixelMap, context: any) {
Logger.info(TAG, `savePicture`)
Logger.info(TAG, `savePicture`)
;
let packOpts: image.PackingOption = {
let packOpts: image.PackingOption = {
format: "image/jpeg", quality: 100
format: "image/jpeg", quality: 100
}
}
;
let info = {
let info = {
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
prefix: 'IMG_', suffix: '.jpg', directory: mediaLibrary.DirectoryType.DIR_IMAGE
}
}
;
let name = this.name
let name = this.name
;
let displayName = `${info.prefix}${name}${info.suffix}`
let displayName = `${info.prefix}${name}${info.suffix}`
;
let dirPath = path + '/' + displayName;
let dirPath = path + '/' + displayName;
let imagePackerApi = image.createImagePacker()
let imagePackerApi = image.createImagePacker()
;
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
;
let fd = fileio.openSync(dirPath,0o102,0o666);
let fd = fileio.openSync(dirPath,0o102,0o666);
imagePackerApi.release()
imagePackerApi.release()
;
try {
try {
await fileio.write(fd, arrayBuffer)
await fileio.write(fd, arrayBuffer)
;
} catch (err) {
} catch (err) {
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`write failed, code is ${err.code}, message is ${err.message}`)
;
}
}
await fileio.close(fd)
await fileio.close(fd)
;
Logger.info(TAG, `write done`)
Logger.info(TAG, `write done`)
;
prompt.showToast({
prompt.showToast({
message: '结果保存成功', duration: 1000
message: '结果保存成功', duration: 1000
})
})
;
}
}
getScreen = (isFullScreen: boolean) => {
getScreen = (isFullScreen: boolean) => {
let screenshotOptions: screenshot.ScreenshotOptions = {
let screenshotOptions: screenshot.ScreenshotOptions = {
...
@@ -129,7 +129,7 @@ export struct CustomContainer {
...
@@ -129,7 +129,7 @@ export struct CustomContainer {
imageSize: { width: 400, height: 400 },
imageSize: { width: 400, height: 400 },
rotation: 0,
rotation: 0,
displayId: 0
displayId: 0
}
}
;
if (isFullScreen) {
if (isFullScreen) {
screenshotOptions = {
screenshotOptions = {
rotation: 0
rotation: 0
...
@@ -138,13 +138,13 @@ export struct CustomContainer {
...
@@ -138,13 +138,13 @@ export struct CustomContainer {
try {
try {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
screenshot.save(screenshotOptions, (err, data: image.PixelMap) => {
if (err) {
if (err) {
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
Logger.info(TAG, `Failed to save the screenshot. Error:${JSON.stringify(err)}`)
;
}
}
Logger.info(TAG, 'save callback')
Logger.info(TAG, 'save callback')
;
this.savePicture(data, getContext(this) as any)
this.savePicture(data, getContext(this) as any)
;
})
})
} catch (err) {
} catch (err) {
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
Logger.error(`save failed, code is ${err.code}, message is ${err.message}`)
;
}
}
}
}
}
}
validator/acts_validator/src/main/ets/pages/index.ets
浏览文件 @
bc3828c4
...
@@ -56,7 +56,7 @@ struct IndexPage {
...
@@ -56,7 +56,7 @@ struct IndexPage {
this.ClearText();
this.ClearText();
prompt.showToast({
prompt.showToast({
message: '所有结果已删除', duration: 1000
message: '所有结果已删除', duration: 1000
})
})
;
})
})
Button(){
Button(){
Image($r('app.media.ic_public_save'))
Image($r('app.media.ic_public_save'))
...
@@ -68,7 +68,7 @@ struct IndexPage {
...
@@ -68,7 +68,7 @@ struct IndexPage {
this.SaveXml();
this.SaveXml();
prompt.showToast({
prompt.showToast({
message: '总报告已生成', duration: 1000
message: '总报告已生成', duration: 1000
})
})
;
})
})
}
}
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%')
}.width('100%').justifyContent(FlexAlign.SpaceAround).margin({top:'15vp'}).height('6%')
...
...
validator/acts_validator/src/main/ets/pages/model/FirstDialog.ets
浏览文件 @
bc3828c4
...
@@ -24,12 +24,12 @@ export default class FirstDialog{
...
@@ -24,12 +24,12 @@ export default class FirstDialog{
let promise = data_preferences.getPreferences(context,'mystore');
let promise = data_preferences.getPreferences(context,'mystore');
await promise.then((object) => {
await promise.then((object) => {
preferences = object;
preferences = object;
})
})
;
promise = preferences.get(name, 0);
promise = preferences.get(name, 0);
await promise.then((data) => {
await promise.then((data) => {
Test = data;
Test = data;
console.info("Succeeded in getting value of 'startup'. Data: " + data);
console.info("Succeeded in getting value of 'startup'. Data: " + data);
})
})
;
if(Test != 1) {
if(Test != 1) {
AlertDialog.show(
AlertDialog.show(
{
{
...
@@ -41,11 +41,11 @@ export default class FirstDialog{
...
@@ -41,11 +41,11 @@ export default class FirstDialog{
let promise = preferences.put(name, 1);
let promise = preferences.put(name, 1);
promise.then(() => {
promise.then(() => {
console.info("Succeeded in putting value of 'test'.");
console.info("Succeeded in putting value of 'test'.");
})
})
;
promise = preferences.flush();
promise = preferences.flush();
promise.then(() => {
promise.then(() => {
console.info("Succeeded in flushing.");
console.info("Succeeded in flushing.");
})
})
;
}
}
},
},
secondaryButton: {
secondaryButton: {
...
@@ -60,6 +60,6 @@ export default class FirstDialog{
...
@@ -60,6 +60,6 @@ export default class FirstDialog{
}
}
)
)
}
}
return
return
;
}
}
}
}
\ No newline at end of file
validator/acts_validator/src/main/ets/pages/model/Logger.ts
浏览文件 @
bc3828c4
...
@@ -12,33 +12,33 @@
...
@@ -12,33 +12,33 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import
hilog
from
'
@ohos.hilog
'
import
hilog
from
'
@ohos.hilog
'
;
class
Logger
{
class
Logger
{
private
domain
:
number
private
domain
:
number
;
private
prefix
:
string
private
prefix
:
string
;
private
format
:
string
=
"
%{public}s, %{public}s
"
private
format
:
string
=
"
%{public}s, %{public}s
"
;
constructor
(
prefix
:
string
)
{
constructor
(
prefix
:
string
)
{
this
.
prefix
=
prefix
this
.
prefix
=
prefix
;
this
.
domain
=
0xFF00
this
.
domain
=
0xFF00
;
}
}
debug
(...
args
:
any
[])
{
debug
(...
args
:
any
[])
{
hilog
.
debug
(
this
.
domain
,
this
.
prefix
,
this
.
format
,
args
)
hilog
.
debug
(
this
.
domain
,
this
.
prefix
,
this
.
format
,
args
)
;
}
}
info
(...
args
:
any
[])
{
info
(...
args
:
any
[])
{
hilog
.
info
(
this
.
domain
,
this
.
prefix
,
this
.
format
,
args
)
hilog
.
info
(
this
.
domain
,
this
.
prefix
,
this
.
format
,
args
)
;
}
}
warn
(...
args
:
any
[])
{
warn
(...
args
:
any
[])
{
hilog
.
warn
(
this
.
domain
,
this
.
prefix
,
this
.
format
,
args
)
hilog
.
warn
(
this
.
domain
,
this
.
prefix
,
this
.
format
,
args
)
;
}
}
error
(...
args
:
any
[])
{
error
(...
args
:
any
[])
{
hilog
.
error
(
this
.
domain
,
this
.
prefix
,
this
.
format
,
args
)
hilog
.
error
(
this
.
domain
,
this
.
prefix
,
this
.
format
,
args
)
;
}
}
}
}
export
default
new
Logger
(
'
[Screenshot]
'
)
export
default
new
Logger
(
'
[Screenshot]
'
);
\ No newline at end of file
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录