new polygontest

Signed-off-by: qiaochenl <qiaochenl@isoftstone.com>
This commit is contained in:
qiaochenl 2023-06-19 02:37:13 +00:00
parent a6fa62dd50
commit 2ea80abc21
68 changed files with 5059 additions and 0 deletions

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"app": {
"bundleName": "com.example.polygontest",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"string": [
{
"name": "app_name",
"value": "polygontest"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"app": {
"signingConfigs": [
{
"name": "default",
"material": {
"certpath": "C:\\Users\\qiaochenl\\.ohos\\config\\openharmony\\auto_ohos_default_polygontest_com.example.polygontest.cer",
"storePassword": "0000001B3F51781BB99118943584B754BA477B2819D6452C31F06A3A18D731F6449CB24234A69A6BE6C313",
"keyAlias": "debugKey",
"keyPassword": "0000001BFE1C96DD72405529DBDED2EA8022482EE598477E8A715902792F6BA0F656B044F36B2205036DDC",
"profile": "C:\\Users\\qiaochenl\\.ohos\\config\\openharmony\\auto_ohos_default_polygontest_com.example.polygontest.p7b",
"signAlg": "SHA256withECDSA",
"storeFile": "C:\\Users\\qiaochenl\\.ohos\\config\\openharmony\\auto_ohos_default_polygontest_com.example.polygontest.p12"
}
}
],
"compileSdkVersion": 9,
"compatibleSdkVersion": 9,
"products": [
{
"name": "default",
"signingConfig": "default",
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"apiType": 'stageMode',
"buildOption": {
},
"targets": [
{
"name": "default",
},
{
"name": "ohosTest",
}
]
}

View File

@ -0,0 +1,2 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
export { hapTasks } from '@ohos/hvigor-ohos-plugin';

View File

@ -0,0 +1,25 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "",
"devDependencies": {},
"author": "",
"name": "entry",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}

View File

@ -0,0 +1,41 @@
import UIAbility from '@ohos.app.ability.UIAbility';
import hilog from '@ohos.hilog';
import window from '@ohos.window';
export default class EntryAbility extends UIAbility {
onCreate(want, launchParam) {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
}
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage) {
// Main window is created, set main page for this ability
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
windowStage.loadContent('pages/Index', (err, data) => {
if (err.code) {
hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
return;
}
hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? '');
});
}
onWindowStageDestroy() {
// Main window is destroyed, release UI related resources
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
}
onForeground() {
// Ability has brought to foreground
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
}
onBackground() {
// Ability has back to background
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
}
}

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct Index {
@State message: string = 'Hello World'
build() {
Row() {
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
}
.height('100%')
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"module": {
"name": "entry",
"type": "entry",
"description": "$string:module_desc",
"mainElement": "EntryAbility",
"deviceTypes": [
"phone"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:main_pages",
"abilities": [
{
"name": "EntryAbility",
"srcEntry": "./ets/entryability/EntryAbility.ts",
"description": "$string:EntryAbility_desc",
"icon": "$media:icon",
"label": "$string:EntryAbility_label",
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"exported": true,
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
]
}
]
}
}

View File

@ -0,0 +1,8 @@
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
}
]
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,5 @@
{
"src": [
"pages/Index"
]
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "module_desc",
"value": "module description"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
}
]
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "module_desc",
"value": "模块描述"
},
{
"name": "EntryAbility_desc",
"value": "description"
},
{
"name": "EntryAbility_label",
"value": "label"
}
]
}

View File

@ -0,0 +1,20 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import polygonTest from './Polygon.test'
export default function testsuite() {
polygonTest()
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
*/
export default class DateTimeUtil {
/**
*
*/
getTime() {
const DATETIME = new Date()
return this.concatTime(DATETIME.getHours(), DATETIME.getMinutes(),DATETIME.getSeconds())
}
/**
*
*/
getDate() {
const DATETIME = new Date()
return this.concatDate(DATETIME.getFullYear(),DATETIME.getMonth() + 1, DATETIME.getDate())
}
/**
* 0
* @param value-
*/
fill(value) {
return (value > 9 ? '' : '0') + value
}
/**
*
* @param year
* @param month
* @param date
*/
concatDate(year:number,month:number, date:number) {
return `${year}${this.fill(month)}${this.fill(date)}`
}
/**
*
* @param hours
* @param minutes
* @param seconds
*/
concatTime(hours:number, minutes:number,seconds:number) {
return `${this.fill(hours)}${this.fill(minutes)}${this.fill(seconds)}`
}
}

View File

@ -0,0 +1,44 @@
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
class Logger {
private domain: number;
private prefix: string;
private format: string = "%{public}s, %{public}s";
constructor(prefix: string) {
this.prefix = prefix;
this.domain = 0xFF00;
}
debug(...args: any[]) {
hilog.debug(this.domain, this.prefix, this.format, args);
}
info(...args: any[]) {
hilog.info(this.domain, this.prefix, this.format, args);
}
warn(...args: any[]) {
hilog.warn(this.domain, this.prefix, this.format, args);
}
error(...args: any[]) {
hilog.error(this.domain, this.prefix, this.format, args);
}
}
export default new Logger('[Screenshot]');

View File

@ -0,0 +1,54 @@
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export interface Callback {
(message:any):void
}
export class MessageManager {
callback:Callback
callbacks:Map<string,Callback> = new Map()
constructor() {
}
registerCallback(callback:Callback , type?:string) {
if (type == undefined) {
console.error('registerCallback callback set')
this.callback = callback
return
}
this.callbacks.set(type,callback)
}
notify(message:any, type?:string) {
if (type == undefined) {
this.callback(message)
return
}
let tmpCallback:Callback = this.callbacks.get(type)
if (tmpCallback === undefined) {
console.error('callbacks has no callback for type ' + type)
return
}
tmpCallback(message)
}
clear() {
this.callbacks.clear()
this.callback = null
}
}

View File

@ -0,0 +1,125 @@
// @ts-nocheck
import screen from '@ohos.screen';
import window from '@ohos.window';
import Logger from './Logger';
const TAG: string = '[Settings]';
class Settings {
sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
windowClass: window.Window = null
changeWindowPosition(windowClass, X, Y) {
//为悬浮窗设置位置
windowClass.moveWindowTo(X, Y, (err) => {
if (err.code) {
Logger.error(TAG, `Failed to move the window. Cause : ${JSON.stringify(err)}`)
return;
}
})
}
changeWindowSize(windowClass, width, height) {
//为悬浮窗设置大小
windowClass.resize(width, height, (err) => {
if (err.code) {
Logger.error(TAG, `Failed to change the window size. Cause : ${JSON.stringify(err)}`)
return;
}
})
}
loadContent(windowClass, pageURI) {
//为悬浮窗加载对应的目标页面
windowClass.setUIContent(pageURI, (err) => {
if (err.code) {
Logger.error(TAG, `Failed to load the content. Cause : ${JSON.stringify(err)}`)
return;
}
Logger.info(TAG, `Succeeded in loading the content.`);
//显示悬浮窗
windowClass.showWindow((err) => {
if (err.code) {
Logger.error(TAG, `Failed to show the window. Cause : ${JSON.stringify(err)}`)
return;
}
Logger.info(TAG, `Succeeded in showing the window.`);
})
})
}
changeDpi(dpi) {
let screenClass = null;
screen.getAllScreens((err, data) => {
if (err.code) {
Logger.error(TAG, `Failed to get all screens. Cause : ${JSON.stringify(err)}`);
return;
}
Logger.info(TAG, `Succeeded in getting all screens. Data:${JSON.stringify(data)}`);
screenClass = data[0];
//设置设备dpi
screenClass.setDensityDpi(dpi, (err, data) => {
if (err.code) {
Logger.error(TAG, `Failed to set the pixel density. Code : ${JSON.stringify(err)}`)
return;
}
Logger.info(TAG, `Succeeded in setting the pixel density`);
})
})
}
destroyWindow(windowClass) {
//销毁窗口
windowClass.destroyWindow((err) => {
if (err.code) {
Logger.error(TAG, `Failed to destroy the window. Cause : ${JSON.stringify(err)}`)
return;
}
Logger.info(TAG, `Succeeded in destroy the window.`);
})
}
/*
*
* Setting.createWindow(pageURI: String, {X,Y,width,height,dpi}?:{X?:number,Y?:number,width?:number,height?:number,dpi?:number}):void
*
* pageURI
*
* X,YX=100,Y=100 px
* width,height:窗口宽高width=600,height=1250 [0,2560],vp
* dpi:像素密度dpi=33080-640
* */
createWindow(pageURI: String, {X=100,Y=100,width=600,height=1250,dpi=400}={}) {
Logger.info(TAG, `params,pageURI=${pageURI},X=${X},Y=${Y},width=${width},height=${height},dpi=${dpi}`)
this.changeDpi(dpi)
this.sleep(1000)
let windowClass = null
let config = {
name: "floatWindow",
windowType: window.WindowType.TYPE_FLOAT,
ctx: globalThis.context
};
window.createWindow(config, (err, data) => {
if (err.code) {
Logger.error(TAG, `Failed to create the floatWindow. Cause : ${JSON.stringify(err)}`)
return;
}
Logger.info(TAG, `Succeeded in creating the floatWindow. Data : ${JSON.stringify(err)}`);
windowClass = data;
this.windowClass = data;
this.changeWindowPosition(windowClass, X, Y);
this.changeWindowSize(windowClass, width, height);
this.loadContent(windowClass, pageURI)
})
}
}
export default new Settings()

View File

@ -0,0 +1,118 @@
// @ts-nocheck
/**
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
static getComponentRect(key) {
let strJson = getInspectorByKey(key);
let obj = JSON.parse(strJson);
console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
let rectInfo = JSON.parse('[' + obj.$rect + ']')
console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
return this.rect_value = {
"left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
}
}
static async swipe(downX, downY, upX, upY, steps) {
console.info('start to swipe')
this.drags(downX, downY, upX, upY, steps, false)
}
static async drag(downX, downY, upX, upY, steps) {
console.info('start to drag')
this.drags(downX, downY, upX, upY, steps, true)
}
static async drags(downX, downY, upX, upY, steps, drag) {
var xStep;
var yStep;
var swipeSteps;
var ret;
xStep = 0;
yStep = 0;
ret = false;
swipeSteps = steps;
if (swipeSteps == 0) {
swipeSteps = 1;
}
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
var downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
type: TouchType.Down,
}
console.info('down touch started: ' + JSON.stringify(downPonit))
sendTouchEvent(downPonit);
console.info('start to move')
if (drag) {
await this.sleep(500)
}
for (var i = 1;i <= swipeSteps; i++) {
var movePoint: TouchObject = {
id: 1,
x: downX + (xStep * i),
y: downY + (yStep * i),
type: TouchType.Move
}
console.info('move touch started: ' + JSON.stringify(movePoint))
ret = sendTouchEvent(movePoint)
if (ret == false) {
break;
}
await this.sleep(5)
}
console.info('start to up')
if (drag) {
await this.sleep(100)
}
var upPoint: TouchObject = {
id: 1,
x: upX,
y: upY,
type: TouchType.Up,
}
console.info('up touch started: ' + JSON.stringify(upPoint))
sendTouchEvent(upPoint)
await this.sleep(500)
}
}

View File

@ -0,0 +1,119 @@
// @ts-nocheck
import window from '@ohos.window';
import Logger from './Logger';
import image from '@ohos.multimedia.image';
import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import fs from '@ohos.file.fs';
import DateTimeUtil from './DateTimeUtil';
const TAG: string = '[windowSnap]';
const INFO = {
"img": {
prefix: 'IMG_',
suffix: '.webp',
directory: mediaLibrary.DirectoryType.DIR_IMAGE,
mediaType: mediaLibrary.MediaType.IMAGE
},
"txt": {
prefix: 'TXT_',
suffix: '.txt',
directory: mediaLibrary.DirectoryType.DIR_DOCUMENTS,
mediaType: mediaLibrary.MediaType.FILE
}
}
class windowSnap {
async createAndGetFile(context: any, type) {
Logger.info(TAG, `createAndGetFile start`)
let mediaTest = mediaLibrary.getMediaLibrary(context)
let info = INFO[type]
//文件名为时间戳格式
//let dateTimeUtil=new DateTimeUtil()
//let name=`${dateTimeUtil.getDate()}_${dateTimeUtil.getTime()}`
//文件名固定用于自动化UI对比
let name = "test"
let displayName = `${info.prefix}${name}${info.suffix}`
let option = {
selections: mediaLibrary.FileKey.DISPLAY_NAME + '=?',
selectionArgs: [displayName],
}
let fetchFileResult = await mediaTest.getFileAssets(option);
if (fetchFileResult.getCount()) {
let asset = await fetchFileResult.getFirstObject();
await mediaTest.deleteAsset(asset.uri)
}
let publicPath = await mediaTest.getPublicDirectory(info.directory)
Logger.info(TAG, `publicPath=${publicPath},displayName=${displayName}`)
return await mediaTest.createAsset(info.mediaType, displayName, publicPath)
}
async savePicture(data: image.PixelMap, context: any) {
let packOpts: image.PackingOption = {
format: "image/webp", quality: 100
}
let imagePackerApi = image.createImagePacker()
let arrayBuffer = await imagePackerApi.packing(data, packOpts)
let fileAsset = await this.createAndGetFile(context, "img")
let fd = await fileAsset.open('Rw')
imagePackerApi.release()
try {
await fs.write(fd, arrayBuffer)
} catch (err) {
Logger.error(TAG, `write failed ,code is ${err.code},message is ${err.message}`)
}
await fileAsset.close(fd)
Logger.info(TAG, `write picture done`)
}
async saveTXT(data, context) {
let fileAsset = await this.createAndGetFile(context, "txt")
let fd = await fileAsset.open('Rw')
try {
await fs.write(fd, data)
} catch (err) {
Logger.error(TAG, `write failed ,code is ${err.code},message is ${err.message}`)
}
await fileAsset.close(fd)
Logger.info(TAG, `write txt done`)
}
/*
* &
* ability的context
* snapShot
* savePicture/storage/media/100/local/files/Pictures/IMG_test.webp
* saveTXT/storage/media/100/local/files/Documents/TXT_test.txt
**/
async snapShot(context) {
//获取窗口
Logger.info(TAG, 'start snapshot')
let windowClass = null;
try {
windowClass = window.findWindow('floatWindow');
Logger.info(TAG, 'find window success')
} catch (exception) {
Logger.error(TAG, 'Failed to find the window. Cause:' + JSON.stringify(exception))
}
//截屏
windowClass.snapshot((err, data) => {
if (err.code) {
console.error(TAG, 'Failed to snapshot window. Cause:' + JSON.stringify(err));
return;
}
this.savePicture(data, context)
const readBuffer = new ArrayBuffer(data.getPixelBytesNumber())
data.readPixelsToBuffer(readBuffer, () => {
//保存成像素值
this.saveTXT(readBuffer, context)
})
data.release();
});
}
}
export default new windowSnap()

View File

@ -0,0 +1,88 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import bundleManager from '@ohos.bundle.bundleManager';
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import UIAbility from '@ohos.app.ability.UIAbility';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
import hilog from '@ohos.hilog';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
import window from '@ohos.window';
import Logger from '../test/model/Logger'
const TAG: string = '[createWindow]'
export default class TestAbility extends UIAbility {
sleep(time) {
return new Promise((resolve) => setTimeout(resolve, time));
}
onCreate(want, launchParam) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
var abilityDelegator: any
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var abilityDelegatorArguments: any
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!');
Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
}
onDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy');
}
onWindowStageCreate(windowStage: window.WindowStage) {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate');
globalThis.context = this.context
//系统授权,读写权限
let atManager = abilityAccessCtrl.createAtManager();
let appFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION;
let permissionFlags = 0;
bundleManager.getBundleInfoForSelf(appFlags, (err, data) => {
if (err) {
Logger.error(TAG, 'getAllApplicationInfo failed: %{public}s', err.message);
console.error("")
}
let tokenID = data.appInfo.accessTokenId; //系统应用可以通过bundleManager.getApplicationInfo获取普通应用可以通过bundleManager.getBundleInfoForSelf获取
atManager.grantUserGrantedPermission(tokenID, 'ohos.permission.READ_MEDIA', permissionFlags, (err, data) => {
if (err) {
Logger.info(TAG, `grantUserGrantedPermission fail, err->${JSON.stringify(err)}`)
}
})
atManager.grantUserGrantedPermission(tokenID, 'ohos.permission.WRITE_MEDIA', permissionFlags, (err, data) => {
if (err) {
Logger.info(TAG, `grantUserGrantedPermission fail, err->${JSON.stringify(err)}`)
}
})
})
}
onWindowStageDestroy() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy');
}
onForeground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground');
}
onBackground() {
hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground');
}
}

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.stroke(Color.Black)
.strokeWidth(3)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
@State pointsValue: Array<any> = [[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'points') {
this.pointsValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points(this.pointsValue)
.stroke(Color.Black)
.strokeWidth(3)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,81 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 300
@State heightValue: number = 50
@State strokeLineCapValue: LineCapStyle = LineCapStyle.Butt
@State strokeLineJoinValue: LineJoinStyle = LineJoinStyle.Miter
@State strokeMiterLimitValue: number = 4
@State strokeOpacityValue: number = 1
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeLineCap') {
this.strokeLineCapValue = message.value
}
if (message.name == 'strokeLineJoin') {
this.strokeLineJoinValue = message.value
}
if (message.name == 'strokeMiterLimit') {
this.strokeMiterLimitValue = message.value
}
if (message.name == 'strokeOpacity') {
this.strokeOpacityValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:宽度'300'-高度'50'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.strokeLineCap(this.strokeLineCapValue)
.strokeLineJoin(this.strokeLineJoinValue)
.strokeMiterLimit(this.strokeMiterLimitValue)
.strokeOpacity(this.strokeOpacityValue)
.fill(Color.Pink)
.stroke(Color.Black)
.strokeWidth(4)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 300
@State heightValue: number = 50
@State fillOpacityValue: number = 0
@State pointsValue: Array<any> = [[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]
@State strokeWidthValue: number = 1
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'points') {
this.pointsValue = message.value
}
if (message.name == 'fillOpacity') {
this.fillOpacityValue = message.value
}
if (message.name == 'strokeWidth') {
this.strokeWidthValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points(this.pointsValue)
.fillOpacity(this.fillOpacityValue)
.strokeWidth(this.strokeWidthValue)
.stroke(Color.Blue)
.backgroundColor(Color.Red)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
@State strokeLineCapValue: LineCapStyle = LineCapStyle.Butt
@State antiAliasValue: boolean = true
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeLineCap') {
this.strokeLineCapValue = message.value
}
if (message.name == 'antiAlias') {
this.antiAliasValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.strokeLineCap(this.strokeLineCapValue)
.antiAlias(this.antiAliasValue)
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(8)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'150'-宽度'150'
.width(150)
.height(150)
// 在矩形框中绘制一个五边形,起点(150, 0),依次经过(0, 150)、(120, 1100)和(180, 1100),终点(1100, 150)
.points([[150, 0], [0, 150], [120, 1100], [180, 1100], [1100, 150]])
.position({x:10,y:10})
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(5)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,54 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'150'-宽度'150'
.width(150)
.height(150)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.fillOpacity(0)
.stroke(Color.Blue)
.strokeWidth(5)
.borderColor(Color.Red)
.borderWidth(5)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,59 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
// 在 100 * 100 的矩形框中绘制一个三角形,起点(0, 0),经过(50, 100),终点(100, 0)
Polygon({ width: 100, height: 100 })
.points([[0, 0], [50, 100], [100, 0]])
.fill(Color.Green)
.margin({ top: 20 })
// 在 100 * 100 的矩形框中绘制一个四边形,起点(0, 0),经过(0, 100)和(100, 100),终点(100, 0)
Polygon().width(100).height(100)
.points([[0, 0], [0, 100], [100, 100], [100, 0]])
.fillOpacity(0)
.strokeWidth(5)
.stroke(Color.Blue)
.margin({ top: 20 })
// 在 100 * 100 的矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
Polygon().width(100).height(100)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.fill(Color.Red)
.fillOpacity(0.6)
.margin({ top: 20 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
@State pointsValue: Array<any> = [[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]
@State fillColor: Color = Color.White
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'points') {
this.pointsValue = message.value
}
if (message.name == 'fillColor') {
this.fillColor = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points(this.pointsValue)
.fill(this.fillColor)
.stroke(Color.Black)
.strokeWidth(3)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
@State pointsValue: Array<any> = [[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]
@State fillColor: Color = Color.White
@State fillOpacityValue: number = 0
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'points') {
this.pointsValue = message.value
}
if (message.name == 'fillColor') {
this.fillColor = message.value
}
if (message.name == 'fillOpacity') {
this.fillOpacityValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points(this.pointsValue)
.fill(this.fillColor)
.fillOpacity(this.fillOpacityValue)
.stroke(Color.Black)
.strokeWidth(3)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,78 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
@State pointsValue: Array<any> = [[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]
@State fillColor: Color = Color.White
@State fillOpacityValue: number = 0
@State strokeColor: Color = Color.Black
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'points') {
this.pointsValue = message.value
}
if (message.name == 'fillColor') {
this.fillColor = message.value
}
if (message.name == 'fillOpacity') {
this.fillOpacityValue = message.value
}
if (message.name == 'strokeColor') {
this.strokeColor = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points(this.pointsValue)
.fill(this.fillColor)
.fillOpacity(this.fillOpacityValue)
.stroke(this.strokeColor)
.strokeWidth(3)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
@State strokeDashArrayValue: Array<any> = []
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeDashArray') {
this.strokeDashArrayValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.strokeDashArray(this.strokeDashArrayValue)
.fill(Color.White)
.stroke(Color.Black)
.strokeWidth(8)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 300
@State heightValue: number = 50
@State strokeDashArrayValue: Array<any> = [20]
@State strokeDashOffsetValue: number = 0
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeDashArray') {
this.strokeDashArrayValue = message.value
}
if (message.name == 'strokeDashOffset') {
this.strokeDashOffsetValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.strokeDashArray(this.strokeDashArrayValue)
.strokeDashOffset(this.strokeDashOffsetValue)
.fill(Color.Pink)
.stroke(Color.Black)
.strokeWidth(4)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
@State strokeLineCapValue: LineCapStyle = LineCapStyle.Butt
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeLineCap') {
this.strokeLineCapValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.strokeLineCap(this.strokeLineCapValue)
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(8)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 300
@State heightValue: number = 50
@State strokeLineCapValue: LineCapStyle = LineCapStyle.Butt
@State strokeLineJoinValue: LineJoinStyle = LineJoinStyle.Miter
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeLineCap') {
this.strokeLineCapValue = message.value
}
if (message.name == 'strokeLineJoin') {
this.strokeLineJoinValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.strokeLineCap(this.strokeLineCapValue)
.strokeLineJoin(this.strokeLineJoinValue)
.fill(Color.Pink)
.stroke(Color.Black)
.strokeWidth(4)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,76 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
@State strokeLineCapValue: LineCapStyle = LineCapStyle.Butt
@State strokeLineJoinValue: LineJoinStyle = LineJoinStyle.Miter
@State strokeMiterLimitValue: number = 4
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeLineCap') {
this.strokeLineCapValue = message.value
}
if (message.name == 'strokeLineJoin') {
this.strokeLineJoinValue = message.value
}
if (message.name == 'strokeMiterLimit') {
this.strokeMiterLimitValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个三角形,[['10', 0], ['40', '100'], ['70', 0]]
.points([['10', 0], ['40', '100'], ['70', 0]])
.strokeLineCap(this.strokeLineCapValue)
.strokeLineJoin(this.strokeLineJoinValue)
.strokeMiterLimit(this.strokeMiterLimitValue)
.fill(Color.Pink)
.stroke(0xEE8443)
.strokeWidth(10)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,67 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State widthValue: number = 100
@State heightValue: number = 100
@State strokeLineCapValue: LineCapStyle = LineCapStyle.Butt
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeLineCap') {
this.strokeLineCapValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.strokeLineCap(this.strokeLineCapValue)
//.antiAlias(this.antiAliasValue) 不设置antiAlias
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(8)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,66 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
@State pointsValue: Array<any> = [[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'points') {
this.pointsValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points(this.pointsValue)
//.fill(this.fillColor) 不设置fill
.stroke(Color.Black)
.strokeWidth(3)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'150aaaa'-宽度'150'
.width('150')
.height('150aaaa')
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.stroke(Color.Black)
.strokeWidth(3)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 100
@State heightValue: number = 100
@State pointsValue: Array<any> = [[0, 0]]
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'points') {
this.pointsValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个图形,[[0, 0]]
.points(this.pointsValue)
.stroke(Color.Black)
.strokeWidth(3)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State widthValue: number = 100
@State heightValue: number = 100
@State pointsValue: Array<any> = [[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]
@State fillColor: Color = Color.White
@State fillOpacityValue: number = 0
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'points') {
this.pointsValue = message.value
}
if (message.name == 'fillColor') {
this.fillColor = message.value
}
if (message.name == 'fillOpacity') {
this.fillOpacityValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points(this.pointsValue)
.fill(this.fillColor)
.fillOpacity(this.fillOpacityValue)
//.stroke(this.strokeColor) 不设置stroke
.strokeWidth(3)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State widthValue: number = 100
@State heightValue: number = 100
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
//.strokeDashArray(this.strokeDashArrayValue) 不设置strokeDashArray
.fill(Color.White)
.stroke(Color.Black)
.strokeWidth(8)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State message: string = 'Hello'
@State widthValue: number = 300
@State heightValue: number = 50
@State strokeDashArrayValue: Array<any> = [20]
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeDashArray') {
this.strokeDashArrayValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.strokeDashArray(this.strokeDashArrayValue)
//.strokeDashOffset(this.strokeDashOffsetValue) 不设置strokeDashOffset
.fill(Color.Pink)
.stroke(Color.Black)
.strokeWidth(4)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State widthValue: number = 100
@State heightValue: number = 100
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
//.strokeLineCap(this.strokeLineCapValue) 不设置strokeLineCap
.fillOpacity(0)
.stroke(Color.Black)
.strokeWidth(8)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,67 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State widthValue: number = 300
@State heightValue: number = 50
@State strokeLineCapValue: LineCapStyle = LineCapStyle.Butt
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeLineCap') {
this.strokeLineCapValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.strokeLineCap(this.strokeLineCapValue)
//.strokeLineJoin(this.strokeLineJoinValue) 不设置strokeLineJoin
.fill(Color.Pink)
.stroke(Color.Black)
.strokeWidth(4)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,72 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State widthValue: number = 100
@State heightValue: number = 100
@State strokeLineCapValue: LineCapStyle = LineCapStyle.Butt
@State strokeLineJoinValue: LineJoinStyle = LineJoinStyle.Miter
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeLineCap') {
this.strokeLineCapValue = message.value
}
if (message.name == 'strokeLineJoin') {
this.strokeLineJoinValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'100'-宽度'100'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个三角形,[['10', 0], ['40', '100'], ['70', 0]]
.points([['10', 0], ['40', '100'], ['70', 0]])
.strokeLineCap(this.strokeLineCapValue)
.strokeLineJoin(this.strokeLineJoinValue)
//.strokeMiterLimit(this.strokeMiterLimitValue) 不设置strokeMiterLimit
.fill(Color.Pink)
.stroke(0xEE8443)
.strokeWidth(10)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,77 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State widthValue: number = 300
@State heightValue: number = 50
@State strokeLineCapValue: LineCapStyle = LineCapStyle.Butt
@State strokeLineJoinValue: LineJoinStyle = LineJoinStyle.Miter
@State strokeMiterLimitValue: number = 4
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'strokeLineCap') {
this.strokeLineCapValue = message.value
}
if (message.name == 'strokeLineJoin') {
this.strokeLineJoinValue = message.value
}
if (message.name == 'strokeMiterLimit') {
this.strokeMiterLimitValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:宽度'300'-高度'50'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.strokeLineCap(this.strokeLineCapValue)
.strokeLineJoin(this.strokeLineJoinValue)
.strokeMiterLimit(this.strokeMiterLimitValue)
//.strokeOpacity(this.strokeOpacityValue) 不设置strokeOpacity
.fill(Color.Pink)
.stroke(Color.Black)
.strokeWidth(4)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,69 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
@State widthValue: number = 300
@State heightValue: number = 50
@State fillOpacityValue: number = 0
@State pointsValue: Array<any> = [[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]]
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
if (message.name == 'width') {
this.widthValue = message.value
}
if (message.name == 'height') {
this.heightValue = message.value
}
if (message.name == 'points') {
this.pointsValue = message.value
}
if (message.name == 'fillOpacity') {
this.fillOpacityValue = message.value
}
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'50'-宽度'300'
.width(this.widthValue)
.height(this.heightValue)
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points(this.pointsValue)
.fillOpacity(this.fillOpacityValue)
//.strokeWidth(this.strokeWidthValue) 不设置StrokeWidth
.stroke(Color.Blue)
.backgroundColor(Color.Red)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MessageManager, Callback } from '../../../test/model/MessageManager';
import { AxisValue } from '@ohos.multimodalInput.mouseEvent';
@Entry
@Component
struct Index {
messageManager: MessageManager = new MessageManager()
onPageShow() {
console.info('NavDestination onPageShow')
globalThis.value = {
name: 'messageManager', message: this.messageManager
}
let callback: Callback = (message: any) => {
console.error('message = ' + message.name + "--" + message.value)
}
this.messageManager.registerCallback(callback)
}
build() {
Column() {
Polygon()
// Polygon:高度'150'-宽度'150aaaa'
.width('150aaaa')
.height('150')
// 在矩形框中绘制一个五边形,起点(50, 0),依次经过(0, 50)、(20, 100)和(80, 100),终点(100, 50)
.points([[50, 0], [0, 50], [20, 100], [80, 100], [100, 50]])
.stroke(Color.Black)
.strokeWidth(3)
.backgroundColor(Color.Brown)
.margin({ top: 100 })
}
.width('100%')
.height('100%')
}
}

View File

@ -0,0 +1,49 @@
import hilog from '@ohos.hilog';
import TestRunner from '@ohos.application.testRunner';
import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry';
var abilityDelegator = undefined
var abilityDelegatorArguments = undefined
async function onAbilityCreateCallback() {
hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback');
}
async function addAbilityMonitorCallback(err: any) {
hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? '');
}
export default class OpenHarmonyTestRunner implements TestRunner {
constructor() {
}
onPrepare() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare ');
}
async onRun() {
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run');
abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'
let lMonitor = {
abilityName: testAbilityName,
onAbilityCreate: onAbilityCreateCallback,
};
abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback)
var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName
var debug = abilityDelegatorArguments.parameters['-D']
if (debug == 'true')
{
cmd += ' -D'
}
hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd);
abilityDelegator.executeShellCommand(cmd,
(err: any, d: any) => {
hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? '');
hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? '');
})
hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end');
}
}

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"module": {
"name": "entry_test",
"type": "feature",
"description": "$string:module_test_desc",
"mainElement": "TestAbility",
"deviceTypes": [
"default",
"tablet"
],
"deliveryWithInstall": true,
"installationFree": false,
"pages": "$profile:test_pages",
"requestPermissions": [
{
"name": "ohos.permission.SYSTEM_FLOAT_WINDOW",
"usedScene": {
"abilities":[
"EntryAbility"
],
"when": "inuse"
}
},{
"name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"
},{
"name": "ohos.permission.WRITE_MEDIA"
},
{
"name": "ohos.permission.READ_MEDIA"
}
],
"abilities": [
{
"name": "TestAbility",
"srcEntrance": "./ets/testability/TestAbility.ets",
"description": "$string:TestAbility_desc",
"icon": "$media:icon",
"label": "$string:TestAbility_label",
"visible": true,
"startWindowIcon": "$media:icon",
"startWindowBackground": "$color:start_window_background",
"skills": [
{
"actions": [
"action.system.home"
],
"entities": [
"entity.system.home"
]
}
]
}
]
}
}

View File

@ -0,0 +1,12 @@
{
"color": [
{
"name": "start_window_background",
"value": "#FFFFFF"
},
{
"name": "Yellow",
"value": "#ffff00"
}
]
}

View File

@ -0,0 +1,16 @@
{
"string": [
{
"name": "module_test_desc",
"value": "test ability description"
},
{
"name": "TestAbility_desc",
"value": "the test ability"
},
{
"name": "TestAbility_label",
"value": "test label"
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,33 @@
{
"src": [
"testability/pages/polygon/Index",
"testability/pages/polygon/Index1",
"testability/pages/polygon/Index2",
"testability/pages/polygon/Index3",
"testability/pages/polygon/Index4",
"testability/pages/polygon/Index5",
"testability/pages/polygon/Index6",
"testability/pages/polygon/Index7",
"testability/pages/polygon/Index8",
"testability/pages/polygon/Index9",
"testability/pages/polygon/Index10",
"testability/pages/polygon/Index11",
"testability/pages/polygon/Index12",
"testability/pages/polygon/Index13",
"testability/pages/polygon/Index14",
"testability/pages/polygon/Index15",
"testability/pages/polygon/noStrokeDashArray",
"testability/pages/polygon/noStrokeDashOffset",
"testability/pages/polygon/noStrokeLineCap",
"testability/pages/polygon/noStrokeLineJoin",
"testability/pages/polygon/noStrokeMiterLimit",
"testability/pages/polygon/noStrokeOpacity",
"testability/pages/polygon/noStrokeWidth",
"testability/pages/polygon/noAntiAlias",
"testability/pages/polygon/noPoints",
"testability/pages/polygon/noFill",
"testability/pages/polygon/noStroke",
"testability/pages/polygon/noWidth",
"testability/pages/polygon/noHeight"
]
}

View File

@ -0,0 +1,21 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"hvigorVersion": "2.1.1",
"dependencies": {
"@ohos/hvigor-ohos-plugin": "2.1.1"
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
export { appTasks } from '@ohos/hvigor-ohos-plugin';

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#!/bin/bash
# ----------------------------------------------------------------------------
# Hvigor startup script, version 1.0.0
#
# Required ENV vars:
# ------------------
# NODE_HOME - location of a Node home dir
# or
# Add /usr/local/nodejs/bin to the PATH environment variable
# ----------------------------------------------------------------------------
HVIGOR_APP_HOME=$(dirname $(readlink -f $0))
HVIGOR_WRAPPER_SCRIPT=${HVIGOR_APP_HOME}/hvigor/hvigor-wrapper.js
warn() {
echo ""
echo -e "\033[1;33m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
error() {
echo ""
echo -e "\033[1;31m`date '+[%Y-%m-%d %H:%M:%S]'`$@\033[0m"
}
fail() {
error "$@"
exit 1
}
# Determine node to start hvigor wrapper script
if [ -n "${NODE_HOME}" ];then
EXECUTABLE_NODE="${NODE_HOME}/bin/node"
if [ ! -x "$EXECUTABLE_NODE" ];then
fail "ERROR: NODE_HOME is set to an invalid directory,check $NODE_HOME\n\nPlease set NODE_HOME in your environment to the location where your nodejs installed"
fi
else
EXECUTABLE_NODE="node"
which ${EXECUTABLE_NODE} > /dev/null 2>&1 || fail "ERROR: NODE_HOME is not set and not 'node' command found in your path"
fi
# Check hvigor wrapper script
if [ ! -r "$HVIGOR_WRAPPER_SCRIPT" ];then
fail "ERROR: Couldn't find hvigor/hvigor-wrapper.js in ${HVIGOR_APP_HOME}"
fi
# start hvigor-wrapper script
exec "${EXECUTABLE_NODE}" \
"${HVIGOR_WRAPPER_SCRIPT}" "$@"

View File

@ -0,0 +1,79 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Hvigor startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
set WRAPPER_MODULE_PATH=%APP_HOME%\hvigor\hvigor-wrapper.js
set NODE_EXE=node.exe
goto start
:start
@rem Find node.exe
if defined NODE_HOME goto findNodeFromNodeHome
%NODE_EXE% --version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:findNodeFromNodeHome
set NODE_HOME=%NODE_HOME:"=%
set NODE_EXE_PATH=%NODE_HOME%/%NODE_EXE%
if exist "%NODE_EXE_PATH%" goto execute
echo.
echo ERROR: NODE_HOME is not set and no 'node' command could be found in your PATH.
echo.
echo Please set the NODE_HOME variable in your environment to match the
echo location of your NodeJs installation.
goto fail
:execute
@rem Execute hvigor
"%NODE_EXE%" %WRAPPER_MODULE_PATH% %*
if "%ERRORLEVEL%" == "0" goto hvigorwEnd
:fail
exit /b 1
:hvigorwEnd
if "%OS%" == "Windows_NT" endlocal
:end

View File

@ -0,0 +1,9 @@
# This file is automatically generated by DevEco Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# For customization when using a Version Control System, please read the header note.
hwsdk.dir=C:/Users/qiaochenl/AppData/Local/Huawei/Sdk
nodejs.dir=C:/Users/qiaochenl/nodejs

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"lockfileVersion": 1,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6",
"@ohos/hypium@^1.0.6": "@ohos/hypium@1.0.6"
},
"packages": {
"@ohos/hypium@1.0.6": {
"resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz",
"integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ=="
}
}
}

View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2023 iSoftStone Information Technology (Group) Co.,Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
{
"license": "",
"devDependencies": {
"@ohos/hypium": "1.0.6"
},
"author": "",
"name": "polygontest",
"description": "Please describe the basic information.",
"main": "",
"version": "1.0.0",
"dependencies": {}
}