• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"
16import { RenderNode, DrawContext } from "@ohos.arkui.node"
17import drawing from "@ohos.graphics.drawing"
18import common2D from "@ohos.graphics.common2D"
19import image from "@ohos.multimedia.image"
20import { UiDriver, BY, ON, PointerMatrix } from '@ohos.UiTest'
21import { BusinessError } from '@ohos.base';
22import buffer from '@ohos.buffer';
23
24export default function graphicDrawing(context, windowStage, abilityStorage) {
25  describe('graphic_drawing_test', function () {
26    console.log('describe graphic_drawing_test start!!!')
27
28    function buttonClick(buttonText, msgStr) {
29      console.info(msgStr + `case come in buttonClick fun`)
30      return new Promise(async (resolve, reject) => {
31        let driver = await UiDriver.create()
32        console.info(msgStr + `case come in buttonClick fun 222`)
33        console.info(msgStr + `driver is ${JSON.stringify(driver)}`)
34        await sleep(1000)
35        console.info(msgStr + `UiDriver start`)
36        let button = null
37        button = await driver.findComponent(BY.text(buttonText))
38        console.info(msgStr + `button is ${JSON.stringify(button)}`)
39        await sleep(1000)
40        if (button) {
41          console.info(msgStr + `button click begin`)
42          await button.click()
43          console.info(msgStr + `button click end`)
44          resolve(msgStr + 'get button successed')
45        } else {
46          console.info(msgStr + `inter else: button is null`)
47          reject(msgStr + 'get button failed')
48        }
49      })
50    }
51
52    async function sleep(time) {
53      let timeoutId = null;
54      let promise = new Promise(resolve => {
55        timeoutId = setTimeout(() => {
56          resolve('sleep finished');
57        }, time);
58      })
59      let result = await promise;
60      clearTimeout(timeoutId)
61    }
62    let blendModeArr = ['CLEAR', 'SRC', 'DST', 'SRC_OVER', 'DST_OVER', 'SRC_IN', 'DST_IN', 'SRC_OUT',
63    'DST_OUT', 'SRC_ATOP', 'DST_ATOP', 'XOR', 'PLUS', 'MODULATE', 'SCREEN', 'OVERLAY', 'DARKEN',
64    'LIGHTEN', 'COLOR_DODGE', 'COLOR_BURN', 'HARD_LIGHT', 'SOFT_LIGHT', 'DIFFERENCE', 'EXCLUSION',
65    'MULTIPLY', 'HUE', 'SATURATION', 'COLOR', 'LUMINOSITY']
66
67    let longText = "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字" +
68    "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字" +
69    "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字" +
70    "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字" +
71    "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字" +
72    "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字" +
73    "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字" +
74    "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字" +
75    "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字" +
76    "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字" +
77    "这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字这是一段很长很长的文字"
78    let pixel;
79    beforeAll(async function () {
80      const color: ArrayBuffer = new ArrayBuffer(40000); // 96为需要创建的像素buffer大小,取值为:height * width *4
81      let opts: image.InitializationOptions = {
82        editable: true, pixelFormat: 3, size: {
83          height: 100, width: 100
84        }
85      }
86      pixel = await image.createPixelMap(color, opts);
87    })
88    /**
89     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0010
90     * @tc.name      : testEnumBlendMode
91     * @tc.desc      : To test the enum value of BlendMode.
92     * @tc.size      : MediumTest
93     * @tc.type      : Function
94     * @tc.level     : Level3
95     */
96    it('testEnumBlendMode', 0, async function () {
97      let msg = "testEnumBlendMode"
98      console.info(msg + 'begin');
99      try {
100        expect(0).assertEqual(drawing.BlendMode.CLEAR);
101        expect(1).assertEqual(drawing.BlendMode.SRC);
102        expect(2).assertEqual(drawing.BlendMode.DST);
103        expect(3).assertEqual(drawing.BlendMode.SRC_OVER);
104        expect(4).assertEqual(drawing.BlendMode.DST_OVER);
105        expect(5).assertEqual(drawing.BlendMode.SRC_IN);
106        expect(6).assertEqual(drawing.BlendMode.DST_IN);
107        expect(7).assertEqual(drawing.BlendMode.SRC_OUT);
108        expect(8).assertEqual(drawing.BlendMode.DST_OUT);
109        expect(9).assertEqual(drawing.BlendMode.SRC_ATOP);
110        expect(10).assertEqual(drawing.BlendMode.DST_ATOP);
111        expect(11).assertEqual(drawing.BlendMode.XOR);
112        expect(12).assertEqual(drawing.BlendMode.PLUS);
113        expect(13).assertEqual(drawing.BlendMode.MODULATE);
114        expect(14).assertEqual(drawing.BlendMode.SCREEN);
115        expect(15).assertEqual(drawing.BlendMode.OVERLAY);
116        expect(16).assertEqual(drawing.BlendMode.DARKEN);
117        expect(17).assertEqual(drawing.BlendMode.LIGHTEN);
118        expect(18).assertEqual(drawing.BlendMode.COLOR_DODGE);
119        expect(19).assertEqual(drawing.BlendMode.COLOR_BURN);
120        expect(20).assertEqual(drawing.BlendMode.HARD_LIGHT);
121        expect(21).assertEqual(drawing.BlendMode.SOFT_LIGHT);
122        expect(22).assertEqual(drawing.BlendMode.DIFFERENCE);
123        expect(23).assertEqual(drawing.BlendMode.EXCLUSION);
124        expect(24).assertEqual(drawing.BlendMode.MULTIPLY);
125        expect(25).assertEqual(drawing.BlendMode.HUE);
126        expect(26).assertEqual(drawing.BlendMode.SATURATION);
127        expect(27).assertEqual(drawing.BlendMode.COLOR);
128        expect(28).assertEqual(drawing.BlendMode.LUMINOSITY);
129      } catch (err) {
130        console.info(msg + 'test enum value of BlendMode error ' + JSON.stringify(err));
131        expect().assertFail();
132      }
133    })
134    /**
135     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0020
136     * @tc.name      : testPath_MoveTo_Normal_Parameter
137     * @tc.desc      : This parameter is used to set the start point of a user-defined path
138     * @tc.size      : MediumTest
139     * @tc.type      : Function
140     * @tc.level     : Level 3
141     */
142    it('testPath_MoveTo_Normal_Parameter', 0, async function () {
143      let msg = "testPath_MoveTo_Normal_Parameter"
144      console.info(msg + 'begin');
145      let path = new drawing.Path();
146      try {
147        path.moveTo(10, 10);
148      } catch (err) {
149        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
150        expect().assertFail();
151      }
152    })
153    /**
154     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0030
155     * @tc.name      : testPath_MoveTo_Minus_Parameter
156     * @tc.desc      : This parameter is used to set the start point of a user-defined path
157     * @tc.size      : MediumTest
158     * @tc.type      : Function
159     * @tc.level     : Level 3
160     */
161    it('testPath_MoveTo_Minus_Parameter', 0, async function () {
162      let msg = "testPath_MoveTo_Minus_Parameter"
163      console.info(msg + 'begin');
164      let path = new drawing.Path();
165      try {
166        path.moveTo(-1, -20);
167      } catch (err) {
168        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
169        expect().assertFail();
170      }
171    })
172    /**
173     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0040
174     * @tc.name      : testPath_MoveTo_NonInteger_Parameter
175     * @tc.desc      : This parameter is used to set the start point of a user-defined path
176     * @tc.size      : MediumTest
177     * @tc.type      : Function
178     * @tc.level     : Level 3
179     */
180    it('testPath_MoveTo_NonInteger_Parameter', 0, async function () {
181      let msg = "testPath_MoveTo_NonInteger_Parameter"
182      console.info(msg + 'begin');
183      let path = new drawing.Path();
184      try {
185        path.moveTo(50.525, 10.50256);
186      } catch (err) {
187        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
188        expect().assertFail();
189      }
190    })
191    /**
192     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0050
193     * @tc.name      : testPath_LineTo_Normal_Parameter
194     * @tc.desc      : Used to add a line segment from the last point of the path to the destination point
195     * @tc.size      : MediumTest
196     * @tc.type      : Function
197     * @tc.level     : Level 3
198     */
199    it('testPath_LineTo_Normal_Parameter', 0, async function () {
200      let msg = "testPath_LineTo_Normal_Parameter"
201      console.info(msg + 'begin');
202      let path = new drawing.Path();
203      try {
204        path.moveTo(10, 10);
205      } catch (err) {
206        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
207        expect().assertFail();
208      }
209      try {
210        path.lineTo(10, 15);
211      } catch (err) {
212        console.info(msg + 'lineTo error cause: ' + JSON.stringify(err));
213        expect().assertFail();
214      }
215    })
216    /**
217     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0060
218     * @tc.name      : testPath_LineTo_Minus_Parameter
219     * @tc.desc      : Used to add a line segment from the last point of the path to the destination point
220     * @tc.size      : MediumTest
221     * @tc.type      : Function
222     * @tc.level     : Level 3
223     */
224    it('testPath_LineTo_Minus_Parameter', 0, async function () {
225      let msg = "testPath_LineTo_Minus_Parameter"
226      console.info(msg + 'begin');
227      let path = new drawing.Path();
228      try {
229        path.moveTo(10, 10);
230      } catch (err) {
231        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
232        expect().assertFail();
233      }
234      try {
235        path.lineTo(-10, -30);
236      } catch (err) {
237        console.info(msg + 'lineTo error cause: ' + JSON.stringify(err));
238        expect().assertFail();
239      }
240    })
241    /**
242     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0070
243     * @tc.name      : testPath_LineTo_NonInteger_Parameter
244     * @tc.desc      : Used to add a line segment from the last point of the path to the destination point
245     * @tc.size      : MediumTest
246     * @tc.type      : Function
247     * @tc.level     : Level 3
248     */
249    it('testPath_LineTo_NonInteger_Parameter', 0, async function () {
250      let msg = "testPath_LineTo_NonInteger_Parameter"
251      console.info(msg + 'begin');
252      let path = new drawing.Path();
253      try {
254        path.moveTo(10, 10);
255      } catch (err) {
256        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
257        expect().assertFail();
258      }
259      try {
260        path.lineTo(23.5645, 54.156);
261      } catch (err) {
262        console.info(msg + 'lineTo error cause: ' + JSON.stringify(err));
263        expect().assertFail();
264      }
265    })
266    /**
267     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0080
268     * @tc.name      : testPath_ArcTo_Normal_Parameter
269     * @tc.desc      : Used to add an arc to a path
270     * @tc.size      : MediumTest
271     * @tc.type      : Function
272     * @tc.level     : Level 3
273     */
274    it('testPath_ArcTo_Normal_Parameter', 0, async function () {
275      let msg = "testPath_ArcTo_Normal_Parameter"
276      console.info(msg + 'begin');
277      let path = new drawing.Path();
278      try {
279        path.moveTo(10, 10);
280      } catch (err) {
281        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
282        expect().assertFail();
283      }
284      try {
285        path.arcTo(10, 15, 10, 10, 10, 10);
286      } catch (err) {
287        console.info(msg + 'arcTo error cause: ' + JSON.stringify(err));
288        expect().assertFail();
289      }
290    })
291    /**
292     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0650
293     * @tc.name      : testPath_ArcTo_Minus_Parameter
294     * @tc.desc      : Used to add an arc to a path
295     * @tc.size      : MediumTest
296     * @tc.type      : Function
297     * @tc.level     : Level 3
298     */
299    it('testPath_ArcTo_Minus_Parameter', 0, async function () {
300      let msg = "testPath_ArcTo_Minus_Parameter"
301      console.info(msg + 'begin');
302      let path = new drawing.Path();
303      try {
304        path.moveTo(10, 10);
305      } catch (err) {
306        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
307        expect().assertFail();
308      }
309      try {
310        path.arcTo(-10, -15.56, -10, -10, -10, -10.25);
311      } catch (err) {
312        console.info(msg + 'arcTo error cause: ' + JSON.stringify(err));
313        expect().assertFail();
314      }
315    })
316    /**
317     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0660
318     * @tc.name      : testPath_ArcTo_NonInteger_Parameter
319     * @tc.desc      : Used to add an arc to a path
320     * @tc.size      : MediumTest
321     * @tc.type      : Function
322     * @tc.level     : Level 3
323     */
324    it('testPath_ArcTo_NonInteger_Parameter', 0, async function () {
325      let msg = "testPath_ArcTo_NonInteger_Parameter"
326      console.info(msg + 'begin');
327      let path = new drawing.Path();
328      try {
329        path.moveTo(10, 10);
330      } catch (err) {
331        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
332        expect().assertFail();
333      }
334      try {
335        path.arcTo(10.56, 15.06, 10.89, 102.59, 100.44, 10.25);
336      } catch (err) {
337        console.info(msg + 'arcTo error cause: ' + JSON.stringify(err));
338        expect().assertFail();
339      }
340    })
341    /**
342     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0090
343     * @tc.name      : testPath_QuadTo_Normal_Parameter
344     * @tc.desc      : Used to add a second order Bessel smooth curve from the last point of the path to the destination point
345     * @tc.size      : MediumTest
346     * @tc.type      : Function
347     * @tc.level     : Level 3
348     */
349    it('testPath_QuadTo_Normal_Parameter', 0, async function () {
350      let msg = "testPath_QuadTo_Normal_Parameter"
351      console.info(msg + 'begin');
352      let path = new drawing.Path();
353      try {
354        path.moveTo(10, 10);
355      } catch (err) {
356        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
357        expect().assertFail();
358      }
359      try {
360        path.quadTo(10, 15, 10, 10);
361      } catch (err) {
362        console.info(msg + 'quadTo error cause: ' + JSON.stringify(err));
363        expect().assertFail();
364      }
365    })
366    /**
367     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0720
368     * @tc.name      : testPath_QuadTo_Minus_Parameter
369     * @tc.desc      : Used to add a second order Bessel smooth curve from the last point of the path to the destination point
370     * @tc.size      : MediumTest
371     * @tc.type      : Function
372     * @tc.level     : Level 3
373     */
374    it('testPath_QuadTo_Minus_Parameter', 0, async function () {
375      let msg = "testPath_QuadTo_Minus_Parameter"
376      console.info(msg + 'begin');
377      let path = new drawing.Path();
378      try {
379        path.moveTo(10, 10);
380      } catch (err) {
381        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
382        expect().assertFail();
383      }
384      try {
385        path.quadTo(-10, -15, -10, -10);
386      } catch (err) {
387        console.info(msg + 'quadTo error cause: ' + JSON.stringify(err));
388        expect().assertFail();
389      }
390    })
391    /**
392     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0730
393     * @tc.name      : testPath_QuadTo_NonInteger_Parameter
394     * @tc.desc      : Used to add a second order Bessel smooth curve from the last point of the path to the destination point
395     * @tc.size      : MediumTest
396     * @tc.type      : Function
397     * @tc.level     : Level 3
398     */
399    it('testPath_QuadTo_NonInteger_Parameter', 0, async function () {
400      let msg = "testPath_QuadTo_NonInteger_Parameter"
401      console.info(msg + 'begin');
402      let path = new drawing.Path();
403      try {
404        path.moveTo(10, 10);
405      } catch (err) {
406        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
407        expect().assertFail();
408      }
409      try {
410        path.quadTo(88.456, 45.12451, 10.45, 100.14);
411      } catch (err) {
412        console.info(msg + 'quadTo error cause: ' + JSON.stringify(err));
413        expect().assertFail();
414      }
415    })
416    /**
417     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0100
418     * @tc.name      : testPath_CubicTo_Normal_Parameter
419     * @tc.desc      : Third order Bessel smooth curve
420     * @tc.size      : MediumTest
421     * @tc.type      : Function
422     * @tc.level     : Level 3
423     */
424    it('testPath_CubicTo_Normal_Parameter', 0, async function () {
425      let msg = "testPath_CubicTo_Normal_Parameter"
426      console.info(msg + 'begin');
427      let path = new drawing.Path();
428      try {
429        path.moveTo(10, 10);
430      } catch (err) {
431        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
432        expect().assertFail();
433      }
434      try {
435        path.cubicTo(10, 10, 10, 10, 15, 15);
436      } catch (err) {
437        console.info(msg + 'cubicTo error cause: ' + JSON.stringify(err));
438        expect().assertFail();
439      }
440    })
441    /**
442     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0790
443     * @tc.name      : testPath_CubicTo_Minus_Parameter
444     * @tc.desc      : Third order Bessel smooth curve
445     * @tc.size      : MediumTest
446     * @tc.type      : Function
447     * @tc.level     : Level 3
448     */
449    it('testPath_CubicTo_Minus_Parameter', 0, async function () {
450      let msg = "testPath_CubicTo_Minus_Parameter"
451      console.info(msg + 'begin');
452      let path = new drawing.Path();
453      try {
454        path.moveTo(10, 10);
455      } catch (err) {
456        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
457        expect().assertFail();
458      }
459      try {
460        path.cubicTo(-10, -10, -10, -10, -15, -15);
461      } catch (err) {
462        console.info(msg + 'cubicTo error cause: ' + JSON.stringify(err));
463        expect().assertFail();
464      }
465    })
466    /**
467     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0800
468     * @tc.name      : testPath_CubicTo_NonInteger_Parameter
469     * @tc.desc      : Third order Bessel smooth curve
470     * @tc.size      : MediumTest
471     * @tc.type      : Function
472     * @tc.level     : Level 3
473     */
474    it('testPath_CubicTo_NonInteger_Parameter', 0, async function () {
475      let msg = "testPath_CubicTo_NonInteger_Parameter"
476      console.info(msg + 'begin');
477      let path = new drawing.Path();
478      try {
479        path.moveTo(10, 10);
480      } catch (err) {
481        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
482        expect().assertFail();
483      }
484      try {
485        path.cubicTo(20.147, 30.25, 10.15, 20.58, 1.28, 420.2574);
486      } catch (err) {
487        console.info(msg + 'cubicTo error cause: ' + JSON.stringify(err));
488        expect().assertFail();
489      }
490    })
491    /**
492     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0110
493     * @tc.name      : testPath_Close
494     * @tc.desc      : For closed path
495     * @tc.size      : MediumTest
496     * @tc.type      : Function
497     * @tc.level     : Level 3
498     */
499    it('testPath_Close', 0, async function () {
500      let msg = "testPath_Close"
501      console.info(msg + 'begin');
502      let path = new drawing.Path();
503      try {
504        path.moveTo(10, 10);
505      } catch (err) {
506        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
507        expect().assertFail();
508      }
509      try {
510        path.cubicTo(10, 10, 10, 10, 15, 15);
511      } catch (err) {
512        console.info(msg + 'cubicTo error cause: ' + JSON.stringify(err));
513        expect().assertFail();
514      }
515      try {
516        path.close();
517      } catch (err) {
518        console.info(msg + 'close error cause: ' + JSON.stringify(err));
519        expect().assertFail();
520      }
521    })
522    /**
523     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0120
524     * @tc.name      : testPath_Reset
525     * @tc.desc      : Used to reset custom path data
526     * @tc.size      : MediumTest
527     * @tc.type      : Function
528     * @tc.level     : Level 3
529     */
530    it('testPath_Reset', 0, async function () {
531      let msg = "testPath_Reset"
532      console.info(msg + 'begin');
533      let path = new drawing.Path();
534      try {
535        path.moveTo(10, 10);
536      } catch (err) {
537        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
538        expect().assertFail();
539      }
540      try {
541        path.cubicTo(10, 10, 10, 10, 15, 15);
542      } catch (err) {
543        console.info(msg + 'cubicTo error cause: ' + JSON.stringify(err));
544        expect().assertFail();
545      }
546      try {
547        path.reset();
548      } catch (err) {
549        console.info(msg + 'reset error cause: ' + JSON.stringify(err));
550        expect().assertFail();
551      }
552    })
553    /**
554     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0130
555     * @tc.name      : testEnumTextEncoding
556     * @tc.desc      : Enumeration of the encoding type of the text
557     * @tc.size      : MediumTest
558     * @tc.type      : Function
559     * @tc.level     : Level 3
560     */
561    it('testEnumTextEncoding', 0, async function () {
562      let msg = "testEnumTextEncoding"
563      console.info(msg + 'begin');
564      console.info(msg + 'value of TextEncoding is: ' + JSON.stringify(drawing.TextEncoding));
565      try {
566        expect(0).assertEqual(drawing.TextEncoding.TEXT_ENCODING_UTF8);
567        expect(1).assertEqual(drawing.TextEncoding.TEXT_ENCODING_UTF16);
568        expect(2).assertEqual(drawing.TextEncoding.TEXT_ENCODING_UTF32);
569        expect(3).assertEqual(drawing.TextEncoding.TEXT_ENCODING_GLYPH_ID);
570      } catch (err) {
571        console.info(msg + 'test enum value of TextEncoding error ' + JSON.stringify(err));
572        expect().assertFail();
573      }
574    })
575    /**
576     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0140
577     * @tc.name      : testTextBlob_MakeFromString_Normal_Parameter
578     * @tc.desc      : Converts a string value to a TextBlob object
579     * @tc.size      : MediumTest
580     * @tc.type      : Function
581     * @tc.level     : Level 3
582     */
583    it('testTextBlob_MakeFromString_Normal_Parameter', 0, async function () {
584      let msg = "testTextBlob_MakeFromString_Normal_Parameter"
585      console.info(msg + 'begin');
586      let font = new drawing.Font();
587      try {
588        font.setSize(20);
589      } catch (err) {
590        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
591        expect().assertFail();
592      }
593      try {
594        const textBlob = drawing.TextBlob.makeFromString("drawing", font, drawing.TextEncoding.TEXT_ENCODING_UTF8);
595        expect(textBlob != null).assertTrue();
596      } catch (err) {
597        console.info(msg + 'makeFromString error cause: ' + JSON.stringify(err));
598        expect().assertFail();
599      }
600    })
601    /**
602     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0890
603     * @tc.name      : testTextBlob_MakeFromString_NoEncoding
604     * @tc.desc      : Converts a string value to a TextBlob object
605     * @tc.size      : MediumTest
606     * @tc.type      : Function
607     * @tc.level     : Level 3
608     */
609    it('testTextBlob_MakeFromString_NoEncoding', 0, async function () {
610      let msg = "testTextBlob_MakeFromString_NoEncoding"
611      console.info(msg + 'begin');
612      let font = new drawing.Font();
613      try {
614        font.setSize(20);
615      } catch (err) {
616        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
617        expect().assertFail();
618      }
619      try {
620        const textBlob = drawing.TextBlob.makeFromString("drawing", font);
621        expect(textBlob != null).assertTrue();
622      } catch (err) {
623        console.info(msg + 'makeFromString error cause: ' + JSON.stringify(err));
624      }
625    })
626    /**
627     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0900
628     * @tc.name      : testTextBlob_MakeFromString_LongText
629     * @tc.desc      : Converts a string value to a TextBlob object
630     * @tc.size      : MediumTest
631     * @tc.type      : Function
632     * @tc.level     : Level 3
633     */
634    it('testTextBlob_MakeFromString_LongText', 0, async function () {
635      let msg = "testTextBlob_MakeFromString_LongText"
636      console.info(msg + 'begin');
637      let font = new drawing.Font();
638      try {
639        font.setSize(20);
640      } catch (err) {
641        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
642        expect().assertFail();
643      }
644      try {
645        const textBlob = drawing.TextBlob.makeFromString(longText, font);
646        expect(textBlob != null).assertTrue();
647      } catch (err) {
648        console.info(msg + 'makeFromString error cause: ' + JSON.stringify(err));
649      }
650    })
651    /**
652     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0910
653     * @tc.name      : testTextBlob_MakeFromString_TextEncoding_UTF16
654     * @tc.desc      : Converts a string value to a TextBlob object
655     * @tc.size      : MediumTest
656     * @tc.type      : Function
657     * @tc.level     : Level 3
658     */
659    it('testTextBlob_MakeFromString_TextEncoding_UTF16', 0, async function () {
660      let msg = "testTextBlob_MakeFromString_TextEncoding_UTF16"
661      console.info(msg + 'begin');
662      let font = new drawing.Font();
663      try {
664        font.setSize(20);
665      } catch (err) {
666        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
667        expect().assertFail();
668      }
669      try {
670        const textBlob = drawing.TextBlob.makeFromString("drawing", font, drawing.TextEncoding.TEXT_ENCODING_UTF16);
671        expect(textBlob != null).assertTrue();
672      } catch (err) {
673        console.info(msg + 'makeFromString error cause: ' + JSON.stringify(err));
674      }
675    })
676    /**
677     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0920
678     * @tc.name      : testTextBlob_MakeFromString_TextEncoding_UTF32
679     * @tc.desc      : Converts a string value to a TextBlob object
680     * @tc.size      : MediumTest
681     * @tc.type      : Function
682     * @tc.level     : Level 3
683     */
684    it('testTextBlob_MakeFromString_TextEncoding_UTF32', 0, async function () {
685      let msg = "testTextBlob_MakeFromString_TextEncoding_UTF32"
686      console.info(msg + 'begin');
687      let font = new drawing.Font();
688      try {
689        font.setSize(20);
690      } catch (err) {
691        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
692        expect().assertFail();
693      }
694      try {
695        const textBlob = drawing.TextBlob.makeFromString("drawing", font, drawing.TextEncoding.TEXT_ENCODING_UTF32);
696        expect(textBlob != null).assertTrue();
697      } catch (err) {
698        console.info(msg + 'makeFromString error cause: ' + JSON.stringify(err));
699      }
700    })
701    /**
702     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0930
703     * @tc.name      : testTextBlob_MakeFromString_TextEncoding_GlyphId
704     * @tc.desc      : Converts a string value to a TextBlob object
705     * @tc.size      : MediumTest
706     * @tc.type      : Function
707     * @tc.level     : Level 3
708     */
709    it('testTextBlob_MakeFromString_TextEncoding_GlyphId', 0, async function () {
710      let msg = "testTextBlob_MakeFromString_TextEncoding_GlyphId"
711      console.info(msg + 'begin');
712      let font = new drawing.Font();
713      try {
714        font.setSize(20);
715      } catch (err) {
716        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
717        expect().assertFail();
718      }
719      try {
720        const textBlob = drawing.TextBlob.makeFromString("drawing", font, drawing.TextEncoding.TEXT_ENCODING_GLYPH_ID);
721        expect(textBlob != null).assertTrue();
722      } catch (err) {
723        console.info(msg + 'makeFromString error cause: ' + JSON.stringify(err));
724      }
725    })
726    /**
727     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0150
728     * @tc.name      : testTextBlob_MakeFromRunBuffer_Normal_Parameter
729     * @tc.desc      : Create a Textblob object based on the RunBuffer information
730     * @tc.size      : MediumTest
731     * @tc.type      : Function
732     * @tc.level     : Level 3
733     */
734    it('testTextBlob_MakeFromRunBuffer_Normal_Parameter', 0, async function () {
735      let msg = "testTextBlob_MakeFromRunBuffer_Normal_Parameter"
736      console.info(msg + 'begin');
737      let runBuffer = null;
738      let textBlob = null
739      let canvas = new drawing.Canvas(pixel)
740      const font = new drawing.Font();
741      const brush = new drawing.Brush();
742      try {
743        font.setSize(20);
744      } catch (err) {
745        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
746        expect().assertFail();
747      }
748      runBuffer = [
749        {
750          glyph: 65, positionX: 0, positionY: 0
751        },
752        {
753          glyph: 227, positionX: 14.9, positionY: 0
754        },
755        {
756          glyph: 283, positionX: 25.84, positionY: 0
757        },
758        {
759          glyph: 283, positionX: 30.62, positionY: 0
760        },
761        {
762          glyph: 299, positionX: 35.4, positionY: 0
763        }
764      ];
765      try {
766        textBlob = drawing.TextBlob.makeFromRunBuffer(runBuffer, font, null);
767      } catch (err) {
768        console.info(msg + 'makeFromRunBuffer error cause: ' + JSON.stringify(err));
769        expect().assertFail();
770      }
771      try {
772        brush.setColor({
773          alpha: 255, red: 255, green: 0, blue: 0
774        });
775      } catch (err) {
776        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
777        expect().assertFail();
778      }
779      try {
780        canvas.attachBrush(brush);
781      } catch (err) {
782        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
783        expect().assertFail();
784      }
785      try {
786        canvas.drawTextBlob(textBlob, 20, 20);
787      } catch (err) {
788        console.info(msg + 'drawTextBlob error cause: ' + JSON.stringify(err));
789        expect().assertFail();
790      }
791      try {
792        canvas.detachBrush();
793      } catch (err) {
794        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
795        expect().assertFail();
796      }
797    })
798    /**
799     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0990
800     * @tc.name      : testTextBlob_MakeFromRunBuffer_NoBounds
801     * @tc.desc      : Create a Textblob object based on the RunBuffer information
802     * @tc.size      : MediumTest
803     * @tc.type      : Function
804     * @tc.level     : Level 3
805     */
806    it('testTextBlob_MakeFromRunBuffer_NoBounds', 0, async function () {
807      let msg = "testTextBlob_MakeFromRunBuffer_NoBounds"
808      console.info(msg + 'begin');
809      let runBuffer = null;
810      let textBlob = null
811      let canvas = new drawing.Canvas(pixel)
812      const font = new drawing.Font();
813      const brush = new drawing.Brush();
814      try {
815        font.setSize(20);
816      } catch (err) {
817        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
818        expect().assertFail();
819      }
820      runBuffer = [
821        {
822          glyph: 65, positionX: 0, positionY: 0
823        },
824        {
825          glyph: 227, positionX: 14.9, positionY: 0
826        },
827        {
828          glyph: 283, positionX: 25.84, positionY: 0
829        },
830        {
831          glyph: 283, positionX: 30.62, positionY: 0
832        },
833        {
834          glyph: 299, positionX: 35.4, positionY: 0
835        }
836      ];
837      try {
838        textBlob = drawing.TextBlob.makeFromRunBuffer(runBuffer, font);
839      } catch (err) {
840        console.info(msg + 'makeFromRunBuffer error cause: ' + JSON.stringify(err));
841        expect().assertFail();
842      }
843      try {
844        brush.setColor({
845          alpha: 255, red: 255, green: 0, blue: 0
846        });
847      } catch (err) {
848        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
849        expect().assertFail();
850      }
851      try {
852        canvas.attachBrush(brush);
853      } catch (err) {
854        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
855        expect().assertFail();
856      }
857      try {
858        canvas.drawTextBlob(textBlob, 20, 20);
859      } catch (err) {
860        console.info(msg + 'drawTextBlob error cause: ' + JSON.stringify(err));
861        expect().assertFail();
862      }
863      try {
864        canvas.detachBrush();
865      } catch (err) {
866        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
867        expect().assertFail();
868      }
869    })
870    /**
871     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1020
872     * @tc.name      : testTextBlob_MakeFromRunBuffer_runBuffer_ArrayNumOne
873     * @tc.desc      : Create a Textblob object based on the RunBuffer information
874     * @tc.size      : MediumTest
875     * @tc.type      : Function
876     * @tc.level     : Level 3
877     */
878    it('testTextBlob_MakeFromRunBuffer_runBuffer_ArrayNumOne', 0, async function () {
879      let msg = "testTextBlob_MakeFromRunBuffer_runBuffer_ArrayNumOne"
880      console.info(msg + 'begin');
881      let runBuffer = null;
882      let textBlob = null
883      let canvas = new drawing.Canvas(pixel)
884      const font = new drawing.Font();
885      const brush = new drawing.Brush();
886      try {
887        font.setSize(20);
888      } catch (err) {
889        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
890        expect().assertFail();
891      }
892      runBuffer = [
893        {
894          glyph: 65, positionX: 0, positionY: 0
895        }
896      ];
897      try {
898        textBlob = drawing.TextBlob.makeFromRunBuffer(runBuffer, font, null);
899      } catch (err) {
900        console.info(msg + 'makeFromRunBuffer error cause: ' + JSON.stringify(err));
901        expect().assertFail();
902      }
903      try {
904        brush.setColor({
905          alpha: 255, red: 255, green: 0, blue: 0
906        });
907      } catch (err) {
908        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
909        expect().assertFail();
910      }
911      try {
912        canvas.attachBrush(brush);
913      } catch (err) {
914        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
915        expect().assertFail();
916      }
917      try {
918        canvas.drawTextBlob(textBlob, 20, 20);
919      } catch (err) {
920        console.info(msg + 'drawTextBlob error cause: ' + JSON.stringify(err));
921        expect().assertFail();
922      }
923      try {
924        canvas.detachBrush();
925      } catch (err) {
926        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
927        expect().assertFail();
928      }
929    })
930    /**
931     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1030
932     * @tc.name      : testTextBlob_MakeFromRunBuffer_runBuffer_ArrayNumTwo
933     * @tc.desc      : Create a Textblob object based on the RunBuffer information
934     * @tc.size      : MediumTest
935     * @tc.type      : Function
936     * @tc.level     : Level 3
937     */
938    it('testTextBlob_MakeFromRunBuffer_runBuffer_ArrayNumTwo', 0, async function () {
939      let msg = "testTextBlob_MakeFromRunBuffer_runBuffer_ArrayNumTwo"
940      console.info(msg + 'begin');
941      let runBuffer = null;
942      let textBlob = null
943      let canvas = new drawing.Canvas(pixel)
944      const font = new drawing.Font();
945      const brush = new drawing.Brush();
946      try {
947        font.setSize(20);
948      } catch (err) {
949        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
950        expect().assertFail();
951      }
952      runBuffer = [
953        {
954          glyph: 65, positionX: 0, positionY: 0
955        },
956        {
957          glyph: 283, positionX: 25.84, positionY: 0
958        },
959      ];
960      try {
961        textBlob = drawing.TextBlob.makeFromRunBuffer(runBuffer, font, null);
962      } catch (err) {
963        console.info(msg + 'makeFromRunBuffer error cause: ' + JSON.stringify(err));
964        expect().assertFail();
965      }
966      try {
967        brush.setColor({
968          alpha: 255, red: 255, green: 0, blue: 0
969        });
970      } catch (err) {
971        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
972        expect().assertFail();
973      }
974      try {
975        canvas.attachBrush(brush);
976      } catch (err) {
977        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
978        expect().assertFail();
979      }
980      try {
981        canvas.drawTextBlob(textBlob, 20, 20);
982      } catch (err) {
983        console.info(msg + 'drawTextBlob error cause: ' + JSON.stringify(err));
984        expect().assertFail();
985      }
986      try {
987        canvas.detachBrush();
988      } catch (err) {
989        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
990        expect().assertFail();
991      }
992    })
993    /**
994     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1040
995     * @tc.name      : testTextBlob_MakeFromRunBuffer_runBuffer_ArrayNumSix
996     * @tc.desc      : Create a Textblob object based on the RunBuffer information
997     * @tc.size      : MediumTest
998     * @tc.type      : Function
999     * @tc.level     : Level 3
1000     */
1001    it('testTextBlob_MakeFromRunBuffer_runBuffer_ArrayNumSix', 0, async function () {
1002      let msg = "testTextBlob_MakeFromRunBuffer_runBuffer_ArrayNumSix"
1003      console.info(msg + 'begin');
1004      let runBuffer = null;
1005      let textBlob = null
1006      let canvas = new drawing.Canvas(pixel)
1007      const font = new drawing.Font();
1008      const brush = new drawing.Brush();
1009      try {
1010        font.setSize(20);
1011      } catch (err) {
1012        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
1013        expect().assertFail();
1014      }
1015      runBuffer = [
1016        {
1017          glyph: 65, positionX: 0, positionY: 0
1018        },
1019        {
1020          glyph: 227, positionX: 14.9, positionY: 0
1021        },
1022        {
1023          glyph: 283, positionX: 25.84, positionY: 0
1024        },
1025        {
1026          glyph: 283, positionX: 30.62, positionY: 0
1027        },
1028        {
1029          glyph: 299, positionX: 35.4, positionY: 0
1030        },
1031        {
1032          glyph: 283, positionX: 25.84, positionY: 0
1033        }
1034      ];
1035      try {
1036        textBlob = drawing.TextBlob.makeFromRunBuffer(runBuffer, font, null);
1037      } catch (err) {
1038        console.info(msg + 'makeFromRunBuffer error cause: ' + JSON.stringify(err));
1039        expect().assertFail();
1040      }
1041      try {
1042        brush.setColor({
1043          alpha: 255, red: 255, green: 0, blue: 0
1044        });
1045      } catch (err) {
1046        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
1047        expect().assertFail();
1048      }
1049      try {
1050        canvas.attachBrush(brush);
1051      } catch (err) {
1052        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
1053        expect().assertFail();
1054      }
1055      try {
1056        canvas.drawTextBlob(textBlob, 20, 20);
1057      } catch (err) {
1058        console.info(msg + 'drawTextBlob error cause: ' + JSON.stringify(err));
1059        expect().assertFail();
1060      }
1061      try {
1062        canvas.detachBrush();
1063      } catch (err) {
1064        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
1065        expect().assertFail();
1066      }
1067    })
1068    /**
1069     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1050
1070     * @tc.name      : testTextBlob_MakeFromRunBuffer_runBuffer_NumberTest
1071     * @tc.desc      : Create a Textblob object based on the RunBuffer information
1072     * @tc.size      : MediumTest
1073     * @tc.type      : Function
1074     * @tc.level     : Level 3
1075     */
1076    it('testTextBlob_MakeFromRunBuffer_runBuffer_NumberTest', 0, async function () {
1077      let msg = "testTextBlob_MakeFromRunBuffer_runBuffer_NumberTest"
1078      console.info(msg + 'begin');
1079      let runBuffer = null;
1080      let textBlob = null
1081      let canvas = new drawing.Canvas(pixel)
1082      const font = new drawing.Font();
1083      const brush = new drawing.Brush();
1084      try {
1085        font.setSize(20);
1086      } catch (err) {
1087        console.info(msg + 'font setSize error cause: ' + JSON.stringify(err));
1088        expect().assertFail();
1089      }
1090      runBuffer = [
1091        {
1092          glyph: 1000.5698, positionX: -100, positionY: 200
1093        },
1094        {
1095          glyph: -100, positionX: 14.9, positionY: 0
1096        },
1097        {
1098          glyph: 0.5698, positionX: 300, positionY: -520
1099        },
1100      ];
1101      try {
1102        textBlob = drawing.TextBlob.makeFromRunBuffer(runBuffer, font, null);
1103      } catch (err) {
1104        console.info(msg + 'makeFromRunBuffer error cause: ' + JSON.stringify(err));
1105        expect().assertFail();
1106      }
1107      try {
1108        brush.setColor({
1109          alpha: 255, red: 255, green: 0, blue: 0
1110        });
1111      } catch (err) {
1112        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
1113        expect().assertFail();
1114      }
1115      try {
1116        canvas.attachBrush(brush);
1117      } catch (err) {
1118        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
1119        expect().assertFail();
1120      }
1121      try {
1122        canvas.drawTextBlob(textBlob, 20, 20);
1123      } catch (err) {
1124        console.info(msg + 'drawTextBlob error cause: ' + JSON.stringify(err));
1125        expect().assertFail();
1126      }
1127      try {
1128        canvas.detachBrush();
1129      } catch (err) {
1130        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
1131        expect().assertFail();
1132      }
1133    })
1134    /**
1135     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0160
1136     * @tc.name      : testTextBlob_Bounds
1137     * @tc.desc      : Gets the rectangular area of the text bounding box
1138     * @tc.size      : MediumTest
1139     * @tc.type      : Function
1140     * @tc.level     : Level 3
1141     */
1142    it('testTextBlob_Bounds', 0, async function () {
1143      let msg = "testTextBlob_Bounds"
1144      console.info(msg + 'begin');
1145      const font = new drawing.Font();
1146      let textBlob = null
1147      try {
1148        textBlob = drawing.TextBlob.makeFromString("drawing", font, drawing.TextEncoding.TEXT_ENCODING_UTF8);
1149        expect(textBlob != null).assertTrue();
1150      } catch (err) {
1151        console.info(msg + 'makeFromString error cause: ' + JSON.stringify(err));
1152        expect().assertFail();
1153      }
1154      try {
1155        let bd = textBlob.bounds();
1156        expect(bd != null).assertTrue();
1157      } catch (err) {
1158        console.info(msg + 'bounds error cause: ' + JSON.stringify(err));
1159        expect().assertFail();
1160      }
1161    })
1162    /**
1163     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0170
1164     * @tc.name      : testTypeface_GetFamilyName
1165     * @tc.desc      : Gets the series name of the font
1166     * @tc.size      : MediumTest
1167     * @tc.type      : Function
1168     * @tc.level     : Level 3
1169     */
1170    it('testTypeface_GetFamilyName', 0, async function () {
1171      let msg = "testTypeface_GetFamilyName"
1172      console.info(msg + 'begin');
1173      const font = new drawing.Font();
1174      let typeface = null;
1175      try {
1176        typeface = font.getTypeface();
1177      } catch (err) {
1178        console.info(msg + 'getTypeface error cause: ' + JSON.stringify(err));
1179        expect().assertFail();
1180      }
1181      try {
1182        const fontFamilyName = typeface.getFamilyName();
1183        expect(fontFamilyName != null).assertTrue();
1184      } catch (err) {
1185        console.info(msg + 'getFamilyName error cause: ' + JSON.stringify(err));
1186        expect().assertFail();
1187      }
1188    })
1189    /**
1190     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0180
1191     * @tc.name      : testFont_EnableSubpixel_True
1192     * @tc.desc      : Enable font subpixel level text rendering
1193     * @tc.size      : MediumTest
1194     * @tc.type      : Function
1195     * @tc.level     : Level 3
1196     */
1197    it('testFont_EnableSubpixel_True', 0, async function () {
1198      let msg = "testFont_EnableSubpixel_True"
1199      console.info(msg + 'begin');
1200      let font = new drawing.Font();
1201      try {
1202        font.enableSubpixel(true);
1203      } catch (err) {
1204        console.info(msg + 'enableSubpixel error cause: ' + JSON.stringify(err));
1205        expect().assertFail();
1206      }
1207    })
1208    /**
1209     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1060
1210     * @tc.name      : testFont_EnableSubpixel_False
1211     * @tc.desc      : Enable font subpixel level text rendering
1212     * @tc.size      : MediumTest
1213     * @tc.type      : Function
1214     * @tc.level     : Level 3
1215     */
1216    it('testFont_EnableSubpixel_False', 0, async function () {
1217      let msg = "testFont_EnableSubpixel_False"
1218      console.info(msg + 'begin');
1219      let font = new drawing.Font();
1220      try {
1221        font.enableSubpixel(false);
1222      } catch (err) {
1223        console.info(msg + 'enableSubpixel error cause: ' + JSON.stringify(err));
1224        expect().assertFail();
1225      }
1226    })
1227    /**
1228     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0190
1229     * @tc.name      : testFont_EnableEmbolden_True
1230     * @tc.desc      : Enable font bold
1231     * @tc.size      : MediumTest
1232     * @tc.type      : Function
1233     * @tc.level     : Level 3
1234     */
1235    it('testFont_EnableEmbolden_True', 0, async function () {
1236      let msg = "testFont_EnableEmbolden_True"
1237      console.info(msg + 'begin');
1238      const font = new drawing.Font();
1239      try {
1240        font.enableEmbolden(true);
1241      } catch (err) {
1242        console.info(msg + 'enableEmbolden error cause: ' + JSON.stringify(err));
1243        expect().assertFail();
1244      }
1245    })
1246    /**
1247     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1090
1248     * @tc.name      : testFont_EnableEmbolden_False
1249     * @tc.desc      : Enable font bold
1250     * @tc.size      : MediumTest
1251     * @tc.type      : Function
1252     * @tc.level     : Level 3
1253     */
1254    it('testFont_EnableEmbolden_False', 0, async function () {
1255      let msg = "testFont_EnableEmbolden_False"
1256      console.info(msg + 'begin');
1257      const font = new drawing.Font();
1258      try {
1259        font.enableEmbolden(false);
1260      } catch (err) {
1261        console.info(msg + 'enableEmbolden error cause: ' + JSON.stringify(err));
1262        expect().assertFail();
1263      }
1264    })
1265    /**
1266     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0200
1267     * @tc.name      : testFont_EnableLinearMetrics_True
1268     * @tc.desc      : Enable linear scaling of glyphs
1269     * @tc.size      : MediumTest
1270     * @tc.type      : Function
1271     * @tc.level     : Level 3
1272     */
1273    it('testFont_EnableLinearMetrics_True', 0, async function () {
1274      let msg = "testFont_EnableLinearMetrics_True"
1275      console.info(msg + 'begin');
1276      let font = new drawing.Font();
1277      try {
1278        font.enableLinearMetrics(true);
1279      } catch (err) {
1280        console.info(msg + 'enableLinearMetrics error cause: ' + JSON.stringify(err));
1281        expect().assertFail();
1282      }
1283    })
1284    /**
1285     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1120
1286     * @tc.name      : testFont_EnableLinearMetrics_False
1287     * @tc.desc      : Enable linear scaling of glyphs
1288     * @tc.size      : MediumTest
1289     * @tc.type      : Function
1290     * @tc.level     : Level 3
1291     */
1292    it('testFont_EnableLinearMetrics_False', 0, async function () {
1293      let msg = "testFont_EnableLinearMetrics_False"
1294      console.info(msg + 'begin');
1295      let font = new drawing.Font();
1296      try {
1297        font.enableLinearMetrics(false);
1298      } catch (err) {
1299        console.info(msg + 'enableLinearMetrics error cause: ' + JSON.stringify(err));
1300        expect().assertFail();
1301      }
1302    })
1303    /**
1304     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0210
1305     * @tc.name      : testFont_SetSize_Normal_Parameter
1306     * @tc.desc      : Set font size
1307     * @tc.size      : MediumTest
1308     * @tc.type      : Function
1309     * @tc.level     : Level 3
1310     */
1311    it('testFont_SetSize_Normal_Parameter', 0, async function () {
1312      let msg = "testFont_SetSize_Normal_Parameter"
1313      console.info(msg + 'begin');
1314      let font = new drawing.Font();
1315      try {
1316        font.setSize(100);
1317      } catch (err) {
1318        console.info(msg + 'setSize error cause: ' + JSON.stringify(err));
1319        expect().assertFail();
1320      }
1321      try {
1322        let num = font.getSize();
1323        expect(num).assertEqual(100)
1324      } catch (err) {
1325        console.info(msg + 'getSize error cause: ' + JSON.stringify(err));
1326        expect().assertFail();
1327      }
1328    })
1329    /**
1330     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1150
1331     * @tc.name      : testFont_SetSize_Minus_Parameter
1332     * @tc.desc      : Set font size
1333     * @tc.size      : MediumTest
1334     * @tc.type      : Function
1335     * @tc.level     : Level 3
1336     */
1337    it('testFont_SetSize_Minus_Parameter', 0, async function () {
1338      let msg = "testFont_SetSize_Minus_Parameter"
1339      console.info(msg + 'begin');
1340      let font = new drawing.Font();
1341      try {
1342        font.setSize(-200);
1343      } catch (err) {
1344        console.info(msg + 'setSize error cause: ' + JSON.stringify(err));
1345        expect().assertFail();
1346      }
1347      try {
1348        let num = font.getSize();
1349        console.info(msg + 'getSize num is: ' + num);
1350        expect(num).assertEqual(0)
1351      } catch (err) {
1352        console.info(msg + 'getSize error cause: ' + JSON.stringify(err));
1353        expect().assertFail();
1354      }
1355    })
1356    /**
1357     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1160
1358     * @tc.name      : testFont_SetSize_Zero_Parameter
1359     * @tc.desc      : Set font size
1360     * @tc.size      : MediumTest
1361     * @tc.type      : Function
1362     * @tc.level     : Level 3
1363     */
1364    it('testFont_SetSize_Zero_Parameter', 0, async function () {
1365      let msg = "testFont_SetSize_Zero_Parameter"
1366      console.info(msg + 'begin');
1367      let font = new drawing.Font();
1368      try {
1369        font.setSize(0);
1370      } catch (err) {
1371        console.info(msg + 'setSize error cause: ' + JSON.stringify(err));
1372        expect().assertFail();
1373      }
1374      try {
1375        let num = font.getSize();
1376        console.info(msg + 'getSize num is: ' + num);
1377        expect(num).assertEqual(0)
1378      } catch (err) {
1379        console.info(msg + 'getSize error cause: ' + JSON.stringify(err));
1380        expect().assertFail();
1381      }
1382    })
1383    /**
1384     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0220
1385     * @tc.name      : testFont_GetSize
1386     * @tc.desc      : Get font size
1387     * @tc.size      : MediumTest
1388     * @tc.type      : Function
1389     * @tc.level     : Level 3
1390     */
1391    it('testFont_GetSize', 0, async function () {
1392      let msg = "testFont_GetSize"
1393      console.info(msg + 'begin');
1394      let font = new drawing.Font();
1395      try {
1396        font.setSize(5);
1397      } catch (err) {
1398        console.info(msg + 'setSize error cause: ' + JSON.stringify(err));
1399        expect().assertFail();
1400      }
1401      try {
1402        let num = font.getSize();
1403        expect(num).assertEqual(5)
1404      } catch (err) {
1405        console.info(msg + 'getSize error cause: ' + JSON.stringify(err));
1406        expect().assertFail();
1407      }
1408    })
1409    /**
1410     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0230
1411     * @tc.name      : testFont_SetTypeface
1412     * @tc.desc      : Set font
1413     * @tc.size      : MediumTest
1414     * @tc.type      : Function
1415     * @tc.level     : Level 3
1416     */
1417    it('testFont_SetTypeface', 0, async function () {
1418      let msg = "testFont_SetTypeface"
1419      console.info(msg + 'begin');
1420      const font = new drawing.Font();
1421      try {
1422        font.setTypeface(new drawing.Typeface());
1423      } catch (err) {
1424        console.info(msg + 'setTypeface error cause: ' + JSON.stringify(err));
1425        expect().assertFail();
1426      }
1427    })
1428    /**
1429     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0240
1430     * @tc.name      : testFont_GetTypeface
1431     * @tc.desc      : Get font
1432     * @tc.size      : MediumTest
1433     * @tc.type      : Function
1434     * @tc.level     : Level 3
1435     */
1436    it('testFont_GetTypeface', 0, async function () {
1437      let msg = "testFont_GetTypeface"
1438      console.info(msg + 'begin');
1439      const font = new drawing.Font();
1440      try {
1441        let ft = font.getTypeface();
1442        expect(ft != null).assertTrue();
1443      } catch (err) {
1444        console.info(msg + 'getTypeface error cause: ' + JSON.stringify(err));
1445        expect().assertFail();
1446      }
1447    })
1448    /**
1449     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0250
1450     * @tc.name      : testFont_GetMetrics
1451     * @tc.desc      : Gets the FontMetrics property associated with the font
1452     * @tc.size      : MediumTest
1453     * @tc.type      : Function
1454     * @tc.level     : Level 3
1455     */
1456    it('testFont_GetMetrics', 0, async function () {
1457      let msg = "testFont_GetMetrics"
1458      console.info(msg + 'begin');
1459      const font = new drawing.Font();
1460      try {
1461        let metrics = font.getMetrics();
1462        expect(metrics != null).assertTrue();
1463        expect(metrics.top != null).assertTrue();
1464        expect(metrics.ascent != null).assertTrue();
1465        expect(metrics.descent != null).assertTrue();
1466        expect(metrics.bottom != null).assertTrue();
1467        expect(metrics.leading != null).assertTrue();
1468      } catch (err) {
1469        console.info(msg + 'getMetrics error cause: ' + JSON.stringify(err));
1470        expect().assertFail();
1471      }
1472    })
1473    /**
1474     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0260
1475     * @tc.name      : testFont_MeasureText
1476     * @tc.desc      : Measure the width of text
1477     * @tc.size      : MediumTest
1478     * @tc.type      : Function
1479     * @tc.level     : Level 3
1480     */
1481    it('testFont_MeasureText', 0, async function () {
1482      let msg = "testFont_MeasureText"
1483      console.info(msg + 'begin');
1484      const font = new drawing.Font();
1485      try {
1486        let TextWidth = font.measureText('testFont_MeasureText', drawing.TextEncoding.TEXT_ENCODING_UTF8);
1487        expect(TextWidth != null).assertTrue();
1488      } catch (err) {
1489        console.info(msg + 'measureText error cause: ' + JSON.stringify(err));
1490        expect().assertFail();
1491      }
1492    })
1493    /**
1494     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1210
1495     * @tc.name      : testFont_MeasureText_EncodingUtf16
1496     * @tc.desc      : Measure the width of text
1497     * @tc.size      : MediumTest
1498     * @tc.type      : Function
1499     * @tc.level     : Level 3
1500     */
1501    it('testFont_MeasureText_EncodingUtf16', 0, async function () {
1502      let msg = "testFont_MeasureText_EncodingUtf16"
1503      console.info(msg + 'begin');
1504      const font = new drawing.Font();
1505      try {
1506        let TextWidth = font.measureText('testFont_MeasureText_EncodingUtf16', drawing.TextEncoding.TEXT_ENCODING_UTF16);
1507        expect(TextWidth != null).assertTrue();
1508      } catch (err) {
1509        console.info(msg + 'measureText error cause: ' + JSON.stringify(err));
1510        expect().assertFail();
1511      }
1512    })
1513    /**
1514     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1220
1515     * @tc.name      : testFont_MeasureText_EncodingUtf32
1516     * @tc.desc      : Measure the width of text
1517     * @tc.size      : MediumTest
1518     * @tc.type      : Function
1519     * @tc.level     : Level 3
1520     */
1521    it('testFont_MeasureText_EncodingUtf32', 0, async function () {
1522      let msg = "testFont_MeasureText_EncodingUtf32"
1523      console.info(msg + 'begin');
1524      const font = new drawing.Font();
1525      try {
1526        let TextWidth = font.measureText('testFont_MeasureText_EncodingUtf32', drawing.TextEncoding.TEXT_ENCODING_UTF32);
1527        expect(TextWidth != null).assertTrue();
1528      } catch (err) {
1529        console.info(msg + 'measureText error cause: ' + JSON.stringify(err));
1530        expect().assertFail();
1531      }
1532    })
1533    /**
1534     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1230
1535     * @tc.name      : testFont_MeasureText_EncodingGlyphId
1536     * @tc.desc      : Measure the width of text
1537     * @tc.size      : MediumTest
1538     * @tc.type      : Function
1539     * @tc.level     : Level 3
1540     */
1541    it('testFont_MeasureText_EncodingGlyphId', 0, async function () {
1542      let msg = "testFont_MeasureText_EncodingGlyphId"
1543      console.info(msg + 'begin');
1544      const font = new drawing.Font();
1545      try {
1546        let TextWidth = font.measureText('testFont_MeasureText_EncodingGlyphId', drawing.TextEncoding.TEXT_ENCODING_GLYPH_ID);
1547        expect(TextWidth != null).assertTrue();
1548      } catch (err) {
1549        console.info(msg + 'measureText error cause: ' + JSON.stringify(err));
1550        expect().assertFail();
1551      }
1552    })
1553    /**
1554     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0270
1555     * @tc.name      : testColorFilter_CreateBlendModeColorFilter_Normal_Parameter
1556     * @tc.desc      : Creates a color filter using the specified color and blending mode
1557     * @tc.size      : MediumTest
1558     * @tc.type      : Function
1559     * @tc.level     : Level 3
1560     */
1561    it('testColorFilter_CreateBlendModeColorFilter_Normal_Parameter', 0, async function () {
1562      let msg = "testColorFilter_CreateBlendModeColorFilter_Normal_Parameter"
1563      console.info(msg + 'begin');
1564      try {
1565        const color: common2D.Color = {
1566          alpha: 255, red: 255, green: 0, blue: 0
1567        };
1568        let colorFilter = drawing.ColorFilter.createBlendModeColorFilter(color, drawing.BlendMode.SRC);
1569        expect(colorFilter != null).assertTrue();
1570      } catch (err) {
1571        console.info(msg + 'createBlendModeColorFilter error cause: ' + JSON.stringify(err));
1572        expect().assertFail();
1573      }
1574    })
1575    /**
1576     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1360
1577     * @tc.name      : testColorFilter_CreateBlendModeColorFilter_BlendMode_Screen
1578     * @tc.desc      : Creates a color filter using the specified color and blending mode
1579     * @tc.size      : MediumTest
1580     * @tc.type      : Function
1581     * @tc.level     : Level 3
1582     */
1583    it('testColorFilter_CreateBlendModeColorFilter_BlendMode_Screen', 0, async function () {
1584      let msg = "testColorFilter_CreateBlendModeColorFilter_BlendMode_Screen"
1585      console.info(msg + 'begin');
1586      try {
1587        const color: common2D.Color = {
1588          alpha: 255, red: 240, green: 0, blue: 100
1589        };
1590        let colorFilter = drawing.ColorFilter.createBlendModeColorFilter(color, drawing.BlendMode.SCREEN);
1591        expect(colorFilter != null).assertTrue();
1592      } catch (err) {
1593        console.info(msg + 'createBlendModeColorFilter error cause: ' + JSON.stringify(err));
1594        expect().assertFail();
1595      }
1596    })
1597    /**
1598     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0280
1599     * @tc.name      : testColorFilter_CreateComposeColorFilter
1600     * @tc.desc      : Create a combined color filter that applies inner for filtering and then outer for filtering
1601     * @tc.size      : MediumTest
1602     * @tc.type      : Function
1603     * @tc.level     : Level 3
1604     */
1605    it('testColorFilter_CreateComposeColorFilter', 0, async function () {
1606      let msg = "testColorFilter_CreateComposeColorFilter"
1607      console.info(msg + 'begin');
1608      try {
1609        const color: common2D.Color = {
1610          alpha: 255, red: 255, green: 0, blue: 0
1611        };
1612        let colorFilter1 = drawing.ColorFilter.createBlendModeColorFilter(color, drawing.BlendMode.SRC);
1613        let colorFilter2 = drawing.ColorFilter.createBlendModeColorFilter(color, drawing.BlendMode.DST);
1614        let colorFilter = drawing.ColorFilter.createComposeColorFilter(colorFilter1, colorFilter2);
1615        expect(colorFilter1 != null).assertTrue();
1616        expect(colorFilter2 != null).assertTrue();
1617        expect(colorFilter != null).assertTrue();
1618      } catch (err) {
1619        console.info(msg + 'createComposeColorFilter error cause: ' + JSON.stringify(err));
1620        expect().assertFail();
1621      }
1622    })
1623    /**
1624     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0290
1625     * @tc.name      : testColorFilter_CreateLinearToSRGBGamma
1626     * @tc.desc      : Create a color filter that translates from a linear color space to an SRGB color space
1627     * @tc.size      : MediumTest
1628     * @tc.type      : Function
1629     * @tc.level     : Level 3
1630     */
1631    it('testColorFilter_CreateLinearToSRGBGamma', 0, async function () {
1632      let msg = "testColorFilter_CreateLinearToSRGBGamma"
1633      console.info(msg + 'begin');
1634      const font = new drawing.Font();
1635      try {
1636        let colorFilter = drawing.ColorFilter.createLinearToSRGBGamma();
1637        expect(colorFilter != null).assertTrue();
1638      } catch (err) {
1639        console.info(msg + 'createLinearToSRGBGamma error cause: ' + JSON.stringify(err));
1640        expect().assertFail();
1641      }
1642    })
1643    /**
1644     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0300
1645     * @tc.name      : testColorFilter_CreateSRGBGammaToLinear
1646     * @tc.desc      : Create a color filter that converts from SRGB color space to linear color space
1647     * @tc.size      : MediumTest
1648     * @tc.type      : Function
1649     * @tc.level     : Level 3
1650     */
1651    it('testColorFilter_CreateSRGBGammaToLinear', 0, async function () {
1652      let msg = "testColorFilter_CreateSRGBGammaToLinear"
1653      console.info(msg + 'begin');
1654      const font = new drawing.Font();
1655      try {
1656        let colorFilter = drawing.ColorFilter.createSRGBGammaToLinear();
1657        expect(colorFilter != null).assertTrue();
1658      } catch (err) {
1659        console.info(msg + 'createSRGBGammaToLinear error cause: ' + JSON.stringify(err));
1660        expect().assertFail();
1661      }
1662    })
1663    /**
1664     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0310
1665     * @tc.name      : testColorFilter_CreateLumaColorFilter
1666     * @tc.desc      : Create a color filter that multiplies brightness with transparency
1667     * @tc.size      : MediumTest
1668     * @tc.type      : Function
1669     * @tc.level     : Level 3
1670     */
1671    it('testColorFilter_CreateLumaColorFilter', 0, async function () {
1672      let msg = "testColorFilter_CreateLumaColorFilter"
1673      console.info(msg + 'begin');
1674      try {
1675        let colorFilter = drawing.ColorFilter.createLumaColorFilter();
1676        expect(colorFilter != null).assertTrue();
1677      } catch (err) {
1678        console.info(msg + 'createLumaColorFilter error cause: ' + JSON.stringify(err));
1679        expect().assertFail();
1680      }
1681    })
1682    /**
1683     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0320
1684     * @tc.name      : testPen_SetColor_Normal_Parameter
1685     * @tc.desc      : Used to set the color of the brush
1686     * @tc.size      : MediumTest
1687     * @tc.type      : Function
1688     * @tc.level     : Level 3
1689     */
1690    it('testPen_SetColor_Normal_Parameter', 0, async function () {
1691      let msg = "testColorFilter_CreateLumaColorFilter"
1692      console.info(msg + 'begin');
1693      const color: common2D.Color = {
1694        alpha: 255, red: 255, green: 0, blue: 0
1695      };
1696      const pen = new drawing.Pen();
1697      try {
1698        pen.setColor(color);
1699      } catch (err) {
1700        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
1701        expect().assertFail();
1702      }
1703    })
1704    /**
1705     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0330
1706     * @tc.name      : testPen_SetStrokeWidth_Normal_Parameter
1707     * @tc.desc      : Used to set the line width of the brush
1708     * @tc.size      : MediumTest
1709     * @tc.type      : Function
1710     * @tc.level     : Level 3
1711     */
1712    it('testPen_SetStrokeWidth_Normal_Parameter', 0, async function () {
1713      let msg = "testPen_SetStrokeWidth_Normal_Parameter"
1714      console.info(msg + 'begin');
1715      const pen = new drawing.Pen();
1716      try {
1717        pen.setStrokeWidth(5);
1718      } catch (err) {
1719        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
1720        expect().assertFail();
1721      }
1722    })
1723    /**
1724     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1580
1725     * @tc.name      : testPen_SetStrokeWidth_NonInteger
1726     * @tc.desc      : Used to set the line width of the brush
1727     * @tc.size      : MediumTest
1728     * @tc.type      : Function
1729     * @tc.level     : Level 3
1730     */
1731    it('testPen_SetStrokeWidth_NonInteger', 0, async function () {
1732      let msg = "testPen_SetStrokeWidth_NonInteger"
1733      console.info(msg + 'begin');
1734      const pen = new drawing.Pen();
1735      try {
1736        pen.setStrokeWidth(100.56987);
1737      } catch (err) {
1738        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
1739        expect().assertFail();
1740      }
1741    })
1742    /**
1743     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0340
1744     * @tc.name      : testPen_SetAntiAlias_True
1745     * @tc.desc      : Used to set whether the brush is anti-aliasing enabled
1746     * @tc.size      : MediumTest
1747     * @tc.type      : Function
1748     * @tc.level     : Level 3
1749     */
1750    it('testPen_SetAntiAlias_True', 0, async function () {
1751      let msg = "testPen_SetAntiAlias_True"
1752      console.info(msg + 'begin');
1753      const pen = new drawing.Pen();
1754      try {
1755        pen.setAntiAlias(true);
1756      } catch (err) {
1757        console.info(msg + 'setAntiAlias error cause: ' + JSON.stringify(err));
1758        expect().assertFail();
1759      }
1760    })
1761    /**
1762     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1610
1763     * @tc.name      : testPen_SetAntiAlias_False
1764     * @tc.desc      : Used to set whether the brush is anti-aliasing enabled
1765     * @tc.size      : MediumTest
1766     * @tc.type      : Function
1767     * @tc.level     : Level 3
1768     */
1769    it('testPen_SetAntiAlias_False', 0, async function () {
1770      let msg = "testPen_SetAntiAlias_False"
1771      console.info(msg + 'begin');
1772      const pen = new drawing.Pen();
1773      try {
1774        pen.setAntiAlias(false);
1775      } catch (err) {
1776        console.info(msg + 'setAntiAlias error cause: ' + JSON.stringify(err));
1777        expect().assertFail();
1778      }
1779    })
1780    /**
1781     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0350
1782     * @tc.name      : testPen_SetAlpha_Normal_Parameter
1783     * @tc.desc      : Used to set the transparency of the brush
1784     * @tc.size      : MediumTest
1785     * @tc.type      : Function
1786     * @tc.level     : Level 3
1787     */
1788    it('testPen_SetAlpha_Normal_Parameter', 0, async function () {
1789      let msg = "testPen_SetAlpha_Normal_Parameter"
1790      console.info(msg + 'begin');
1791      const pen = new drawing.Pen();
1792      try {
1793        pen.setAlpha(128);
1794      } catch (err) {
1795        console.info(msg + 'setAlpha error cause: ' + JSON.stringify(err));
1796        expect().assertFail();
1797      }
1798    })
1799    /**
1800     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1640
1801     * @tc.name      : testPen_SetAlpha_NonInteger
1802     * @tc.desc      : Used to set the transparency of the brush
1803     * @tc.size      : MediumTest
1804     * @tc.type      : Function
1805     * @tc.level     : Level 3
1806     */
1807    it('testPen_SetAlpha_NonInteger', 0, async function () {
1808      let msg = "testPen_SetAlpha_NonInteger"
1809      console.info(msg + 'begin');
1810      const pen = new drawing.Pen();
1811      try {
1812        pen.setAlpha(206.5894);
1813      } catch (err) {
1814        console.info(msg + 'setAlpha error cause: ' + JSON.stringify(err));
1815        expect().assertFail();
1816      }
1817    })
1818    /**
1819     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1650
1820     * @tc.name      : testPen_SetAlpha_MinValueZero
1821     * @tc.desc      : Used to set the transparency of the brush
1822     * @tc.size      : MediumTest
1823     * @tc.type      : Function
1824     * @tc.level     : Level 3
1825     */
1826    it('testPen_SetAlpha_MinValueZero', 0, async function () {
1827      let msg = "testPen_SetAlpha_MinValueZero"
1828      console.info(msg + 'begin');
1829      const pen = new drawing.Pen();
1830      try {
1831        pen.setAlpha(0);
1832      } catch (err) {
1833        console.info(msg + 'setAlpha error cause: ' + JSON.stringify(err));
1834        expect().assertFail();
1835      }
1836    })
1837    /**
1838     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1660
1839     * @tc.name      : testPen_SetAlpha_MaxValue
1840     * @tc.desc      : Used to set the transparency of the brush
1841     * @tc.size      : MediumTest
1842     * @tc.type      : Function
1843     * @tc.level     : Level 3
1844     */
1845    it('testPen_SetAlpha_MaxValue', 0, async function () {
1846      let msg = "testPen_SetAlpha_MaxValue"
1847      console.info(msg + 'begin');
1848      const pen = new drawing.Pen();
1849      try {
1850        pen.setAlpha(255);
1851      } catch (err) {
1852        console.info(msg + 'setAlpha error cause: ' + JSON.stringify(err));
1853        expect().assertFail();
1854      }
1855    })
1856    /**
1857     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1680
1858     * @tc.name      : testPen_SetAlpha_LessThan_MinValue
1859     * @tc.desc      : Used to set the transTparency of the brush
1860     * @tc.size      : MediumTest
1861     * @tc.type      : Function
1862     * @tc.level     : Level 3
1863     */
1864    it('testPen_SetAlpha_LessThan_MinValue', 0, async function () {
1865      let msg = "testPen_SetAlpha_LessThan_MinValue"
1866      console.info(msg + 'begin');
1867      const pen = new drawing.Pen();
1868      try {
1869        pen.setAlpha(0.1458);
1870        console.info(msg + 'setAlpha successed');
1871      } catch (err) {
1872        console.info(msg + 'setAlpha error cause: ' + JSON.stringify(err));
1873        expect().assertFail();
1874      }
1875    })
1876    /**
1877     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0360
1878     * @tc.name      : testPen_SetColorFilter
1879     * @tc.desc      : Used to add additional color filters to the brush
1880     * @tc.size      : MediumTest
1881     * @tc.type      : Function
1882     * @tc.level     : Level 3
1883     */
1884    it('testPen_SetColorFilter', 0, async function () {
1885      let msg = "testPen_SetColorFilter"
1886      console.info(msg + 'begin');
1887      const pen = new drawing.Pen();
1888      let colorFilter = null;
1889      try {
1890        colorFilter = drawing.ColorFilter.createLinearToSRGBGamma();
1891        expect(colorFilter != null).assertTrue();
1892      } catch (err) {
1893        console.info(msg + 'createLinearToSRGBGamma error cause: ' + JSON.stringify(err));
1894        expect().assertFail();
1895      }
1896      try {
1897        pen.setColorFilter(colorFilter);
1898      } catch (err) {
1899        console.info(msg + 'setColorFilter error cause: ' + JSON.stringify(err));
1900        expect().assertFail();
1901      }
1902    })
1903    /**
1904     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0370
1905     * @tc.name      : testPen_SetBlendMode_Src
1906     * @tc.desc      : Used to set the blending mode of the brush
1907     * @tc.size      : MediumTest
1908     * @tc.type      : Function
1909     * @tc.level     : Level 3
1910     */
1911    it('testPen_SetBlendMode_Src', 0, async function () {
1912      let msg = "testPen_SetBlendMode_Src"
1913      console.info(msg + 'begin');
1914      const pen = new drawing.Pen();
1915      try {
1916        pen.setBlendMode(drawing.BlendMode.SRC);
1917      } catch (err) {
1918        console.info(msg + 'setBlendMode error cause: ' + JSON.stringify(err));
1919        expect().assertFail();
1920      }
1921    })
1922    /**
1923     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1740
1924     * @tc.name      : testPen_SetBlendMode_Overlay
1925     * @tc.desc      : Used to set the blending mode of the brush
1926     * @tc.size      : MediumTest
1927     * @tc.type      : Function
1928     * @tc.level     : Level 3
1929     */
1930    it('testPen_SetBlendMode_Overlay', 0, async function () {
1931      let msg = "testPen_SetBlendMode_Overlay"
1932      console.info(msg + 'begin');
1933      const pen = new drawing.Pen();
1934      try {
1935        pen.setBlendMode(drawing.BlendMode.OVERLAY);
1936      } catch (err) {
1937        console.info(msg + 'setBlendMode error cause: ' + JSON.stringify(err));
1938        expect().assertFail();
1939      }
1940    })
1941    /**
1942     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1750
1943     * @tc.name      : testPen_SetBlendMode_Luminosity
1944     * @tc.desc      : Used to set the blending mode of the brush
1945     * @tc.size      : MediumTest
1946     * @tc.type      : Function
1947     * @tc.level     : Level 3
1948     */
1949    it('testPen_SetBlendMode_Luminosity', 0, async function () {
1950      let msg = "testPen_SetBlendMode_Luminosity"
1951      console.info(msg + 'begin');
1952      const pen = new drawing.Pen();
1953      try {
1954        pen.setBlendMode(drawing.BlendMode.LUMINOSITY);
1955      } catch (err) {
1956        console.info(msg + 'setBlendMode error cause: ' + JSON.stringify(err));
1957        expect().assertFail();
1958      }
1959    })
1960    /**
1961     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2090
1962     * @tc.name      : testPen_SetBlendMode_AllMode
1963     * @tc.desc      : Used to set the blending mode of the brush
1964     * @tc.size      : MediumTest
1965     * @tc.type      : Function
1966     * @tc.level     : Level 3
1967     */
1968    it('testPen_SetBlendMode_AllMode', 0, async function () {
1969      let msg = "testPen_SetBlendMode_AllMode"
1970      console.info(msg + 'begin');
1971      const pen = new drawing.Pen();
1972      try {
1973        for (let i = 0;i < blendModeArr.length; i++) {
1974          pen.setBlendMode(drawing.BlendMode[blendModeArr[i]]);
1975        }
1976      } catch (err) {
1977        console.info(msg + 'setBlendMode error cause: ' + JSON.stringify(err));
1978        expect().assertFail();
1979      }
1980    })
1981    /**
1982     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0380
1983     * @tc.name      : testPen_SetDither_True
1984     * @tc.desc      : Turn on the shake paint effect of the brush
1985     * @tc.size      : MediumTest
1986     * @tc.type      : Function
1987     * @tc.level     : Level 3
1988     */
1989    it('testPen_SetDither_True', 0, async function () {
1990      let msg = "testPen_SetDither_True"
1991      console.info(msg + 'begin');
1992      const pen = new drawing.Pen();
1993      try {
1994        pen.setDither(true);
1995      } catch (err) {
1996        console.info(msg + 'setDither error cause: ' + JSON.stringify(err));
1997        expect().assertFail();
1998      }
1999    })
2000    /**
2001     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1790
2002     * @tc.name      : testPen_SetDither_False
2003     * @tc.desc      : Turn on the shake paint effect of the brush
2004     * @tc.size      : MediumTest
2005     * @tc.type      : Function
2006     * @tc.level     : Level 3
2007     */
2008    it('testPen_SetDither_False', 0, async function () {
2009      let msg = "testPen_SetDither_False"
2010      console.info(msg + 'begin');
2011      const pen = new drawing.Pen();
2012      try {
2013        pen.setDither(false);
2014      } catch (err) {
2015        console.info(msg + 'setDither error cause: ' + JSON.stringify(err));
2016        expect().assertFail();
2017      }
2018    })
2019    /**
2020     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0390
2021     * @tc.name      : testBrush_setColor_Normal_Paremeter
2022     * @tc.desc      : Used to set the color of the brush
2023     * @tc.size      : MediumTest
2024     * @tc.type      : Function
2025     * @tc.level     : Level 3
2026     */
2027    it('testBrush_setColor_Normal_Paremeter', 0, async function () {
2028      let msg = "testBrush_setColor_Normal_Paremeter"
2029      console.info(msg + 'begin');
2030      const color: common2D.Color = {
2031        alpha: 255, red: 255, green: 0, blue: 0
2032      };
2033      const brush = new drawing.Brush();
2034      try {
2035        brush.setColor(color);
2036      } catch (err) {
2037        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2038        expect().assertFail();
2039      }
2040    })
2041    /**
2042     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0400
2043     * @tc.name      : testBrush_SetAntiAlias_True
2044     * @tc.desc      : Used to set whether to enable anti-aliasing of the brush
2045     * @tc.size      : MediumTest
2046     * @tc.type      : Function
2047     * @tc.level     : Level 3
2048     */
2049    it('testBrush_SetAntiAlias_True', 0, async function () {
2050      let msg = "testBrush_SetAntiAlias_True"
2051      console.info(msg + 'begin');
2052      const brush = new drawing.Brush();
2053      try {
2054        brush.setAntiAlias(true);
2055      } catch (err) {
2056        console.info(msg + 'setAntiAlias error cause: ' + JSON.stringify(err));
2057        expect().assertFail();
2058      }
2059    })
2060    /**
2061     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1920
2062     * @tc.name      : testBrush_SetAntiAlias_False
2063     * @tc.desc      : Used to set whether to enable anti-aliasing of the brush
2064     * @tc.size      : MediumTest
2065     * @tc.type      : Function
2066     * @tc.level     : Level 3
2067     */
2068    it('testBrush_SetAntiAlias_False', 0, async function () {
2069      let msg = "testBrush_SetAntiAlias_False"
2070      console.info(msg + 'begin');
2071      const brush = new drawing.Brush();
2072      try {
2073        brush.setAntiAlias(false);
2074      } catch (err) {
2075        console.info(msg + 'setAntiAlias error cause: ' + JSON.stringify(err));
2076        expect().assertFail();
2077      }
2078    })
2079    /**
2080     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0410
2081     * @tc.name      : testBrush_SetAlpha_Normal_Parameter
2082     * @tc.desc      : Used to set the transparency of the brush
2083     * @tc.size      : MediumTest
2084     * @tc.type      : Function
2085     * @tc.level     : Level 3
2086     */
2087    it('testBrush_SetAlpha_Normal_Parameter', 0, async function () {
2088      let msg = "testBrush_SetAlpha_Normal_Parameter"
2089      console.info(msg + 'begin');
2090      const brush = new drawing.Brush();
2091      try {
2092        brush.setAlpha(128);
2093      } catch (err) {
2094        console.info(msg + 'setAlpha error cause: ' + JSON.stringify(err));
2095        expect().assertFail();
2096      }
2097    })
2098    /**
2099     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1950
2100     * @tc.name      : testBrush_SetAlpha_NonInteger
2101     * @tc.desc      : Used to set the transparency of the brush
2102     * @tc.size      : MediumTest
2103     * @tc.type      : Function
2104     * @tc.level     : Level 3
2105     */
2106    it('testBrush_SetAlpha_NonInteger', 0, async function () {
2107      let msg = "testBrush_SetAlpha_NonInteger"
2108      console.info(msg + 'begin');
2109      const brush = new drawing.Brush();
2110      try {
2111        brush.setAlpha(206.5894);
2112      } catch (err) {
2113        console.info(msg + 'setAlpha error cause: ' + JSON.stringify(err));
2114        expect().assertFail();
2115      }
2116    })
2117    /**
2118     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1960
2119     * @tc.name      : testBrush_SetAlpha_MinValueZero
2120     * @tc.desc      : Used to set the transparency of the brush
2121     * @tc.size      : MediumTest
2122     * @tc.type      : Function
2123     * @tc.level     : Level 3
2124     */
2125    it('testBrush_SetAlpha_MinValueZero', 0, async function () {
2126      let msg = "testBrush_SetAlpha_MinValueZero"
2127      console.info(msg + 'begin');
2128      const brush = new drawing.Brush();
2129      try {
2130        brush.setAlpha(0);
2131      } catch (err) {
2132        console.info(msg + 'setAlpha error cause: ' + JSON.stringify(err));
2133        expect().assertFail();
2134      }
2135    })
2136    /**
2137     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_1970
2138     * @tc.name      : testBrush_SetAlpha_MaxValue
2139     * @tc.desc      : Used to set the transparency of the brush
2140     * @tc.size      : MediumTest
2141     * @tc.type      : Function
2142     * @tc.level     : Level 3
2143     */
2144    it('testBrush_SetAlpha_MaxValue', 0, async function () {
2145      let msg = "testBrush_SetAlpha_MaxValue"
2146      console.info(msg + 'begin');
2147      const brush = new drawing.Brush();
2148      try {
2149        brush.setAlpha(255);
2150      } catch (err) {
2151        console.info(msg + 'setAlpha error cause: ' + JSON.stringify(err));
2152        expect().assertFail();
2153      }
2154    })
2155    /**
2156     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0420
2157     * @tc.name      : testBrush_SetColorFilter
2158     * @tc.desc      : Used to add additional color filters to the brush
2159     * @tc.size      : MediumTest
2160     * @tc.type      : Function
2161     * @tc.level     : Level 3
2162     */
2163    it('testBrush_SetColorFilter', 0, async function () {
2164      let msg = "testBrush_SetColorFilter"
2165      console.info(msg + 'begin');
2166      const brush = new drawing.Brush();
2167      let colorFilter = null;
2168      try {
2169        colorFilter = drawing.ColorFilter.createLinearToSRGBGamma();
2170        expect(colorFilter != null).assertTrue();
2171      } catch (err) {
2172        console.info(msg + 'createLinearToSRGBGamma error cause: ' + JSON.stringify(err));
2173        expect().assertFail();
2174      }
2175      try {
2176        brush.setColorFilter(colorFilter);
2177      } catch (err) {
2178        console.info(msg + 'setColorFilter error cause: ' + JSON.stringify(err));
2179        expect().assertFail();
2180      }
2181    })
2182    /**
2183     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0430
2184     * @tc.name      : testBrush_SetBlendMode_Src
2185     * @tc.desc      : Used to set the blending mode of the brush
2186     * @tc.size      : MediumTest
2187     * @tc.type      : Function
2188     * @tc.level     : Level 3
2189     */
2190    it('testBrush_SetBlendMode_Src', 0, async function () {
2191      let msg = "testBrush_SetBlendMode_Src"
2192      console.info(msg + 'begin');
2193      const brush = new drawing.Brush();
2194      try {
2195        brush.setBlendMode(drawing.BlendMode.SRC);
2196      } catch (err) {
2197        console.info(msg + 'setBlendMode error cause: ' + JSON.stringify(err));
2198        expect().assertFail();
2199      }
2200    })
2201    /**
2202     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2050
2203     * @tc.name      : testBrush_SetBlendMode_AllMode
2204     * @tc.desc      : Used to set the blending mode of the brush
2205     * @tc.size      : MediumTest
2206     * @tc.type      : Function
2207     * @tc.level     : Level 3
2208     */
2209    it('testBrush_SetBlendMode_AllMode', 0, async function () {
2210      let msg = "testBrush_SetBlendMode_AllMode"
2211      console.info(msg + 'begin');
2212      const brush = new drawing.Brush();
2213      try {
2214        for (let i = 0;i < blendModeArr.length; i++) {
2215          brush.setBlendMode(drawing.BlendMode[blendModeArr[i]]);
2216        }
2217      } catch (err) {
2218        console.info(msg + 'setBlendMode error cause: ' + JSON.stringify(err));
2219        expect().assertFail();
2220      }
2221    })
2222    /**
2223     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0440
2224     * @tc.name      : testCanvas_DrawRect_Normal
2225     * @tc.desc      : Used to draw a rectangle
2226     * @tc.size      : MediumTest
2227     * @tc.type      : Function
2228     * @tc.level     : Level 3
2229     */
2230    it('testCanvas_DrawRect_Normal', 0, async function () {
2231      let msg = "testCanvas_DrawRect_Normal"
2232      console.info(msg + 'begin');
2233      let canvas = new drawing.Canvas(pixel)
2234      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2235      const pen = new drawing.Pen();
2236      try {
2237        pen.setStrokeWidth(5);
2238        console.info(msg + 'setStrokeWidth successed');
2239      } catch (err) {
2240        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2241        expect().assertFail();
2242      }
2243      try {
2244        pen.setColor({
2245          alpha: 255, red: 255, green: 0, blue: 0
2246        });
2247        console.info(msg + 'setColor successed');
2248      } catch (err) {
2249        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2250        expect().assertFail();
2251      }
2252      try {
2253        canvas.attachPen(pen);
2254        console.info(msg + 'attachPen successed');
2255      } catch (err) {
2256        console.info(msg + `attachPen errorCode is:  ${err.code} + errormsg is: ${err.message}`);
2257        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
2258        expect().assertFail();
2259      }
2260      try {
2261        canvas.drawRect({
2262          left: 0, right: 0, top: 10, bottom: 10
2263        });
2264        console.info(msg + 'drawRect successed');
2265      } catch (err) {
2266        console.info(msg + `drawRect errorCode is:  ${err.code} + errorMsg is: ${err.message}`);
2267        expect().assertFail();
2268      }
2269      try {
2270        canvas.detachPen();
2271        console.info(msg + 'detachPen successed');
2272      } catch (err) {
2273        console.info(msg + `detachPen errorCode is:  ${err.code} + errorMsg is: ${err.message}`);
2274        expect().assertFail();
2275      }
2276    })
2277    /**
2278     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2100
2279     * @tc.name      : testCanvas_DrawRect_LargeNumber
2280     * @tc.desc      : Used to draw a rectangle
2281     * @tc.size      : MediumTest
2282     * @tc.type      : Function
2283     * @tc.level     : Level 3
2284     */
2285    it('testCanvas_DrawRect_LargeNumber', 0, async function () {
2286      let msg = "testCanvas_DrawRect_LargeNumber"
2287      console.info(msg + 'begin');
2288      let canvas = new drawing.Canvas(pixel)
2289      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2290      const pen = new drawing.Pen();
2291      try {
2292        pen.setStrokeWidth(5);
2293        console.info(msg + 'setStrokeWidth successed');
2294      } catch (err) {
2295        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2296        expect().assertFail();
2297      }
2298      try {
2299        pen.setColor({
2300          alpha: 255, red: 255, green: 0, blue: 0
2301        });
2302        console.info(msg + 'setColor successed');
2303      } catch (err) {
2304        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2305        expect().assertFail();
2306      }
2307      try {
2308        canvas.attachPen(pen);
2309        console.info(msg + 'attachPen successed');
2310      } catch (err) {
2311        console.info(msg + `attachPen errorCode is:  ${err.code} + errormsg is: ${err.message}`);
2312        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
2313        expect().assertFail();
2314      }
2315      try {
2316        canvas.drawRect({
2317          left: 1000, right: 5000, top: 30000, bottom: 20000
2318        });
2319        console.info(msg + 'drawRect successed');
2320      } catch (err) {
2321        console.info(msg + `drawRect errorCode is:  ${err.code} + errorMsg is: ${err.message}`);
2322        expect().assertFail();
2323      }
2324      try {
2325        canvas.detachPen();
2326        console.info(msg + 'detachPen successed');
2327      } catch (err) {
2328        console.info(msg + `detachPen errorCode is:  ${err.code} + errorMsg is: ${err.message}`);
2329        expect().assertFail();
2330      }
2331    })
2332    /**
2333     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2110
2334     * @tc.name      : testCanvas_DrawRect_Minus
2335     * @tc.desc      : Used to draw a rectangle
2336     * @tc.size      : MediumTest
2337     * @tc.type      : Function
2338     * @tc.level     : Level 3
2339     */
2340    it('testCanvas_DrawRect_Minus', 0, async function () {
2341      let msg = "testCanvas_DrawRect_Minus"
2342      console.info(msg + 'begin');
2343      let canvas = new drawing.Canvas(pixel)
2344      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2345      const pen = new drawing.Pen();
2346      try {
2347        pen.setStrokeWidth(5);
2348        console.info(msg + 'setStrokeWidth successed');
2349      } catch (err) {
2350        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2351        expect().assertFail();
2352      }
2353      try {
2354        pen.setColor({
2355          alpha: 255, red: 255, green: 0, blue: 0
2356        });
2357        console.info(msg + 'setColor successed');
2358      } catch (err) {
2359        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2360        expect().assertFail();
2361      }
2362      try {
2363        canvas.attachPen(pen);
2364        console.info(msg + 'attachPen successed');
2365      } catch (err) {
2366        console.info(msg + `attachPen errorCode is:  ${err.code} + errormsg is: ${err.message}`);
2367        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
2368        expect().assertFail();
2369      }
2370      try {
2371        canvas.drawRect({
2372          left: -10, right:-29, top: -100, bottom: -300
2373        });
2374        console.info(msg + 'drawRect successed');
2375      } catch (err) {
2376        console.info(msg + `drawRect errorCode is:  ${err.code} + errorMsg is: ${err.message}`);
2377        expect().assertFail();
2378      }
2379      try {
2380        canvas.detachPen();
2381        console.info(msg + 'detachPen successed');
2382      } catch (err) {
2383        console.info(msg + `detachPen errorCode is:  ${err.code} + errorMsg is: ${err.message}`);
2384        expect().assertFail();
2385      }
2386    })
2387    /**
2388     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2140
2389     * @tc.name      : testCanvas_DrawRect_NonInteger
2390     * @tc.desc      : Used to draw a rectangle
2391     * @tc.size      : MediumTest
2392     * @tc.type      : Function
2393     * @tc.level     : Level 3
2394     */
2395    it('testCanvas_DrawRect_NonInteger', 0, async function () {
2396      let msg = "testCanvas_DrawRect_NonInteger"
2397      console.info(msg + 'begin');
2398      let canvas = new drawing.Canvas(pixel)
2399      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2400      const pen = new drawing.Pen();
2401      try {
2402        pen.setStrokeWidth(5);
2403        console.info(msg + 'setStrokeWidth successed');
2404      } catch (err) {
2405        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2406        expect().assertFail();
2407      }
2408      try {
2409        pen.setColor({
2410          alpha: 255, red: 255, green: 0, blue: 0
2411        });
2412        console.info(msg + 'setColor successed');
2413      } catch (err) {
2414        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2415        expect().assertFail();
2416      }
2417      try {
2418        canvas.attachPen(pen);
2419        console.info(msg + 'attachPen successed');
2420      } catch (err) {
2421        console.info(msg + `attachPen errorCode is:  ${err.code} + errormsg is: ${err.message}`);
2422        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
2423        expect().assertFail();
2424      }
2425      try {
2426        canvas.drawRect({
2427          left: 10.5689, right:20.5698, top: 59.1795, bottom: 100.000014844
2428        });
2429        console.info(msg + 'drawRect successed');
2430      } catch (err) {
2431        console.info(msg + `drawRect errorCode is:  ${err.code} + errorMsg is: ${err.message}`);
2432        expect().assertFail();
2433      }
2434      try {
2435        canvas.detachPen();
2436        console.info(msg + 'detachPen successed');
2437      } catch (err) {
2438        console.info(msg + `detachPen errorCode is:  ${err.code} + errorMsg is: ${err.message}`);
2439        expect().assertFail();
2440      }
2441    })
2442    /**
2443     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0450
2444     * @tc.name      : testCanvas_DrawCircle_Normal
2445     * @tc.desc      : Used to draw a circle
2446     * @tc.size      : MediumTest
2447     * @tc.type      : Function
2448     * @tc.level     : Level 3
2449     */
2450    it('testCanvas_DrawCircle_Normal', 0, async function () {
2451      let msg = "testCanvas_DrawCircle_Normal"
2452      console.info(msg + 'begin');
2453      let canvas = new drawing.Canvas(pixel)
2454      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2455      const pen = new drawing.Pen();
2456      try {
2457        pen.setStrokeWidth(5);
2458        console.info(msg + 'setStrokeWidth successed');
2459      } catch (err) {
2460        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2461        expect().assertFail();
2462      }
2463      try {
2464        pen.setColor({
2465          alpha: 255, red: 255, green: 0, blue: 0
2466        });
2467        console.info(msg + 'setColor successed');
2468      } catch (err) {
2469        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2470        expect().assertFail();
2471      }
2472      try {
2473        canvas.attachPen(pen);
2474        console.info(msg + 'attachPen successed');
2475      } catch (err) {
2476        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
2477        expect().assertFail();
2478      }
2479      try {
2480        canvas.drawCircle(10, 10, 2);
2481        console.info(msg + 'drawCircle successed');
2482      } catch (err) {
2483        console.info(msg + 'drawCircle error cause: ' + JSON.stringify(err));
2484        expect().assertFail();
2485      }
2486      try {
2487        canvas.detachPen();
2488        console.info(msg + 'detachPen successed');
2489      } catch (err) {
2490        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
2491        expect().assertFail();
2492      }
2493    })
2494    /**
2495     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2150
2496     * @tc.name      : testCanvas_DrawCircle_LargeNumber
2497     * @tc.desc      : Used to draw a circle
2498     * @tc.size      : MediumTest
2499     * @tc.type      : Function
2500     * @tc.level     : Level 3
2501     */
2502    it('testCanvas_DrawCircle_LargeNumber', 0, async function () {
2503      let msg = "testCanvas_DrawCircle_LargeNumber"
2504      console.info(msg + 'begin');
2505      let canvas = new drawing.Canvas(pixel)
2506      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2507      const pen = new drawing.Pen();
2508      try {
2509        pen.setStrokeWidth(5);
2510        console.info(msg + 'setStrokeWidth successed');
2511      } catch (err) {
2512        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2513        expect().assertFail();
2514      }
2515      try {
2516        pen.setColor({
2517          alpha: 255, red: 255, green: 0, blue: 0
2518        });
2519        console.info(msg + 'setColor successed');
2520      } catch (err) {
2521        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2522        expect().assertFail();
2523      }
2524      try {
2525        canvas.attachPen(pen);
2526        console.info(msg + 'attachPen successed');
2527      } catch (err) {
2528        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
2529        expect().assertFail();
2530      }
2531      try {
2532        canvas.drawCircle(10000, 20000, 20000);
2533        console.info(msg + 'drawCircle successed');
2534      } catch (err) {
2535        console.info(msg + 'drawCircle error cause: ' + JSON.stringify(err));
2536        expect().assertFail();
2537      }
2538      try {
2539        canvas.detachPen();
2540        console.info(msg + 'detachPen successed');
2541      } catch (err) {
2542        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
2543        expect().assertFail();
2544      }
2545    })
2546    /**
2547     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2190
2548     * @tc.name      : testCanvas_DrawCircle_NonInteger
2549     * @tc.desc      : Used to draw a circle
2550     * @tc.size      : MediumTest
2551     * @tc.type      : Function
2552     * @tc.level     : Level 3
2553     */
2554    it('testCanvas_DrawCircle_NonInteger', 0, async function () {
2555      let msg = "testCanvas_DrawCircle_NonInteger"
2556      console.info(msg + 'begin');
2557      let canvas = new drawing.Canvas(pixel)
2558      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2559      const pen = new drawing.Pen();
2560      try {
2561        pen.setStrokeWidth(5);
2562        console.info(msg + 'setStrokeWidth successed');
2563      } catch (err) {
2564        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2565        expect().assertFail();
2566      }
2567      try {
2568        pen.setColor({
2569          alpha: 255, red: 255, green: 0, blue: 0
2570        });
2571        console.info(msg + 'setColor successed');
2572      } catch (err) {
2573        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2574        expect().assertFail();
2575      }
2576      try {
2577        canvas.attachPen(pen);
2578        console.info(msg + 'attachPen successed');
2579      } catch (err) {
2580        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
2581        expect().assertFail();
2582      }
2583      try {
2584        canvas.drawCircle(20.5698, 600.2544, 100.2589);
2585        console.info(msg + 'drawCircle successed');
2586      } catch (err) {
2587        console.info(msg + 'drawCircle error cause: ' + JSON.stringify(err));
2588        expect().assertFail();
2589      }
2590      try {
2591        canvas.detachPen();
2592        console.info(msg + 'detachPen successed');
2593      } catch (err) {
2594        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
2595        expect().assertFail();
2596      }
2597    })
2598    /**
2599     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0460
2600     * @tc.name      : testCanvas_DrawImage_Normal
2601     * @tc.desc      : Used to draw a picture
2602     * @tc.size      : MediumTest
2603     * @tc.type      : Function
2604     * @tc.level     : Level 3
2605     */
2606    it('testCanvas_DrawImage_Normal', 0, async function () {
2607      let msg = "testCanvas_DrawImage_Normal"
2608      console.info(msg + 'begin');
2609      await buttonClick('UpdateDrawNode', msg).catch(async err => {
2610        console.info(msg + err);
2611        expect().assertFail();
2612      })
2613      let pixelMap_: image.PixelMap | null = null;
2614      const color: ArrayBuffer = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
2615      let opts: image.InitializationOptions = {
2616        editable: true, pixelFormat: 3, size: {
2617          height: 4, width: 6
2618        }
2619      }
2620      await image.createPixelMap(color, opts).then((pixelMap: image.PixelMap) => {
2621        pixelMap_ = pixelMap
2622        console.info(msg + 'Succeeded in creating pixelmap.');
2623      }).catch((error: BusinessError) => {
2624        console.error(msg + 'Failed to create pixelmap.');
2625        expect().assertFail();
2626      })
2627
2628      let canvas = new drawing.Canvas(pixelMap_)
2629      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2630      try {
2631        canvas.drawImage(pixelMap_, 0, 0);
2632        console.info(msg + 'drawImage successed');
2633      } catch (err) {
2634        console.info(msg + 'drawImage error cause: ' + JSON.stringify(err));
2635        expect().assertFail();
2636      }
2637    })
2638    /**
2639     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2200
2640     * @tc.name      : testCanvas_DrawImage_LargeNumber
2641     * @tc.desc      : Used to draw a picture
2642     * @tc.size      : MediumTest
2643     * @tc.type      : Function
2644     * @tc.level     : Level 3
2645     */
2646    it('testCanvas_DrawImage_LargeNumber', 0, async function () {
2647      let msg = "testCanvas_DrawImage_LargeNumber"
2648      console.info(msg + 'begin');
2649      await buttonClick('UpdateDrawNode', msg).catch(async err => {
2650        console.info(msg + err);
2651        expect().assertFail();
2652      })
2653      let pixelMap_: image.PixelMap | null = null;
2654      //96为需要创建的像素buffer大小,取值为:height * width *4
2655      const color: ArrayBuffer = new ArrayBuffer(96);
2656      let opts: image.InitializationOptions = {
2657        editable: true, pixelFormat: 3, size: {
2658          height: 4, width: 6
2659        }
2660      }
2661      await image.createPixelMap(color, opts).then((pixelMap: image.PixelMap) => {
2662        pixelMap_ = pixelMap
2663        console.info(msg + 'Succeeded in creating pixelmap.');
2664      }).catch((error: BusinessError) => {
2665        console.error(msg + 'Failed to create pixelmap.');
2666        expect().assertFail();
2667      })
2668
2669      let canvas = new drawing.Canvas(pixelMap_)
2670      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2671      try {
2672        canvas.drawImage(pixelMap_, 20000, 30000);
2673        console.info(msg + 'drawImage successed');
2674      } catch (err) {
2675        console.info(msg + 'drawImage error cause: ' + JSON.stringify(err));
2676        expect().assertFail();
2677      }
2678    })
2679    /**
2680     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2210
2681     * @tc.name      : testCanvas_DrawImage_Minus
2682     * @tc.desc      : Used to draw a picture
2683     * @tc.size      : MediumTest
2684     * @tc.type      : Function
2685     * @tc.level     : Level 3
2686     */
2687    it('testCanvas_DrawImage_Minus', 0, async function () {
2688      let msg = "testCanvas_DrawImage_Minus"
2689      console.info(msg + 'begin');
2690      await buttonClick('UpdateDrawNode', msg).catch(async err => {
2691        console.info(msg + err);
2692        expect().assertFail();
2693      })
2694      let pixelMap_: image.PixelMap | null = null;
2695      //96为需要创建的像素buffer大小,取值为:height * width *4
2696      const color: ArrayBuffer = new ArrayBuffer(96);
2697      let opts: image.InitializationOptions = {
2698        editable: true, pixelFormat: 3, size: {
2699          height: 4, width: 6
2700        }
2701      }
2702      await image.createPixelMap(color, opts).then((pixelMap: image.PixelMap) => {
2703        pixelMap_ = pixelMap
2704        console.info(msg + 'Succeeded in creating pixelmap.');
2705      }).catch((error: BusinessError) => {
2706        console.error(msg + 'Failed to create pixelmap.');
2707        expect().assertFail();
2708      })
2709
2710      let canvas = new drawing.Canvas(pixelMap_)
2711      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2712      try {
2713        canvas.drawImage(pixelMap_, -30, -70);
2714        console.info(msg + 'drawImage successed');
2715      } catch (err) {
2716        console.info(msg + 'drawImage error cause: ' + JSON.stringify(err));
2717        expect().assertFail();
2718      }
2719    })
2720    /**
2721     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2260
2722     * @tc.name      : testCanvas_DrawImage_NonInteger
2723     * @tc.desc      : Used to draw a picture
2724     * @tc.size      : MediumTest
2725     * @tc.type      : Function
2726     * @tc.level     : Level 3
2727     */
2728    it('testCanvas_DrawImage_NonInteger', 0, async function () {
2729      let msg = "testCanvas_DrawImage_NonInteger"
2730      console.info(msg + 'begin');
2731      await buttonClick('UpdateDrawNode', msg).catch(async err => {
2732        console.info(msg + err);
2733        expect().assertFail();
2734      })
2735      let pixelMap_: image.PixelMap | null = null;
2736      //96为需要创建的像素buffer大小,取值为:height * width *4
2737      const color: ArrayBuffer = new ArrayBuffer(96);
2738      let opts: image.InitializationOptions = {
2739        editable: true, pixelFormat: 3, size: {
2740          height: 4, width: 6
2741        }
2742      }
2743      await image.createPixelMap(color, opts).then((pixelMap: image.PixelMap) => {
2744        pixelMap_ = pixelMap
2745        console.info(msg + 'Succeeded in creating pixelmap.');
2746      }).catch((error: BusinessError) => {
2747        console.error(msg + 'Failed to create pixelmap.');
2748        expect().assertFail();
2749      })
2750
2751      let canvas = new drawing.Canvas(pixelMap_)
2752      console.info(msg + 'canvas is: ' + JSON.stringify(canvas));
2753      try {
2754        canvas.drawImage(pixelMap_, 20.5987, 30.598);
2755        console.info(msg + 'drawImage successed');
2756      } catch (err) {
2757        console.info(msg + 'drawImage error cause: ' + JSON.stringify(err));
2758        expect().assertFail();
2759      }
2760    })
2761    /**
2762     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0470
2763     * @tc.name      : testCanvas_DrawColor_Normal
2764     * @tc.desc      : Paint background color
2765     * @tc.size      : MediumTest
2766     * @tc.type      : Function
2767     * @tc.level     : Level 3
2768     */
2769    it('testCanvas_DrawColor_Normal', 0, async function () {
2770      let msg = "testCanvas_DrawColor_Normal"
2771      console.info(msg + 'begin');
2772      let canvas = new drawing.Canvas(pixel)
2773      let color: common2D.Color = {
2774        alpha: 255,
2775        red: 0,
2776        green: 10,
2777        blue: 10
2778      }
2779      try {
2780        canvas.drawColor(color, drawing.BlendMode.CLEAR);
2781        console.info(msg + 'drawColor successed');
2782      } catch (err) {
2783        console.info(msg + 'drawColor error cause: ' + JSON.stringify(err));
2784        expect().assertFail();
2785      }
2786    })
2787    /**
2788     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2370
2789     * @tc.name      : testCanvas_DrawColor_AllBlendMode
2790     * @tc.desc      : Paint background color
2791     * @tc.size      : MediumTest
2792     * @tc.type      : Function
2793     * @tc.level     : Level 3
2794     */
2795    it('testCanvas_DrawColor_AllBlendMode', 0, async function () {
2796      let msg = "testCanvas_DrawColor_AllBlendMode"
2797      console.info(msg + 'begin');
2798      let canvas = new drawing.Canvas(pixel)
2799      let color: common2D.Color = {
2800        alpha: 255,
2801        red: 240,
2802        green: 0,
2803        blue: 0
2804      }
2805      try {
2806        for (let i = 0;i < blendModeArr.length; i++) {
2807          canvas.drawColor(color, drawing.BlendMode[blendModeArr[i]]);
2808          console.info(msg + 'drawColor successed current mode is: '+ drawing.BlendMode[blendModeArr[i]]);
2809        }
2810      } catch (err) {
2811        console.info(msg + 'drawColor error cause: ' + JSON.stringify(err));
2812        expect().assertFail();
2813      }
2814    })
2815    /**
2816     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0480
2817     * @tc.name      : testCanvas_DrawPoint_Normal
2818     * @tc.desc      : Used to draw a point
2819     * @tc.size      : MediumTest
2820     * @tc.type      : Function
2821     * @tc.level     : Level 3
2822     */
2823    it('testCanvas_DrawPoint_Normal', 0, async function () {
2824      let msg = "testCanvas_DrawPoint_Normal"
2825      console.info(msg + 'begin');
2826      let canvas = new drawing.Canvas(pixel)
2827      const pen = new drawing.Pen();
2828      try {
2829        pen.setStrokeWidth(5);
2830        console.info(msg + 'setStrokeWidth successed');
2831      } catch (err) {
2832        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2833        expect().assertFail();
2834      }
2835      try {
2836        pen.setColor({
2837          alpha: 255, red: 255, green: 0, blue: 0
2838        });
2839        console.info(msg + 'setColor successed');
2840      } catch (err) {
2841        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2842        expect().assertFail();
2843      }
2844      try {
2845        canvas.attachPen(pen);
2846        console.info(msg + 'attachPen successed');
2847      } catch (err) {
2848        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
2849        expect().assertFail();
2850      }
2851      try {
2852        canvas.drawPoint(10, 10);
2853        console.info(msg + 'drawPoint successed');
2854      } catch (err) {
2855        console.info(msg + 'drawPoint error cause: ' + JSON.stringify(err));
2856        expect().assertFail();
2857      }
2858      try {
2859        canvas.detachPen();
2860        console.info(msg + 'detachPen successed');
2861      } catch (err) {
2862        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
2863        expect().assertFail();
2864      }
2865    })
2866    /**
2867     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2420
2868     * @tc.name      : testCanvas_DrawPoint_NonInteger
2869     * @tc.desc      : Used to draw a point
2870     * @tc.size      : MediumTest
2871     * @tc.type      : Function
2872     * @tc.level     : Level 3
2873     */
2874    it('testCanvas_DrawPoint_NonInteger', 0, async function () {
2875      let msg = "testCanvas_DrawPoint_NonInteger"
2876      console.info(msg + 'begin');
2877      let canvas = new drawing.Canvas(pixel)
2878      const pen = new drawing.Pen();
2879      try {
2880        pen.setStrokeWidth(5);
2881        console.info(msg + 'setStrokeWidth successed');
2882      } catch (err) {
2883        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2884        expect().assertFail();
2885      }
2886      try {
2887        pen.setColor({
2888          alpha: 255, red: 255, green: 0, blue: 0
2889        });
2890        console.info(msg + 'setColor successed');
2891      } catch (err) {
2892        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2893        expect().assertFail();
2894      }
2895      try {
2896        canvas.attachPen(pen);
2897        console.info(msg + 'attachPen successed');
2898      } catch (err) {
2899        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
2900        expect().assertFail();
2901      }
2902      try {
2903        canvas.drawPoint(50.268976, 60.21);
2904        console.info(msg + 'drawPoint successed');
2905      } catch (err) {
2906        console.info(msg + 'drawPoint error cause: ' + JSON.stringify(err));
2907        expect().assertFail();
2908      }
2909      try {
2910        canvas.detachPen();
2911        console.info(msg + 'detachPen successed');
2912      } catch (err) {
2913        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
2914        expect().assertFail();
2915      }
2916    })
2917    /**
2918     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2430
2919     * @tc.name      : testCanvas_DrawPoint_Minus
2920     * @tc.desc      : Used to draw a point
2921     * @tc.size      : MediumTest
2922     * @tc.type      : Function
2923     * @tc.level     : Level 3
2924     */
2925    it('testCanvas_DrawPoint_Minus', 0, async function () {
2926      let msg = "testCanvas_DrawPoint_Minus"
2927      console.info(msg + 'begin');
2928      let canvas = new drawing.Canvas(pixel)
2929      const pen = new drawing.Pen();
2930      try {
2931        pen.setStrokeWidth(5);
2932        console.info(msg + 'setStrokeWidth successed');
2933      } catch (err) {
2934        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2935        expect().assertFail();
2936      }
2937      try {
2938        pen.setColor({
2939          alpha: 255, red: 255, green: 0, blue: 0
2940        });
2941        console.info(msg + 'setColor successed');
2942      } catch (err) {
2943        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2944        expect().assertFail();
2945      }
2946      try {
2947        canvas.attachPen(pen);
2948        console.info(msg + 'attachPen successed');
2949      } catch (err) {
2950        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
2951        expect().assertFail();
2952      }
2953      try {
2954        canvas.drawPoint(-100, -300);
2955        console.info(msg + 'drawPoint successed');
2956      } catch (err) {
2957        console.info(msg + 'drawPoint error cause: ' + JSON.stringify(err));
2958        expect().assertFail();
2959      }
2960      try {
2961        canvas.detachPen();
2962        console.info(msg + 'detachPen successed');
2963      } catch (err) {
2964        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
2965        expect().assertFail();
2966      }
2967    })
2968    /**
2969     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2440
2970     * @tc.name      : testCanvas_DrawPoint_LargeNumber
2971     * @tc.desc      : Used to draw a point
2972     * @tc.size      : MediumTest
2973     * @tc.type      : Function
2974     * @tc.level     : Level 3
2975     */
2976    it('testCanvas_DrawPoint_LargeNumber', 0, async function () {
2977      let msg = "testCanvas_DrawPoint_LargeNumber"
2978      console.info(msg + 'begin');
2979      let canvas = new drawing.Canvas(pixel)
2980      const pen = new drawing.Pen();
2981      try {
2982        pen.setStrokeWidth(5);
2983        console.info(msg + 'setStrokeWidth successed');
2984      } catch (err) {
2985        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
2986        expect().assertFail();
2987      }
2988      try {
2989        pen.setColor({
2990          alpha: 255, red: 255, green: 0, blue: 0
2991        });
2992        console.info(msg + 'setColor successed');
2993      } catch (err) {
2994        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
2995        expect().assertFail();
2996      }
2997      try {
2998        canvas.attachPen(pen);
2999        console.info(msg + 'attachPen successed');
3000      } catch (err) {
3001        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
3002        expect().assertFail();
3003      }
3004      try {
3005        canvas.drawPoint(20000, 30000);
3006        console.info(msg + 'drawPoint successed');
3007      } catch (err) {
3008        console.info(msg + 'drawPoint error cause: ' + JSON.stringify(err));
3009        expect().assertFail();
3010      }
3011      try {
3012        canvas.detachPen();
3013        console.info(msg + 'detachPen successed');
3014      } catch (err) {
3015        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
3016        expect().assertFail();
3017      }
3018    })
3019    /**
3020     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0490
3021     * @tc.name      : testCanvas_DrawPath_Normal
3022     * @tc.desc      : Used to draw a custom path
3023     * @tc.size      : MediumTest
3024     * @tc.type      : Function
3025     * @tc.level     : Level 3
3026     */
3027    it('testCanvas_DrawPath_Normal', 0, async function () {
3028      let msg = "testCanvas_DrawPath_Normal"
3029      console.info(msg + 'begin');
3030      let canvas = new drawing.Canvas(pixel)
3031      const pen = new drawing.Pen();
3032      let path = new drawing.Path();
3033      try {
3034        pen.setStrokeWidth(5);
3035        console.info(msg + 'setStrokeWidth successed');
3036      } catch (err) {
3037        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
3038        expect().assertFail();
3039      }
3040      try {
3041        pen.setColor({
3042          alpha: 255, red: 255, green: 0, blue: 0
3043        });
3044        console.info(msg + 'setColor successed');
3045      } catch (err) {
3046        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3047        expect().assertFail();
3048      }
3049      try {
3050        path.moveTo(10, 10);
3051        console.info(msg + 'moveTo successed');
3052      } catch (err) {
3053        console.info(msg + 'moveTo error cause: ' + JSON.stringify(err));
3054        expect().assertFail();
3055      }
3056      try {
3057        path.cubicTo(10, 10, 10, 10, 15, 15);
3058        console.info(msg + 'cubicTo successed');
3059      } catch (err) {
3060        console.info(msg + 'cubicTo error cause: ' + JSON.stringify(err));
3061        expect().assertFail();
3062      }
3063      try {
3064        path.close();
3065        console.info(msg + 'close successed');
3066      } catch (err) {
3067        console.info(msg + 'close error cause: ' + JSON.stringify(err));
3068        expect().assertFail();
3069      }
3070      try {
3071        canvas.attachPen(pen);
3072        console.info(msg + 'attachPen successed');
3073      } catch (err) {
3074        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
3075        expect().assertFail();
3076      }
3077      try {
3078        canvas.drawPath(path);
3079        console.info(msg + 'drawPath successed');
3080      } catch (err) {
3081        console.info(msg + 'drawPath error cause: ' + JSON.stringify(err));
3082        expect().assertFail();
3083      }
3084      try {
3085        canvas.detachPen();
3086        console.info(msg + 'detachPen successed');
3087      } catch (err) {
3088        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
3089        expect().assertFail();
3090      }
3091    })
3092    /**
3093     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0500
3094     * @tc.name      : testCanvas_DrawLine_Normal
3095     * @tc.desc      : Used to draw a straight line segment
3096     * @tc.size      : MediumTest
3097     * @tc.type      : Function
3098     * @tc.level     : Level 3
3099     */
3100    it('testCanvas_DrawLine_Normal', 0, async function () {
3101      let msg = "testCanvas_DrawLine_Normal"
3102      console.info(msg + 'begin');
3103      let canvas = new drawing.Canvas(pixel)
3104      const pen = new drawing.Pen();
3105      try {
3106        pen.setStrokeWidth(5);
3107        console.info(msg + 'setStrokeWidth successed');
3108      } catch (err) {
3109        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
3110        expect().assertFail();
3111      }
3112      try {
3113        pen.setColor({
3114          alpha: 255, red: 255, green: 0, blue: 0
3115        });
3116        console.info(msg + 'setColor successed');
3117      } catch (err) {
3118        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3119        expect().assertFail();
3120      }
3121      try {
3122        canvas.attachPen(pen);
3123        console.info(msg + 'attachPen successed');
3124      } catch (err) {
3125        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
3126        expect().assertFail();
3127      }
3128      try {
3129        canvas.drawLine(0, 0, 20, 20);
3130        console.info(msg + 'drawLine successed');
3131      } catch (err) {
3132        console.info(msg + 'drawLine error cause: ' + JSON.stringify(err));
3133        expect().assertFail();
3134      }
3135      try {
3136        canvas.detachPen();
3137        console.info(msg + 'detachPen successed');
3138      } catch (err) {
3139        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
3140        expect().assertFail();
3141      }
3142    })
3143    /**
3144     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2490
3145     * @tc.name      : testCanvas_DrawLine_SecondQuadrant
3146     * @tc.desc      : Used to draw a straight line segment
3147     * @tc.size      : MediumTest
3148     * @tc.type      : Function
3149     * @tc.level     : Level 3
3150     */
3151    it('testCanvas_DrawLine_SecondQuadrant', 0, async function () {
3152      let msg = "testCanvas_DrawLine_SecondQuadrant"
3153      console.info(msg + 'begin');
3154      let canvas = new drawing.Canvas(pixel)
3155      const pen = new drawing.Pen();
3156      try {
3157        pen.setStrokeWidth(5);
3158        console.info(msg + 'setStrokeWidth successed');
3159      } catch (err) {
3160        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
3161        expect().assertFail();
3162      }
3163      try {
3164        pen.setColor({
3165          alpha: 255, red: 255, green: 0, blue: 0
3166        });
3167        console.info(msg + 'setColor successed');
3168      } catch (err) {
3169        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3170        expect().assertFail();
3171      }
3172      try {
3173        canvas.attachPen(pen);
3174        console.info(msg + 'attachPen successed');
3175      } catch (err) {
3176        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
3177        expect().assertFail();
3178      }
3179      try {
3180        canvas.drawLine(0, 0, 20, -20);
3181        console.info(msg + 'drawLine successed');
3182      } catch (err) {
3183        console.info(msg + 'drawLine error cause: ' + JSON.stringify(err));
3184        expect().assertFail();
3185      }
3186      try {
3187        canvas.detachPen();
3188        console.info(msg + 'detachPen successed');
3189      } catch (err) {
3190        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
3191        expect().assertFail();
3192      }
3193    })
3194    /**
3195     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2500
3196     * @tc.name      : testCanvas_DrawLine_ThreeQuadrant
3197     * @tc.desc      : Used to draw a straight line segment
3198     * @tc.size      : MediumTest
3199     * @tc.type      : Function
3200     * @tc.level     : Level 3
3201     */
3202    it('testCanvas_DrawLine_ThreeQuadrant', 0, async function () {
3203      let msg = "testCanvas_DrawLine_ThreeQuadrant"
3204      console.info(msg + 'begin');
3205      let canvas = new drawing.Canvas(pixel)
3206      const pen = new drawing.Pen();
3207      try {
3208        pen.setStrokeWidth(5);
3209        console.info(msg + 'setStrokeWidth successed');
3210      } catch (err) {
3211        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
3212        expect().assertFail();
3213      }
3214      try {
3215        pen.setColor({
3216          alpha: 255, red: 255, green: 0, blue: 0
3217        });
3218        console.info(msg + 'setColor successed');
3219      } catch (err) {
3220        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3221        expect().assertFail();
3222      }
3223      try {
3224        canvas.attachPen(pen);
3225        console.info(msg + 'attachPen successed');
3226      } catch (err) {
3227        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
3228        expect().assertFail();
3229      }
3230      try {
3231        canvas.drawLine(0, 0, -20, -20);
3232        console.info(msg + 'drawLine successed');
3233      } catch (err) {
3234        console.info(msg + 'drawLine error cause: ' + JSON.stringify(err));
3235        expect().assertFail();
3236      }
3237      try {
3238        canvas.detachPen();
3239        console.info(msg + 'detachPen successed');
3240      } catch (err) {
3241        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
3242        expect().assertFail();
3243      }
3244    })
3245    /**
3246     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2510
3247     * @tc.name      : testCanvas_DrawLine_FourQuadrant
3248     * @tc.desc      : Used to draw a straight line segment
3249     * @tc.size      : MediumTest
3250     * @tc.type      : Function
3251     * @tc.level     : Level 3
3252     */
3253    it('testCanvas_DrawLine_FourQuadrant', 0, async function () {
3254      let msg = "testCanvas_DrawLine_FourQuadrant"
3255      console.info(msg + 'begin');
3256      let canvas = new drawing.Canvas(pixel)
3257      const pen = new drawing.Pen();
3258      try {
3259        pen.setStrokeWidth(5);
3260        console.info(msg + 'setStrokeWidth successed');
3261      } catch (err) {
3262        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
3263        expect().assertFail();
3264      }
3265      try {
3266        pen.setColor({
3267          alpha: 255, red: 255, green: 0, blue: 0
3268        });
3269        console.info(msg + 'setColor successed');
3270      } catch (err) {
3271        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3272        expect().assertFail();
3273      }
3274      try {
3275        canvas.attachPen(pen);
3276        console.info(msg + 'attachPen successed');
3277      } catch (err) {
3278        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
3279        expect().assertFail();
3280      }
3281      try {
3282        canvas.drawLine(0, 0, -20, 20);
3283        console.info(msg + 'drawLine successed');
3284      } catch (err) {
3285        console.info(msg + 'drawLine error cause: ' + JSON.stringify(err));
3286        expect().assertFail();
3287      }
3288      try {
3289        canvas.detachPen();
3290        console.info(msg + 'detachPen successed');
3291      } catch (err) {
3292        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
3293        expect().assertFail();
3294      }
3295    })
3296    /**
3297     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2520
3298     * @tc.name      : testCanvas_DrawLine_SameDot
3299     * @tc.desc      : Used to draw a straight line segment
3300     * @tc.size      : MediumTest
3301     * @tc.type      : Function
3302     * @tc.level     : Level 3
3303     */
3304    it('testCanvas_DrawLine_SameDot', 0, async function () {
3305      let msg = "testCanvas_DrawLine_SameDot"
3306      console.info(msg + 'begin');
3307      let canvas = new drawing.Canvas(pixel)
3308      const pen = new drawing.Pen();
3309      try {
3310        pen.setStrokeWidth(5);
3311        console.info(msg + 'setStrokeWidth successed');
3312      } catch (err) {
3313        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
3314        expect().assertFail();
3315      }
3316      try {
3317        pen.setColor({
3318          alpha: 255, red: 255, green: 0, blue: 0
3319        });
3320        console.info(msg + 'setColor successed');
3321      } catch (err) {
3322        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3323        expect().assertFail();
3324      }
3325      try {
3326        canvas.attachPen(pen);
3327        console.info(msg + 'attachPen successed');
3328      } catch (err) {
3329        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
3330        expect().assertFail();
3331      }
3332      try {
3333        canvas.drawLine(10, 10, 10, 10);
3334        console.info(msg + 'drawLine successed');
3335      } catch (err) {
3336        console.info(msg + 'drawLine error cause: ' + JSON.stringify(err));
3337        expect().assertFail();
3338      }
3339      try {
3340        canvas.detachPen();
3341        console.info(msg + 'detachPen successed');
3342      } catch (err) {
3343        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
3344        expect().assertFail();
3345      }
3346    })
3347    /**
3348     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0510
3349     * @tc.name      : testCanvas_DrawTextBlob_Normal
3350     * @tc.desc      : Used to draw a piece of text
3351     * @tc.size      : MediumTest
3352     * @tc.type      : Function
3353     * @tc.level     : Level 3
3354     */
3355    it('testCanvas_DrawTextBlob_Normal', 0, async function () {
3356      let msg = "testCanvas_DrawTextBlob_Normal"
3357      console.info(msg + 'begin');
3358      let canvas = new drawing.Canvas(pixel)
3359      const brush = new drawing.Brush();
3360      try {
3361        brush.setColor({
3362          alpha: 255, red: 255, green: 0, blue: 0
3363        });
3364        console.info(msg + 'setColor successed');
3365      } catch (err) {
3366        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3367        expect().assertFail();
3368      }
3369      const font = new drawing.Font();
3370      try {
3371        font.setSize(20);
3372        console.info(msg + 'setSize successed');
3373      } catch (err) {
3374        console.info(msg + 'setSize error cause: ' + JSON.stringify(err));
3375        expect().assertFail();
3376      }
3377      let textBlob;
3378      try {
3379        textBlob = drawing.TextBlob.makeFromString("drawing", font, drawing.TextEncoding.TEXT_ENCODING_UTF8);
3380        console.info(msg + 'TextBlob.makeFromString successed');
3381      } catch (err) {
3382        console.info(msg + 'TextBlob.makeFromString error cause: ' + JSON.stringify(err));
3383        expect().assertFail();
3384      }
3385      try {
3386        canvas.attachBrush(brush);
3387        console.info(msg + 'attachBrush successed');
3388      } catch (err) {
3389        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
3390        expect().assertFail();
3391      }
3392      try {
3393        canvas.drawTextBlob(textBlob, 20, 20);
3394        console.info(msg + 'drawTextBlob successed');
3395      } catch (err) {
3396        console.info(msg + 'drawTextBlob error cause: ' + JSON.stringify(err));
3397        expect().assertFail();
3398      }
3399      try {
3400        canvas.detachBrush();
3401        console.info(msg + 'detachBrush successed');
3402      } catch (err) {
3403        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
3404        expect().assertFail();
3405      }
3406    })
3407    /**
3408     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2590
3409     * @tc.name      : testCanvas_DrawTextBlob_Minus
3410     * @tc.desc      : Used to draw a piece of text
3411     * @tc.size      : MediumTest
3412     * @tc.type      : Function
3413     * @tc.level     : Level 3
3414     */
3415    it('testCanvas_DrawTextBlob_Minus', 0, async function () {
3416      let msg = "testCanvas_DrawTextBlob_Minus"
3417      console.info(msg + 'begin');
3418      let canvas = new drawing.Canvas(pixel)
3419      const brush = new drawing.Brush();
3420      try {
3421        brush.setColor({
3422          alpha: 255, red: 255, green: 0, blue: 0
3423        });
3424        console.info(msg + 'setColor successed');
3425      } catch (err) {
3426        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3427        expect().assertFail();
3428      }
3429      const font = new drawing.Font();
3430      try {
3431        font.setSize(20);
3432        console.info(msg + 'setSize successed');
3433      } catch (err) {
3434        console.info(msg + 'setSize error cause: ' + JSON.stringify(err));
3435        expect().assertFail();
3436      }
3437      let textBlob;
3438      try {
3439        textBlob = drawing.TextBlob.makeFromString("drawing", font, drawing.TextEncoding.TEXT_ENCODING_UTF8);
3440        console.info(msg + 'TextBlob.makeFromString successed');
3441      } catch (err) {
3442        console.info(msg + 'TextBlob.makeFromString error cause: ' + JSON.stringify(err));
3443        expect().assertFail();
3444      }
3445      try {
3446        canvas.attachBrush(brush);
3447        console.info(msg + 'attachBrush successed');
3448      } catch (err) {
3449        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
3450        expect().assertFail();
3451      }
3452      try {
3453        canvas.drawTextBlob(textBlob, -20, -1);
3454        console.info(msg + 'drawTextBlob successed');
3455      } catch (err) {
3456        console.info(msg + 'drawTextBlob error cause: ' + JSON.stringify(err));
3457        expect().assertFail();
3458      }
3459      try {
3460        canvas.detachBrush();
3461        console.info(msg + 'detachBrush successed');
3462      } catch (err) {
3463        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
3464        expect().assertFail();
3465      }
3466    })
3467    /**
3468     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_2600
3469     * @tc.name      : testCanvas_DrawTextBlob_NonInteger
3470     * @tc.desc      : Used to draw a piece of text
3471     * @tc.size      : MediumTest
3472     * @tc.type      : Function
3473     * @tc.level     : Level 3
3474     */
3475    it('testCanvas_DrawTextBlob_NonInteger', 0, async function () {
3476      let msg = "testCanvas_DrawTextBlob_NonInteger"
3477      console.info(msg + 'begin');
3478      let canvas = new drawing.Canvas(pixel)
3479      const brush = new drawing.Brush();
3480      try {
3481        brush.setColor({
3482          alpha: 255, red: 255, green: 0, blue: 0
3483        });
3484        console.info(msg + 'setColor successed');
3485      } catch (err) {
3486        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3487        expect().assertFail();
3488      }
3489      const font = new drawing.Font();
3490      try {
3491        font.setSize(20);
3492        console.info(msg + 'setSize successed');
3493      } catch (err) {
3494        console.info(msg + 'setSize error cause: ' + JSON.stringify(err));
3495        expect().assertFail();
3496      }
3497      let textBlob;
3498      try {
3499        textBlob = drawing.TextBlob.makeFromString("drawing", font, drawing.TextEncoding.TEXT_ENCODING_UTF8);
3500        console.info(msg + 'TextBlob.makeFromString successed');
3501      } catch (err) {
3502        console.info(msg + 'TextBlob.makeFromString error cause: ' + JSON.stringify(err));
3503        expect().assertFail();
3504      }
3505      try {
3506        canvas.attachBrush(brush);
3507        console.info(msg + 'attachBrush successed');
3508      } catch (err) {
3509        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
3510        expect().assertFail();
3511      }
3512      try {
3513        canvas.drawTextBlob(textBlob, 50.26754, 10.259);
3514        console.info(msg + 'drawTextBlob successed');
3515      } catch (err) {
3516        console.info(msg + 'drawTextBlob error cause: ' + JSON.stringify(err));
3517        expect().assertFail();
3518      }
3519      try {
3520        canvas.detachBrush();
3521        console.info(msg + 'detachBrush successed');
3522      } catch (err) {
3523        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
3524        expect().assertFail();
3525      }
3526    })
3527    /**
3528     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0520
3529     * @tc.name      : testCanvas_AttachPenAndDetachPen
3530     * @tc.desc      : Bind the brush to the canvas
3531     * @tc.size      : MediumTest
3532     * @tc.type      : Function
3533     * @tc.level     : Level 3
3534     */
3535    it('testCanvas_AttachPenAndDetachPen', 0, async function () {
3536      let msg = "testCanvas_AttachPenAndDetachPen"
3537      console.info(msg + 'begin');
3538      let canvas = new drawing.Canvas(pixel)
3539      const pen = new drawing.Pen();
3540      try {
3541        pen.setStrokeWidth(5);
3542        console.info(msg + 'setStrokeWidth successed');
3543      } catch (err) {
3544        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
3545        expect().assertFail();
3546      }
3547      try {
3548        pen.setColor({
3549          alpha: 255, red: 255, green: 0, blue: 0
3550        });
3551        console.info(msg + 'setColor successed');
3552      } catch (err) {
3553        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3554        expect().assertFail();
3555      }
3556      try {
3557        canvas.attachPen(pen);
3558        console.info(msg + 'attachPen successed');
3559      } catch (err) {
3560        console.info(msg + 'attachPen error cause: ' + JSON.stringify(err));
3561        expect().assertFail();
3562      }
3563      try {
3564        canvas.drawRect({
3565          left: 0, right: 0, top: 10, bottom: 10
3566        });
3567        console.info(msg + 'drawRect successed');
3568      } catch (err) {
3569        console.info(msg + 'drawRect error cause: ' + JSON.stringify(err));
3570        expect().assertFail();
3571      }
3572      try {
3573        canvas.detachPen();
3574        console.info(msg + 'detachPen successed');
3575      } catch (err) {
3576        console.info(msg + 'detachPen error cause: ' + JSON.stringify(err));
3577        expect().assertFail();
3578      }
3579    })
3580    /**
3581     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0530
3582     * @tc.name      : testCanvas_AttachBrushAndDetachBrush
3583     * @tc.desc      : Bind the brush to the canvas
3584     * @tc.size      : MediumTest
3585     * @tc.type      : Function
3586     * @tc.level     : Level 3
3587     */
3588    it('testCanvas_AttachBrushAndDetachBrush', 0, async function () {
3589      let msg = "testCanvas_AttachBrushAndDetachBrush"
3590      console.info(msg + 'begin');
3591      let canvas = new drawing.Canvas(pixel)
3592      const brush = new drawing.Brush();
3593      try {
3594        brush.setColor({
3595          alpha: 255, red: 255, green: 0, blue: 0
3596        });
3597        console.info(msg + 'setColor successed');
3598      } catch (err) {
3599        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3600        expect().assertFail();
3601      }
3602      try {
3603        canvas.attachBrush(brush);
3604        console.info(msg + 'attachBrush successed');
3605      } catch (err) {
3606        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
3607        expect().assertFail();
3608      }
3609      try {
3610        canvas.drawRect({
3611          left: 0, right: 0, top: 10, bottom: 10
3612        });
3613        console.info(msg + 'drawRect successed');
3614      } catch (err) {
3615        console.info(msg + 'drawRect error cause: ' + JSON.stringify(err));
3616        expect().assertFail();
3617      }
3618      try {
3619        canvas.detachBrush();
3620        console.info(msg + 'detachBrush successed');
3621      } catch (err) {
3622        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
3623        expect().assertFail();
3624      }
3625    })
3626    /**
3627     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_0540
3628     * @tc.name      : testCanvas_AttachPenAndDetachPen_MoreTime
3629     * @tc.desc      : Bind the brush to the canvas more times
3630     * @tc.size      : MediumTest
3631     * @tc.type      : Function
3632     * @tc.level     : Level 3
3633     */
3634    it('testCanvas_AttachPenAndDetachPen_MoreTime', 0, async function () {
3635      let msg = "testCanvas_AttachPenAndDetachPen_MoreTime"
3636      console.info(msg + 'begin');
3637      let canvas = new drawing.Canvas(pixel)
3638      const pen = new drawing.Pen();
3639      try {
3640        pen.setStrokeWidth(5);
3641        console.info(msg + 'setStrokeWidth successed');
3642      } catch (err) {
3643        console.info(msg + 'setStrokeWidth error cause: ' + JSON.stringify(err));
3644        expect().assertFail();
3645      }
3646      try {
3647        pen.setColor({
3648          alpha: 255, red: 255, green: 0, blue: 0
3649        });
3650        console.info(msg + 'setColor successed');
3651      } catch (err) {
3652        console.info(msg + 'setColor error cause: ' + JSON.stringify(err));
3653        expect().assertFail();
3654      }
3655      try {
3656        canvas.attachPen(pen);
3657        console.info(msg + 'attachPen successed first');
3658      } catch (err) {
3659        console.info(msg + 'first attachPen error cause: ' + JSON.stringify(err));
3660        expect().assertFail();
3661      }
3662      try {
3663        canvas.attachPen(pen);
3664        console.info(msg + 'attachPen successed second');
3665      } catch (err) {
3666        console.info(msg + 'second attachPen error cause: ' + JSON.stringify(err));
3667        expect().assertFail();
3668      }
3669      try {
3670        canvas.drawRect({
3671          left: 0, right: 0, top: 10, bottom: 10
3672        });
3673        console.info(msg + 'drawRect successed');
3674      } catch (err) {
3675        console.info(msg + 'drawRect error cause: ' + JSON.stringify(err));
3676        expect().assertFail();
3677      }
3678      try {
3679        canvas.detachPen();
3680        console.info(msg + 'detachPen successed first');
3681      } catch (err) {
3682        console.info(msg + 'first detachPen error cause: ' + JSON.stringify(err));
3683        expect().assertFail();
3684      }
3685      try {
3686        canvas.detachPen();
3687        console.info(msg + 'detachPen successed second');
3688      } catch (err) {
3689        console.info(msg + 'second detachPen error cause: ' + JSON.stringify(err));
3690        expect().assertFail();
3691      }
3692    })
3693    /**
3694     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_3070
3695     * @tc.name      : testCanvas_DrawPixelMapMesh
3696     * @tc.desc      : The pixel map is drawn on the grid, and the grid is evenly distributed on the pixel map
3697     * @tc.size      : MediumTest
3698     * @tc.type      : Function
3699     * @tc.level     : Level 3
3700     */
3701    it('testCanvas_DrawPixelMapMesh', 0, async function () {
3702      let msg = "testCanvas_DrawPixelMapMesh"
3703      console.info(msg + 'begin');
3704      let canvas = new drawing.Canvas(pixel)
3705      const brush = new drawing.Brush();
3706      try {
3707        canvas.attachBrush(brush);
3708      } catch (err) {
3709        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
3710        expect().assertFail();
3711      }
3712      let verts : Array<number> = [0, 0, 50, 0, 410, 0, 0, 180, 50, 180, 410, 180, 0, 360, 50, 360, 410, 360];
3713      try {
3714        canvas.drawPixelMapMesh(pixel, 2, 2, verts, 0, null, 0);
3715      } catch (err) {
3716        console.info(msg + 'drawPixelMapMesh error cause: ' + JSON.stringify(err));
3717        expect().assertFail();
3718      }
3719      try {
3720        canvas.detachBrush();
3721      } catch (err) {
3722        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
3723        expect().assertFail();
3724      }
3725    })
3726    /**
3727     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_3080
3728     * @tc.name      : testCanvas_DrawPixelMapMesh_MeshWidth_Invalid
3729     * @tc.desc      : The pixel map is drawn on the grid, and the grid is evenly distributed on the pixel map
3730     * @tc.size      : MediumTest
3731     * @tc.type      : Function
3732     * @tc.level     : Level 3
3733     */
3734    it('testCanvas_DrawPixelMapMesh_MeshWidth_Invalid', 0, async function () {
3735      let msg = "testCanvas_DrawPixelMapMesh_MeshWidth_Invalid"
3736      console.info(msg + 'begin');
3737      let canvas = new drawing.Canvas(pixel)
3738      const brush = new drawing.Brush();
3739      try {
3740        canvas.attachBrush(brush);
3741      } catch (err) {
3742        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
3743        expect().assertFail();
3744      }
3745      let verts : Array<number> = [0, 0, 50, 0, 410, 0, 0, 180, 50, 180, 410, 180, 0, 360, 50, 360, 410, 360];
3746      try {
3747        canvas.drawPixelMapMesh(pixel, -2, 2, verts, 0, null, 0);
3748        expect().assertFail();
3749      } catch (err) {
3750        console.info(msg + 'drawPixelMapMesh error cause: ' + JSON.stringify(err));
3751        expect(err.code).assertEqual(401);
3752      }
3753      try {
3754      canvas.detachBrush();
3755      } catch (err) {
3756        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
3757        expect().assertFail();
3758      }
3759    })
3760    /**
3761     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_3090
3762     * @tc.name      : testCanvas_DrawPixelMapMesh_MeshHeight_Invalid
3763     * @tc.desc      : The pixel map is drawn on the grid, and the grid is evenly distributed on the pixel map
3764     * @tc.size      : MediumTest
3765     * @tc.type      : Function
3766     * @tc.level     : Level 3
3767     */
3768    it('testCanvas_DrawPixelMapMesh_MeshHeight_Invalid', 0, async function () {
3769      let msg = "testCanvas_DrawPixelMapMesh_MeshHeight_Invalid"
3770      console.info(msg + 'begin');
3771      let canvas = new drawing.Canvas(pixel)
3772      const brush = new drawing.Brush();
3773      try {
3774        canvas.attachBrush(brush);
3775      } catch (err) {
3776        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
3777        expect().assertFail();
3778      }
3779      let verts : Array<number> = [0, 0, 50, 0, 410, 0, 0, 180, 50, 180, 410, 180, 0, 360, 50, 360, 410, 360];
3780      try {
3781        canvas.drawPixelMapMesh(pixel, 2, -2, verts, 0, null, 0);
3782        expect().assertFail();
3783      } catch (err) {
3784        console.info(msg + 'drawPixelMapMesh error cause: ' + JSON.stringify(err));
3785        expect(err.code).assertEqual(401);
3786      }
3787      try {
3788        canvas.detachBrush();
3789      } catch (err) {
3790        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
3791        expect().assertFail();
3792      }
3793    })
3794    /**
3795     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_3100
3796     * @tc.name      : testCanvas_DrawPixelMapMesh_VertOffset_Invalid
3797     * @tc.desc      : The pixel map is drawn on the grid, and the grid is evenly distributed on the pixel map
3798     * @tc.size      : MediumTest
3799     * @tc.type      : Function
3800     * @tc.level     : Level 3
3801     */
3802    it('testCanvas_DrawPixelMapMesh_VertOffset_Invalid', 0, async function () {
3803      let msg = "testCanvas_DrawPixelMapMesh_VertOffset_Invalid"
3804      console.info(msg + 'begin');
3805      let canvas = new drawing.Canvas(pixel)
3806      const brush = new drawing.Brush();
3807      try {
3808        canvas.attachBrush(brush);
3809      } catch (err) {
3810        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
3811        expect().assertFail();
3812      }
3813      let verts : Array<number> = [0, 0, 50, 0, 410, 0, 0, 180, 50, 180, 410, 180, 0, 360, 50, 360, 410, 360];
3814      try {
3815        canvas.drawPixelMapMesh(pixel, 2, 2, verts, -10, null, 0);
3816        expect().assertFail();
3817      } catch (err) {
3818        console.info(msg + 'drawPixelMapMesh error cause: ' + JSON.stringify(err));
3819        expect(err.code).assertEqual(401);
3820      }
3821      try {
3822        canvas.detachBrush();
3823      } catch (err) {
3824        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
3825        expect().assertFail();
3826      }
3827    })
3828    /**
3829     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_3110
3830     * @tc.name      : testCanvas_DrawPixelMapMesh_ColorOffset_Invalid
3831     * @tc.desc      : The pixel map is drawn on the grid, and the grid is evenly distributed on the pixel map
3832     * @tc.size      : MediumTest
3833     * @tc.type      : Function
3834     * @tc.level     : Level 3
3835     */
3836    it('testCanvas_DrawPixelMapMesh_ColorOffset_Invalid', 0, async function () {
3837      let msg = "testCanvas_DrawPixelMapMesh_ColorOffset_Invalid"
3838      console.info(msg + 'begin');
3839      let canvas = new drawing.Canvas(pixel)
3840      const brush = new drawing.Brush();
3841      try {
3842        canvas.attachBrush(brush);
3843      } catch (err) {
3844        console.info(msg + 'attachBrush error cause: ' + JSON.stringify(err));
3845        expect().assertFail();
3846      }
3847      let verts : Array<number> = [0, 0, 50, 0, 410, 0, 0, 180, 50, 180, 410, 180, 0, 360, 50, 360, 410, 360];
3848      try {
3849        canvas.drawPixelMapMesh(pixel, 2, 2, verts, 1, null, -6);
3850        expect().assertFail();
3851      } catch (err) {
3852        console.info(msg + 'drawPixelMapMesh error cause: ' + JSON.stringify(err));
3853        expect(err.code).assertEqual(401);
3854      }
3855      try {
3856        canvas.detachBrush();
3857      } catch (err) {
3858        console.info(msg + 'detachBrush error cause: ' + JSON.stringify(err));
3859        expect().assertFail();
3860      }
3861    })
3862    /**
3863     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_3120
3864     * @tc.name      : testFilterMode_Enum
3865     * @tc.desc      : Filter mode enumeration
3866     * @tc.size      : MediumTest
3867     * @tc.type      : Function
3868     * @tc.level     : Level 3
3869     */
3870    it('testFilterMode_Enum', 0, async function () {
3871      let msg = "testFilterMode_Enum"
3872      console.info(msg + 'begin');
3873      try {
3874        expect(0).assertEqual(drawing.FilterMode.FILTER_MODE_NEAREST);
3875        expect(1).assertEqual(drawing.FilterMode.FILTER_MODE_LINEAR);
3876      } catch (err) {
3877        console.info(msg + 'test enum value of FilterMode error ' + JSON.stringify(err));
3878        expect().assertFail();
3879      }
3880    })
3881    /**
3882     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_3130
3883     * @tc.name      : testClipOp_Enum
3884     * @tc.desc      : Enumeration of canvas cropping methods
3885     * @tc.size      : MediumTest
3886     * @tc.type      : Function
3887     * @tc.level     : Level 3
3888     */
3889    it('testClipOp_Enum', 0, async function () {
3890      let msg = "testClipOp_Enum"
3891      console.info(msg + 'begin');
3892      try {
3893        expect(0).assertEqual(drawing.ClipOp.DIFFERENCE);
3894        expect(1).assertEqual(drawing.ClipOp.INTERSECT);
3895      } catch (err) {
3896        console.info(msg + 'test enum value of ClipOp error ' + JSON.stringify(err));
3897        expect().assertFail();
3898      }
3899    })
3900    /**
3901     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_3140
3902     * @tc.name      : testJoinStyle_Enum
3903     * @tc.desc      : Defines an enumeration of line corner styles
3904     * @tc.size      : MediumTest
3905     * @tc.type      : Function
3906     * @tc.level     : Level 3
3907     */
3908    it('testJoinStyle_Enum', 0, async function () {
3909      let msg = "testJoinStyle_Enum"
3910      console.info(msg + 'begin');
3911      try {
3912        expect(0).assertEqual(drawing.JoinStyle.MITER_JOIN);
3913        expect(1).assertEqual(drawing.JoinStyle.ROUND_JOIN);
3914        expect(2).assertEqual(drawing.JoinStyle.BEVEL_JOIN);
3915      } catch (err) {
3916        console.info(msg + 'test enum value of JoinStyle error ' + JSON.stringify(err));
3917        expect().assertFail();
3918      }
3919    })
3920    /**
3921     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_3150
3922     * @tc.name      : testCapStyle_Enum
3923     * @tc.desc      : Defines an enumeration of line hat styles
3924     * @tc.size      : MediumTest
3925     * @tc.type      : Function
3926     * @tc.level     : Level 3
3927     */
3928    it('testCapStyle_Enum', 0, async function () {
3929      let msg = "testCapStyle_Enum"
3930      console.info(msg + 'begin');
3931      try {
3932        expect(0).assertEqual(drawing.CapStyle.FLAT_CAP);
3933        expect(1).assertEqual(drawing.CapStyle.SQUARE_CAP);
3934        expect(2).assertEqual(drawing.CapStyle.ROUND_CAP);
3935      } catch (err) {
3936        console.info(msg + 'test enum value of CapStyle error ' + JSON.stringify(err));
3937        expect().assertFail();
3938      }
3939    })
3940    /**
3941     * @tc.number    : SUB_BASIC_WMS_SPCIAL_XTS_GRAPHICDRAWING_JS_API_3160
3942     * @tc.name      : testBlurType_Enum
3943     * @tc.desc      : Defines an enumeration of line hat styles
3944     * @tc.size      : MediumTest
3945     * @tc.type      : Function
3946     * @tc.level     : Level 3
3947     */
3948    it('testBlurType_Enum', 0, async function () {
3949      let msg = "testBlurType_Enum"
3950      console.info(msg + 'begin');
3951      try {
3952        expect(0).assertEqual(drawing.BlurType.NORMAL);
3953        expect(1).assertEqual(drawing.BlurType.SOLID);
3954        expect(2).assertEqual(drawing.BlurType.OUTER);
3955        expect(3).assertEqual(drawing.BlurType.INNER);
3956      } catch (err) {
3957        console.info(msg + 'test enum value of BlurType error ' + JSON.stringify(err));
3958        expect().assertFail();
3959      }
3960    })
3961  })
3962}
3963
3964