diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 86b39f8cb..b94d353eb 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -26,4 +26,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 -COCOAPODS: 1.12.0 +COCOAPODS: 1.12.1 diff --git a/example/macos/Runner.xcodeproj/project.pbxproj b/example/macos/Runner.xcodeproj/project.pbxproj index a7b55159d..9b6f9c6b6 100644 --- a/example/macos/Runner.xcodeproj/project.pbxproj +++ b/example/macos/Runner.xcodeproj/project.pbxproj @@ -203,7 +203,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { diff --git a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 92bca288c..6ff55107b 100644 --- a/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ drawBelow ? 0 : widgets.length; diff --git a/test/chart/bar_chart/bar_chart_helper_test.dart b/test/chart/bar_chart/bar_chart_helper_test.dart index 031773878..b5c6c7caf 100644 --- a/test/chart/bar_chart/bar_chart_helper_test.dart +++ b/test/chart/bar_chart/bar_chart_helper_test.dart @@ -41,10 +41,10 @@ void main() { BarChartRodData(toY: 10), BarChartRodData(toY: 5), ], - ) + ), ]; final result = BarChartHelper.calculateMaxAxisValues(barGroups); - expect(result.minY, -40); + expect(result.minY, 0); expect(result.maxY, 10); }); @@ -78,5 +78,49 @@ void main() { final result2 = BarChartMinMaxAxisValues(1, 11, readFromCache: true); expect(result1, result2); }); + + test('Test calculateMaxAxisValues with all positive values', () { + final barGroups = [ + barChartGroupData1.copyWith( + barRods: barChartGroupData1.barRods + .map( + (rod) => rod.copyWith( + fromY: 5, + backDrawRodData: BackgroundBarChartRodData(show: false), + ), + ) + .toList(), + ), + barChartGroupData2.copyWith( + barRods: barChartGroupData2.barRods + .map( + (rod) => rod.copyWith( + fromY: 8, + backDrawRodData: BackgroundBarChartRodData(show: false), + ), + ) + .toList(), + ), + ]; + final result1 = BarChartHelper.calculateMaxAxisValues(barGroups); + expect(result1.minY, 5); + }); + + test('Test calculateMaxAxisValues with all negative values', () { + final barGroups = [ + barChartGroupData1.copyWith( + barRods: barChartGroupData1.barRods + .map((rod) => rod.copyWith(fromY: -5)) + .toList(), + ), + barChartGroupData2.copyWith( + barRods: barChartGroupData2.barRods + .map((rod) => rod.copyWith(fromY: -8)) + .toList(), + ), + ]; + final result1 = BarChartHelper.calculateMaxAxisValues(barGroups); + expect(result1.minY, -8); + }); }); } diff --git a/test/chart/bar_chart/bar_chart_painter_test.dart b/test/chart/bar_chart/bar_chart_painter_test.dart index 5f5665919..106718ebf 100644 --- a/test/chart/bar_chart/bar_chart_painter_test.dart +++ b/test/chart/bar_chart/bar_chart_painter_test.dart @@ -389,7 +389,7 @@ void main() { 28.5, 0, 38.5, - 76.9, + 100, const Radius.circular(0.1), ), ), @@ -402,9 +402,9 @@ void main() { results[1]['rRect'] as RRect, RRect.fromLTRBR( 43.5, - 15.4, + 20, 54.5, - 76.9, + 100, const Radius.circular(0.2), ), ), @@ -417,9 +417,9 @@ void main() { results[2]['rRect'] as RRect, RRect.fromLTRBR( 59.5, - 15.4, + 20, 71.5, - 76.9, + 100, const Radius.circular(0.3), ), ), @@ -434,7 +434,7 @@ void main() { 81.5, 0, 91.5, - 76.9, + 100, const Radius.circular(0.4), ), ), @@ -445,9 +445,9 @@ void main() { results[4]['rRect'] as RRect, RRect.fromLTRBR( 96.5, - 15.4, + 20, 106.5, - 76.9, + 100, const Radius.circular(5), ), ), @@ -459,9 +459,9 @@ void main() { results[5]['rRect'] as RRect, RRect.fromLTRBR( 116.5, - 15.4, + 20, 126.5, - 76.9, + 100, const Radius.circular(5), ), ), @@ -475,7 +475,7 @@ void main() { 116.5, 0, 126.5, - 76.9, + 100, const Radius.circular(5), ), ), @@ -486,9 +486,9 @@ void main() { results[7]['rRect'] as RRect, RRect.fromLTRBR( 131.5, - 15.4, + 20, 141.5, - 76.9, + 100, const Radius.circular(5), ), ), @@ -500,9 +500,9 @@ void main() { results[8]['rRect'] as RRect, RRect.fromLTRBR( 146.5, - 76.9, - 156.5, 100, + 156.5, + 130, const Radius.circular(5), ), ), @@ -514,9 +514,9 @@ void main() { results[9]['rRect'] as RRect, RRect.fromLTRBR( 146.5, - 15.4, + 20, 156.5, - 76.9, + 100, const Radius.circular(5), ), ), @@ -527,9 +527,9 @@ void main() { results[10]['rRect'] as RRect, RRect.fromLTRBR( 161.5, - 15.4, + 20, 171.5, - 76.9, + 100, const Radius.circular(5), ), ), @@ -647,9 +647,9 @@ void main() { results[0]['rrect'] as RRect, RRect.fromLTRBR( 84, - 65, + 76.5, 94, - 66.7, + 78.4, const Radius.circular(0.1), ), ), @@ -662,9 +662,9 @@ void main() { results[1]['rrect'] as RRect, RRect.fromLTRBR( 83.5, - 68.3, + 80.4, 94.5, - 83.3, + 98, const Radius.circular(0.2), ), ), @@ -677,9 +677,9 @@ void main() { results[2]['rrect'] as RRect, RRect.fromLTRBR( 83, - 85, - 95, 100, + 95, + 117.6, const Radius.circular(0.3), ), ), @@ -692,9 +692,9 @@ void main() { results[3]['rrect'] as RRect, RRect.fromLTRBR( 106, - 33.3, + 39.2, 116, - 35, + 41.2, const Radius.circular(0.1), ), ), @@ -705,9 +705,9 @@ void main() { results[4]['rrect'] as RRect, RRect.fromLTRBR( 105.5, - 16.7, + 19.6, 116.5, - 31.7, + 37.3, const Radius.circular(0.2), ), ), @@ -721,7 +721,7 @@ void main() { 105, 0, 117, - 15, + 17.6, const Radius.circular(0.3), ), ), @@ -1619,7 +1619,7 @@ void main() { color: const Color(0x00000000), borderRadius: const BorderRadius.all(Radius.circular(0.1)), rodStackItems: [ - BarChartRodStackItem(0, 5, const Color(0xFF0F0F0F)) + BarChartRodStackItem(0, 5, const Color(0xFF0F0F0F)), ], ), ], @@ -1666,35 +1666,30 @@ void main() { null, ); expect( - painter.handleTouch(const Offset(91.3, 55.3), viewSize, holder), + painter.handleTouch(const Offset(100.4, 21.2), viewSize, holder), null, ); expect( - painter.handleTouch(const Offset(100.4, 21.2), viewSize, holder), + painter.handleTouch(const Offset(80.1, 22), viewSize, holder), null, ); + expect( - painter.handleTouch(const Offset(80.1, 22), viewSize, holder), + painter.handleTouch(const Offset(110.1, 70.2), viewSize, holder), null, ); final result1 = - painter.handleTouch(const Offset(110.1, 70.2), viewSize, holder); - expect(result1!.touchedBarGroupIndex, 1); + painter.handleTouch(const Offset(89, 38.5), viewSize, holder); + expect(result1!.touchedBarGroupIndex, 0); expect(result1.touchedRodDataIndex, 0); expect(result1.touchedStackItemIndex, -1); final result2 = - painter.handleTouch(const Offset(89, 38.5), viewSize, holder); + painter.handleTouch(const Offset(88.8, 16.5), viewSize, holder); expect(result2!.touchedBarGroupIndex, 0); expect(result2.touchedRodDataIndex, 0); - expect(result2.touchedStackItemIndex, 0); - - final result3 = - painter.handleTouch(const Offset(88.8, 16.5), viewSize, holder); - expect(result3!.touchedBarGroupIndex, 0); - expect(result3.touchedRodDataIndex, 0); - expect(result3.touchedStackItemIndex, -1); + expect(result2.touchedStackItemIndex, -1); }); test('test 3', () { @@ -2147,17 +2142,10 @@ void main() { holder, ); - expect(results.length, 2); + expect(results.length, 1); expect(results[0]['paint_color'], Colors.cyanAccent.value); expect(results[0]['paint_stroke_width'], 90); - expect(results[0]['from'], const Offset(0, 300)); - expect(results[0]['to'], const Offset(400, 300)); - - expect(results[1]['paint_color'], Colors.cyanAccent.value); - expect(results[1]['paint_stroke_width'], 100); - expect(results[1]['from'], const Offset(0, 392)); - expect(results[1]['to'], const Offset(400, 392)); Utils.changeInstance(utilsMainInstance); }); @@ -2174,7 +2162,7 @@ void main() { BarChartRodData(fromY: 1, toY: 10), BarChartRodData(fromY: 2, toY: 10), ], - ) + ), ], titlesData: const FlTitlesData(show: false), extraLinesData: ExtraLinesData( diff --git a/test/chart/line_chart/line_chart_helper_test.dart b/test/chart/line_chart/line_chart_helper_test.dart index bc1e3d9a0..0ed40801c 100644 --- a/test/chart/line_chart/line_chart_helper_test.dart +++ b/test/chart/line_chart/line_chart_helper_test.dart @@ -43,7 +43,7 @@ void main() { FlSpot(-3, 50), FlSpot(14, -10), ], - ) + ), ]; final result = LineChartHelper.calculateMaxAxisValues(lineBars); expect(result.minX, -3); @@ -69,7 +69,7 @@ void main() { FlSpot.nullSpot, FlSpot.nullSpot, ], - ) + ), ]; final result1 = LineChartHelper.calculateMaxAxisValues(lineBars); expect(result1, const LineChartMinMaxAxisValues(0, 0, 0, 0)); @@ -84,7 +84,7 @@ void main() { FlSpot.nullSpot, const FlSpot(4, -3), ], - ) + ), ]; final result1 = LineChartHelper.calculateMaxAxisValues(lineBars); expect(result1, const LineChartMinMaxAxisValues(-1, 4, -3, 5)); diff --git a/test/chart/line_chart/line_chart_painter_test.dart b/test/chart/line_chart/line_chart_painter_test.dart index 71748b0b3..c702c6431 100644 --- a/test/chart/line_chart/line_chart_painter_test.dart +++ b/test/chart/line_chart/line_chart_painter_test.dart @@ -66,7 +66,7 @@ void main() { ShowingTooltipIndicators([ LineBarSpot(bar1, 0, bar1.spots.first), LineBarSpot(bar2, 1, bar2.spots.first), - ]) + ]), ], lineTouchData: LineTouchData( getTouchedSpotIndicator: @@ -172,7 +172,7 @@ void main() { LineBarSpot(bar2, 1, bar1.spots[2]), LineBarSpot(bar2, 1, bar1.spots[3]), LineBarSpot(bar2, 1, bar1.spots[4]), - ]) + ]), ], ); diff --git a/test/chart/pie_chart/pie_chart_painter_test.dart b/test/chart/pie_chart/pie_chart_painter_test.dart index 97d090292..fcfaf8286 100644 --- a/test/chart/pie_chart/pie_chart_painter_test.dart +++ b/test/chart/pie_chart/pie_chart_painter_test.dart @@ -124,7 +124,7 @@ void main() { color: MockData.color3, width: 3, ), - ) + ), ]; final data = PieChartData( sections: sections, diff --git a/test/chart/scatter_chart/scatter_chart_helper_test.dart b/test/chart/scatter_chart/scatter_chart_helper_test.dart index b04df442b..d29c88d64 100644 --- a/test/chart/scatter_chart/scatter_chart_helper_test.dart +++ b/test/chart/scatter_chart/scatter_chart_helper_test.dart @@ -22,7 +22,7 @@ void main() { final scatterSpotsClone = [ scatterSpot1Clone, scatterSpot2Clone, - scatterSpot3 + scatterSpot3, ]; final result1 = ScatterChartHelper.calculateMaxAxisValues(scatterSpots); final result2 = @@ -36,7 +36,7 @@ void main() { scatterSpot1, scatterSpot2, scatterSpot3, - scatterSpot4 + scatterSpot4, ]; final result = ScatterChartHelper.calculateMaxAxisValues(scatterSpots); expect(result.minX, -14); @@ -71,7 +71,7 @@ void main() { final scatterSpotsClone = [ scatterSpot1Clone, scatterSpot2Clone, - scatterSpot3 + scatterSpot3, ]; final result1 = ScatterChartHelper.calculateMaxAxisValues(scatterSpots); final result2 =