Allow the runs burst bench for executing rows' clock-driven durations
This commit is contained in:
@@ -211,9 +211,11 @@ void main() {
|
|||||||
controller.addListener(() => notifications++);
|
controller.addListener(() => notifications++);
|
||||||
await tester.pumpWidget(shell(AppDestination.runs));
|
await tester.pumpWidget(shell(AppDestination.runs));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
|
final rows = find.byType(RunListRow).evaluate().length;
|
||||||
rebuilds
|
rebuilds
|
||||||
..reset()
|
..reset()
|
||||||
..install();
|
..install();
|
||||||
|
final wall = Stopwatch()..start();
|
||||||
// Frames arrive between frames on a real socket: pump after each.
|
// Frames arrive between frames on a real socket: pump after each.
|
||||||
for (var i = 0; i < 50; i++) {
|
for (var i = 0; i < 50; i++) {
|
||||||
frame(i);
|
frame(i);
|
||||||
@@ -221,6 +223,7 @@ void main() {
|
|||||||
}
|
}
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
rebuilds.uninstall();
|
rebuilds.uninstall();
|
||||||
|
final seconds = wall.elapsed.inSeconds;
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
print(
|
print(
|
||||||
'BENCH visibleBurst50 controllerNotifications=$notifications '
|
'BENCH visibleBurst50 controllerNotifications=$notifications '
|
||||||
@@ -238,8 +241,13 @@ void main() {
|
|||||||
// Only the ten frames that advance a step change anything visible.
|
// Only the ten frames that advance a step change anything visible.
|
||||||
expect(notifications, lessThanOrEqualTo(10));
|
expect(notifications, lessThanOrEqualTo(10));
|
||||||
// Each notification rebuilds the one row whose run changed, not every
|
// Each notification rebuilds the one row whose run changed, not every
|
||||||
// built row (16 rows rebuilt per notification before memoized rows).
|
// built row (16 rows rebuilt per notification before memoized rows). An
|
||||||
expect(rebuilds.of(RunListRow), lessThanOrEqualTo(notifications));
|
// 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());
|
await tester.pumpWidget(const SizedBox());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user