Revert "AutomatedTestWidgetsFlutterBinding.pump
provides wrong pump time stamp, probably because of forgetting the precision" (#113415)
This commit is contained in:
parent
24aa26a36d
commit
8d3c7e7da6
@ -1090,7 +1090,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
||||
addTime(const Duration(milliseconds: 500));
|
||||
_currentFakeAsync!.flushMicrotasks();
|
||||
handleBeginFrame(Duration(
|
||||
microseconds: _clock!.now().microsecondsSinceEpoch,
|
||||
milliseconds: _clock!.now().millisecondsSinceEpoch,
|
||||
));
|
||||
_currentFakeAsync!.flushMicrotasks();
|
||||
handleDrawFrame();
|
||||
|
@ -10,7 +10,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
// ignore: deprecated_member_use
|
||||
@ -57,18 +57,6 @@ void main() {
|
||||
order += 1;
|
||||
});
|
||||
|
||||
testWidgets('timeStamp should be accurate', (WidgetTester tester) async {
|
||||
final WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
await tester.pumpWidget(const CircularProgressIndicator());
|
||||
|
||||
final Duration timeStampBefore = widgetsBinding.currentSystemFrameTimeStamp;
|
||||
await tester.pump(const Duration(microseconds: 12345));
|
||||
final Duration timeStampAfter = widgetsBinding.currentSystemFrameTimeStamp;
|
||||
|
||||
expect(timeStampAfter - timeStampBefore, const Duration(microseconds: 12345));
|
||||
});
|
||||
|
||||
group('elapseBlocking', () {
|
||||
testWidgets('timer is not called', (WidgetTester tester) async {
|
||||
bool timerCalled = false;
|
||||
|
@ -170,12 +170,12 @@ void main() {
|
||||
|
||||
await tester.pumpFrames(target, const Duration(milliseconds: 55));
|
||||
|
||||
expect(logPaints, <int>[0, 16683, 33366, 50049]);
|
||||
expect(logPaints, <int>[0, 17000, 34000, 50000]);
|
||||
logPaints.clear();
|
||||
|
||||
await tester.pumpFrames(target, const Duration(milliseconds: 30), const Duration(milliseconds: 10));
|
||||
|
||||
expect(logPaints, <int>[60049, 70049, 80049]);
|
||||
expect(logPaints, <int>[60000, 70000, 80000]);
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user