From 272d4688613149fdc325a781d4d076fcdeeed9f3 Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Fri, 9 Oct 2026 16:14:15 +0300 Subject: [PATCH 1/2] test(charts): measure the pie, the bar tooltip and the X label rotation (#1160, #1161) - #1160: the pie grows with the pane and its slice radius follows the outer radius formula at 600 and 1600 px. - #1161: the bar tooltip shows the full number and the theme popover colour; 40 X labels reserve the rotated room, 3 labels do not. --- .../results/charts/quick_chart_view_test.dart | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/test/features/results/charts/quick_chart_view_test.dart b/test/features/results/charts/quick_chart_view_test.dart index e9fcf344..2b2ac227 100644 --- a/test/features/results/charts/quick_chart_view_test.dart +++ b/test/features/results/charts/quick_chart_view_test.dart @@ -158,4 +158,86 @@ void main() { expect(t.takeException(), isNull); }); } + + testWidgets('the pie grows with the pane and keeps its radius ratio (#1160)', + (t) async { + final widths = []; + for (final width in [600.0, 1600.0]) { + await t.binding.setSurfaceSize(material.Size(width, 700)); + await t.pumpWidget(queryaThemeTestShell( + child: QuickChartView(columns: columns, rows: rows))); + await t.pump(); + await t.tap(find.bySemanticsLabel('Pie')); + await t.pump(); + + final size = t.getSize(find.byType(PieChart)); + final radius = + t.widget(find.byType(PieChart)).data.sections.first.radius; + // Outer radius is 88% of the half side, the hole 45% of it: the slice + // band is 55% of the outer radius. + expect(radius, closeTo(size.width / 2 * 0.88 * 0.55, 0.01)); + widths.add(size.width); + } + expect(widths[1], greaterThan(widths[0])); + }); + + testWidgets('bar tooltips show the full number on the theme popover (#1161)', + (t) async { + await pumpView(t, columns, [ + ['a', '1234567'], + ['b', '20'], + ]); + await t.tap(find.bySemanticsLabel('Bar')); + await t.pump(); + + final tooltip = t + .widget(find.byType(BarChart)) + .data + .barTouchData + .touchTooltipData; + final group = BarChartGroupData(x: 0, barRods: [ + BarChartRodData(toY: 1234567), + ]); + expect( + tooltip.getTooltipItem(group, 0, group.barRods.first, 0).text, + contains('1,234,567'), + ); + final popover = Theme.of(t.element(find.byType(BarChart))).colorScheme.popover; + expect(tooltip.getTooltipColor(group), popover); + }); + + testWidgets('many X labels rotate and reserve room, few do not (#1161)', + (t) async { + await t.binding.setSurfaceSize(const Size(400, 700)); + await t.pumpWidget(queryaThemeTestShell( + child: QuickChartView( + columns: const ['label', 'value'], + rows: [ + for (var i = 1; i <= 40; i++) ['a long category label number $i', '$i'], + ], + ))); + await t.pump(); + await t.tap(find.bySemanticsLabel('Bar')); + await t.pump(); + final many = t + .widget(find.byType(BarChart)) + .data + .titlesData + .bottomTitles + .sideTitles + .reservedSize; + expect(many, 52); + + await pumpView(t, columns, rows); + await t.tap(find.bySemanticsLabel('Bar')); + await t.pump(); + final few = t + .widget(find.byType(BarChart)) + .data + .titlesData + .bottomTitles + .sideTitles + .reservedSize; + expect(few, 28); + }); } From 8057ace6b71f79d0f6214a128756eacfed8c523a Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Fri, 9 Oct 2026 16:17:47 +0300 Subject: [PATCH 2/2] test(charts): read the nullable tooltip item in the bar tooltip test (#1161) --- test/features/results/charts/quick_chart_view_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/features/results/charts/quick_chart_view_test.dart b/test/features/results/charts/quick_chart_view_test.dart index 2b2ac227..84056b8e 100644 --- a/test/features/results/charts/quick_chart_view_test.dart +++ b/test/features/results/charts/quick_chart_view_test.dart @@ -199,7 +199,7 @@ void main() { BarChartRodData(toY: 1234567), ]); expect( - tooltip.getTooltipItem(group, 0, group.barRods.first, 0).text, + tooltip.getTooltipItem(group, 0, group.barRods.first, 0)?.text, contains('1,234,567'), ); final popover = Theme.of(t.element(find.byType(BarChart))).colorScheme.popover;