diff --git a/packages/rfw/CHANGELOG.md b/packages/rfw/CHANGELOG.md index b3082c795e66..5b2b6cbbfd61 100644 --- a/packages/rfw/CHANGELOG.md +++ b/packages/rfw/CHANGELOG.md @@ -1,4 +1,5 @@ ## 1.0.24 + * Adds `InkResponse` material widget. * Adds `Material` material widget. * Adds the `child` to `Opacity` core widget. diff --git a/packages/rfw/lib/src/flutter/core_widgets.dart b/packages/rfw/lib/src/flutter/core_widgets.dart index e8d1d8f74b3b..a60e17f04073 100644 --- a/packages/rfw/lib/src/flutter/core_widgets.dart +++ b/packages/rfw/lib/src/flutter/core_widgets.dart @@ -277,7 +277,7 @@ Map get _coreWidgetsDefinitions => (Clip.values, source, ['clipBehavior']) ?? Clip.antiAlias, child: source.optionalChild(['child']), ); - }, + }, 'ColoredBox': (BuildContext context, DataSource source) { return ColoredBox( diff --git a/packages/rfw/lib/src/flutter/runtime.dart b/packages/rfw/lib/src/flutter/runtime.dart index a610a762ce9d..7d874e78e8b2 100644 --- a/packages/rfw/lib/src/flutter/runtime.dart +++ b/packages/rfw/lib/src/flutter/runtime.dart @@ -249,12 +249,12 @@ class Runtime extends ChangeNotifier { /// /// The returned map is an immutable view of the map updated by calls to /// [update] and [clearLibraries]. - /// + /// /// The keys are instances [LibraryName] which encode fully qualified library /// names, and the values are the corresponding [WidgetLibrary]s. - /// + /// /// The returned map is an immutable copy of the registered libraries - /// at the time of this call. + /// at the time of this call. /// /// See also: /// diff --git a/packages/rfw/test/core_widgets_test.dart b/packages/rfw/test/core_widgets_test.dart index aaeeacefe50c..75f5141c1c1e 100644 --- a/packages/rfw/test/core_widgets_test.dart +++ b/packages/rfw/test/core_widgets_test.dart @@ -293,7 +293,7 @@ void main() { ''')); await tester.pump(); expect(find.byType(ClipRRect), findsOneWidget); - final RenderClipRRect renderClip = tester.allRenderObjects.whereType().first; + final RenderClipRRect renderClip = tester.allRenderObjects.whereType().first; expect(renderClip.clipBehavior, equals(Clip.antiAlias)); expect(renderClip.borderRadius, equals(BorderRadius.zero)); }); diff --git a/packages/rfw/test_coverage/bin/test_coverage.dart b/packages/rfw/test_coverage/bin/test_coverage.dart index 4781693cb75b..a84b1c0c7819 100644 --- a/packages/rfw/test_coverage/bin/test_coverage.dart +++ b/packages/rfw/test_coverage/bin/test_coverage.dart @@ -18,15 +18,15 @@ import 'package:meta/meta.dart'; // once it is loaded you can call `M-x coverlay-display-stats` to get a summary // of the files to look at.) -// Please update these targets when you update this package. -// Please ensure that test coverage continues to be 100%. -// Don't forget to update the lastUpdate date too! -const int targetLines = 3333; -const String targetPercent = '100'; -const String lastUpdate = '2024-02-26'; +// If Dart coverage increases the number of lines that could be covered, it is +// possible that this package will no longer report 100% coverage even though +// nothing has changed about the package itself. In the event that that happens, +// set this constant to the number of lines currently being covered and file a +// bug, cc'ing the current package owner (Hixie) so that they can add more tests. +const int? targetLines = null; @immutable -/* final */ class LcovLine { +final class LcovLine { const LcovLine(this.filename, this.line); final String filename; final int line; @@ -161,53 +161,42 @@ Future main(List arguments) async { final String coveredPercent = (100.0 * coveredLines / totalLines).toStringAsFixed(1); - // We only check the TARGET_LINES matches, not the TARGET_PERCENT, - // because we expect the percentage to drop over time as Dart fixes - // various bugs in how it determines what lines are coverable. - if (coveredLines < targetLines && targetLines <= totalLines) { + if (targetLines != null) { + if (targetLines! < totalLines) { + print( + 'Warning: test_coverage has an override set to reduce the expected number of covered lines from $totalLines to $targetLines.\n' + 'New tests should be written to cover all lines in the package.' + ); + totalLines = targetLines!; + } else if (targetLines == totalLines) { + print( + 'Warning: test_coverage has a redundant targetLines; it is equal to the actual number of coverable lines ($totalLines).\n' + 'Update test_coverage.dart to set the targetLines constant to null.' + ); + } else { + print( + 'Warning: test_coverage has an outdated targetLines ($targetLines) that is above the total number of lines in the package ($totalLines).\n' + 'Update test_coverage.dart to set the targetLines constant to null.' + ); + } + } + + if (coveredLines < totalLines) { print(''); print(' ╭──────────────────────────────╮'); print(' │ COVERAGE REGRESSION DETECTED │'); print(' ╰──────────────────────────────╯'); print(''); print( - 'Coverage has reduced to only $coveredLines lines ($coveredPercent%). This is lower than', - ); - print( - 'it was as of $lastUpdate, when coverage was $targetPercent%, covering $targetLines lines.', - ); - print( - 'Please add sufficient tests to get coverage back to 100%, and update', - ); - print( - 'test_coverage/bin/test_coverage.dart to have the appropriate targets.', + 'Coverage has reduced to only $coveredLines lines ($coveredPercent%), out\n' + 'of $totalLines total lines; ${totalLines - coveredLines} lines are not covered by tests.\n' + 'Please add sufficient tests to get coverage back to 100%.', ); print(''); print( 'When in doubt, ask @Hixie for advice. Thanks!', ); exit(1); - } else { - if (coveredLines < totalLines) { - print( - 'Warning: Coverage of package:rfw is no longer 100%. (Coverage is now $coveredPercent%, $coveredLines/$totalLines lines.)', - ); - } - if (coveredLines > targetLines) { - print( - 'Total lines of covered code has increased, and coverage script is now out of date.\n' - 'Coverage is now $coveredPercent%, $coveredLines/$totalLines lines, whereas previously there were only $targetLines lines.\n' - 'Update the "targetLines" constant at the top of rfw/test_coverage/bin/test_coverage.dart (to $coveredLines).', - ); - } - if (targetLines > totalLines) { - print( - 'Total lines of code has reduced, and coverage script is now out of date.\n' - 'Coverage is now $coveredPercent%, $coveredLines/$totalLines lines, but previously there were $targetLines lines.\n' - 'Update the "targetLines" constant at the top of rfw/test_coverage/bin/test_coverage.dart (to $totalLines).', - ); - exit(1); - } } coverageDirectory.deleteSync(recursive: true);