Skip to content

Commit

Permalink
Fix test fail issue
Browse files Browse the repository at this point in the history
  • Loading branch information
imaNNeo committed Dec 15, 2023
1 parent 68cf161 commit 08107bf
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions test/chart/pie_chart/pie_chart_painter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ void main() {
test('test 1', () {
const viewSize = Size(200, 200);

const radius = 30.0;
const centerSpace = 10.0;
final sections = [
PieChartSectionData(
color: MockData.color2,
radius: 30,
radius: radius,
value: 10,
borderSide: const BorderSide(
color: MockData.color3,
Expand All @@ -141,17 +143,31 @@ void main() {
when(mockCanvasWrapper.canvas).thenReturn(MockCanvas());
barChartPainter.drawSections(mockCanvasWrapper, [360], 10, holder);

final result = verify(
final rect = Rect.fromCircle(
center: viewSize.center(Offset.zero),
radius: radius + centerSpace,
);
final results = verifyInOrder([
mockCanvasWrapper.saveLayer(
rect,
any,
),
mockCanvasWrapper.drawCircle(
const Offset(100, 100),
10 + 15,
10 + 30,
captureAny,
),
);
mockCanvasWrapper.drawCircle(
const Offset(100, 100),
10,
captureAny,
),
mockCanvasWrapper.restore(),
]);
final result = results[1];
expect(result.callCount, 1);
expect((result.captured.single as Paint).color, MockData.color2);
expect((result.captured.single as Paint).strokeWidth, 30);
expect((result.captured.single as Paint).style, PaintingStyle.stroke);
expect((result.captured.single as Paint).style, PaintingStyle.fill);

final result2 = verify(
mockCanvasWrapper.drawCircle(
Expand Down

0 comments on commit 08107bf

Please sign in to comment.