@@ -7,7 +7,7 @@ import 'package:flutter_test/flutter_test.dart';
77// Tests the scanner for correctly parses the input.
88main () {
99 final testingArea =
10- Rect .fromCenter (center: Offset .zero, width: 10 , height: 10 );
10+ Rect .fromCenter (center: Offset .zero, width: 15 , height: 15 );
1111 group ('Testing paths from commands' , () {
1212 group ('test moveTo commands' , () {
1313 test ('test consecutive arguments act as lineTo commands.' , () {
@@ -216,4 +216,77 @@ main() {
216216 });
217217 });
218218 });
219+
220+ group ('Testing combination of relative and absolute commands' , () {
221+ final testingArea =
222+ Rect .fromCenter (center: Offset .zero, width: 20 , height: 20 );
223+
224+ group ('Test Flag pattern on cubic curves' , () {
225+ final testingArea =
226+ Rect .fromCenter (center: Offset .zero, width: 20 , height: 20 );
227+ group ('test ellipticalArcTo commands' , () {
228+ test ('test ellipticalArtTo absolute' , () {
229+ var expectedPath = Path ()
230+ ..moveTo (0 , 4 )
231+ ..arcToPoint (Offset (7 , 1 ),
232+ radius: Radius .elliptical (5 , 8 ),
233+ rotation: 0.12 ,
234+ largeArc: true ,
235+ clockwise: true );
236+ expect (
237+ parseSvgPath ('M0,4A5,8,.12 11 7 1' ),
238+ coversSameAreaAs (expectedPath,
239+ areaToCompare: testingArea, sampleSize: 400 ));
240+ });
241+
242+ test ('test ellipticalArtTo relative' , () {
243+ var expectedPath = Path ()
244+ ..moveTo (0 , 0 )
245+ ..arcToPoint (Offset (5 , 5 ),
246+ radius: Radius .elliptical (11 , 7 ),
247+ largeArc: true ,
248+ clockwise: true )
249+ ..close ();
250+ // Note: Make a check for out of range parameters:
251+ // https://www.w3.org/TR/SVG11/implnote.html#ArcOutOfRangeParameters
252+ expect (
253+ parseSvgPath ('a11,7, 0 115,5z' ),
254+ coversSameAreaAs (expectedPath,
255+ areaToCompare: testingArea, sampleSize: 400 ));
256+ });
257+ });
258+ });
259+ });
260+
261+ group ('Test square path on different combinations' , () {
262+ test ('Testing flags without any spaces' , () {
263+ var expectedPath = Path ()
264+ ..moveTo (0 , 0 )
265+ ..lineTo (0 , 5 )
266+ ..lineTo (5 , 5 )
267+ ..lineTo (5 , 0 )
268+ ..close ();
269+
270+ expect (
271+ parseSvgPath ('M 0 0 V5 H5 V0z' ),
272+ coversSameAreaAs (expectedPath,
273+ areaToCompare: testingArea, sampleSize: 400 ));
274+ expect (
275+ parseSvgPath ('M0 0 v5 h5 V0z' ),
276+ coversSameAreaAs (expectedPath,
277+ areaToCompare: testingArea, sampleSize: 400 ));
278+ expect (
279+ parseSvgPath ('M0 0 V5 h5 v-5z' ),
280+ coversSameAreaAs (expectedPath,
281+ areaToCompare: testingArea, sampleSize: 400 ));
282+ expect (
283+ parseSvgPath ('M0 0 h5 V5 H0 z' ),
284+ coversSameAreaAs (expectedPath,
285+ areaToCompare: testingArea, sampleSize: 400 ));
286+ expect (
287+ parseSvgPath ('M0 0 v5 H5 v-5z' ),
288+ coversSameAreaAs (expectedPath,
289+ areaToCompare: testingArea, sampleSize: 400 ));
290+ });
291+ });
219292}
0 commit comments