@@ -369,6 +369,69 @@ void main() {
369369 );
370370 expect (results[3 ]['paint_style' ] as PaintingStyle , PaintingStyle .fill);
371371 });
372+
373+ test ('test 3 - sectionOffset translates section along center angle' , () {
374+ const viewSize = Size (200 , 200 );
375+ const centerRadius = 10.0 ;
376+ const offset = 20.0 ;
377+
378+ final section0 = PieChartSectionData (
379+ color: MockData .color1,
380+ value: 1 ,
381+ sectionOffset: offset,
382+ );
383+ final section1 = PieChartSectionData (
384+ color: MockData .color2,
385+ value: 1 ,
386+ );
387+ final data = PieChartData (
388+ sectionsSpace: 0 ,
389+ sections: [section0, section1],
390+ );
391+
392+ final pieChartPainter = PieChartPainter ();
393+ final holder =
394+ PaintHolder <PieChartData >(data, data, TextScaler .noScaling);
395+
396+ final mockCanvasWrapper = MockCanvasWrapper ();
397+ when (mockCanvasWrapper.size).thenAnswer ((_) => viewSize);
398+ when (mockCanvasWrapper.canvas).thenReturn (MockCanvas ());
399+ final drawnPaths = < Path > [];
400+ when (mockCanvasWrapper.drawPath (captureAny, captureAny)).thenAnswer (
401+ (inv) => drawnPaths.add (inv.positionalArguments[0 ] as Path ),
402+ );
403+
404+ pieChartPainter.drawSections (
405+ mockCanvasWrapper,
406+ [180 , 180 ],
407+ centerRadius,
408+ holder,
409+ );
410+
411+ expect (drawnPaths.length, 2 );
412+
413+ const section0Center = Offset (100 , 120 );
414+ final expectedPath0 = pieChartPainter.generateSectionPath (
415+ section0,
416+ 0 ,
417+ 0 ,
418+ 180 ,
419+ section0Center,
420+ centerRadius,
421+ );
422+ expect (HelperMethods .equalsPaths (drawnPaths[0 ], expectedPath0), true );
423+
424+ const section1Center = Offset (100 , 100 );
425+ final expectedPath1 = pieChartPainter.generateSectionPath (
426+ section1,
427+ 0 ,
428+ 180 ,
429+ 180 ,
430+ section1Center,
431+ centerRadius,
432+ );
433+ expect (HelperMethods .equalsPaths (drawnPaths[1 ], expectedPath1), true );
434+ });
372435 });
373436
374437 group ('generateSectionPath()' , () {
0 commit comments