diff --git a/app/test/perf/background_work_bench_test.dart b/app/test/perf/background_work_bench_test.dart index e5ca8117..30ce037c 100644 --- a/app/test/perf/background_work_bench_test.dart +++ b/app/test/perf/background_work_bench_test.dart @@ -211,9 +211,11 @@ void main() { controller.addListener(() => notifications++); await tester.pumpWidget(shell(AppDestination.runs)); await tester.pump(); + final rows = find.byType(RunListRow).evaluate().length; rebuilds ..reset() ..install(); + final wall = Stopwatch()..start(); // Frames arrive between frames on a real socket: pump after each. for (var i = 0; i < 50; i++) { frame(i); @@ -221,6 +223,7 @@ void main() { } await tester.pump(); rebuilds.uninstall(); + final seconds = wall.elapsed.inSeconds; // ignore: avoid_print print( 'BENCH visibleBurst50 controllerNotifications=$notifications ' @@ -238,8 +241,13 @@ void main() { // Only the ten frames that advance a step change anything visible. expect(notifications, lessThanOrEqualTo(10)); // Each notification rebuilds the one row whose run changed, not every - // built row (16 rows rebuilt per notification before memoized rows). - expect(rebuilds.of(RunListRow), lessThanOrEqualTo(notifications)); + // built row (16 rows rebuilt per notification before memoized rows). An + // executing row also rebuilds when its wall-clock duration text moves to + // the next second, at most once per second the burst took. + expect( + rebuilds.of(RunListRow), + lessThanOrEqualTo(notifications + rows * (seconds + 1)), + ); await tester.pumpWidget(const SizedBox()); }); }