Unverified Commit 8d3c7e7d authored by Xilai Zhang's avatar Xilai Zhang Committed by GitHub

Revert "`AutomatedTestWidgetsFlutterBinding.pump` provides wrong pump time...

Revert "`AutomatedTestWidgetsFlutterBinding.pump` provides wrong pump time stamp, probably because of forgetting the precision" (#113415)
parent 24aa26a3
...@@ -1090,7 +1090,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding { ...@@ -1090,7 +1090,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
addTime(const Duration(milliseconds: 500)); addTime(const Duration(milliseconds: 500));
_currentFakeAsync!.flushMicrotasks(); _currentFakeAsync!.flushMicrotasks();
handleBeginFrame(Duration( handleBeginFrame(Duration(
microseconds: _clock!.now().microsecondsSinceEpoch, milliseconds: _clock!.now().millisecondsSinceEpoch,
)); ));
_currentFakeAsync!.flushMicrotasks(); _currentFakeAsync!.flushMicrotasks();
handleDrawFrame(); handleDrawFrame();
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
// ignore: deprecated_member_use // ignore: deprecated_member_use
...@@ -57,18 +57,6 @@ void main() { ...@@ -57,18 +57,6 @@ void main() {
order += 1; 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', () { group('elapseBlocking', () {
testWidgets('timer is not called', (WidgetTester tester) async { testWidgets('timer is not called', (WidgetTester tester) async {
bool timerCalled = false; bool timerCalled = false;
......
...@@ -170,12 +170,12 @@ void main() { ...@@ -170,12 +170,12 @@ void main() {
await tester.pumpFrames(target, const Duration(milliseconds: 55)); await tester.pumpFrames(target, const Duration(milliseconds: 55));
expect(logPaints, <int>[0, 16683, 33366, 50049]); expect(logPaints, <int>[0, 17000, 34000, 50000]);
logPaints.clear(); logPaints.clear();
await tester.pumpFrames(target, const Duration(milliseconds: 30), const Duration(milliseconds: 10)); await tester.pumpFrames(target, const Duration(milliseconds: 30), const Duration(milliseconds: 10));
expect(logPaints, <int>[60049, 70049, 80049]); expect(logPaints, <int>[60000, 70000, 80000]);
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment