1
1
import React from "react" ;
2
2
3
3
import { checkImage , docPath } from "../../../__tests__/setup" ;
4
- import { RoundedRect } from "../../components" ;
4
+ import { Path , RoundedRect } from "../../components" ;
5
5
import { importSkia , surface } from "../setup" ;
6
6
7
7
describe ( "Rects and rounded rects" , ( ) => {
@@ -70,7 +70,17 @@ describe("Rects and rounded rects", () => {
70
70
) ;
71
71
checkImage ( image , docPath ( "rrect/uniform.png" ) ) ;
72
72
} ) ;
73
- it ( "Should draw a rounded rect with non-uniform values" , async ( ) => {
73
+ it ( "Should draw a rounded rect with uniform values (4)" , async ( ) => {
74
+ const { width } = surface ;
75
+ const r = width * 0.2 ;
76
+ const { Skia } = importSkia ( ) ;
77
+ const rrct = Skia . RRectXY ( Skia . XYWHRect ( 0 , 0 , width , width ) , r , r ) ;
78
+ const path = Skia . Path . Make ( ) ;
79
+ path . addRRect ( rrct ) ;
80
+ const image = await surface . draw ( < Path path = { path } color = "lightblue" /> ) ;
81
+ checkImage ( image , docPath ( "rrect/uniform.png" ) ) ;
82
+ } ) ;
83
+ it ( "Should draw a rounded rect with non-uniform values (1)" , async ( ) => {
74
84
const { width } = surface ;
75
85
const r = width * 0.2 ;
76
86
const rrct = {
@@ -85,4 +95,20 @@ describe("Rects and rounded rects", () => {
85
95
) ;
86
96
checkImage ( image , docPath ( "rrect/nonuniform.png" ) ) ;
87
97
} ) ;
98
+ it ( "Should draw a rounded rect with non-uniform values (2)" , async ( ) => {
99
+ const { Skia } = importSkia ( ) ;
100
+ const { width } = surface ;
101
+ const r = width * 0.2 ;
102
+ const rrct = {
103
+ rect : { x : 0 , y : 0 , width, height : width } ,
104
+ topLeft : { x : 0 , y : 0 } ,
105
+ topRight : { x : r , y : r } ,
106
+ bottomRight : { x : 0 , y : 0 } ,
107
+ bottomLeft : { x : r , y : r } ,
108
+ } ;
109
+ const path = Skia . Path . Make ( ) ;
110
+ path . addRRect ( rrct ) ;
111
+ const image = await surface . draw ( < Path path = { path } color = "lightblue" /> ) ;
112
+ checkImage ( image , docPath ( "rrect/nonuniform.png" ) ) ;
113
+ } ) ;
88
114
} ) ;
0 commit comments