mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
* Revert "Reland "Clipping if only one character text overflows (#99146)" (#102130)" This reverts commit3f43d9f3d4
. * Revert "Implement frameData for TestWindow (#105537)" This reverts commit21841d7e35
.
This commit is contained in:
parent
19ac08dcd7
commit
d6f090d952
@ -156,12 +156,6 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
|
|||||||
debugDisableShadows = disableShadows;
|
debugDisableShadows = disableShadows;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
void handleBeginFrame(Duration? rawTimeStamp) {
|
|
||||||
_window.incrementFrameNumber();
|
|
||||||
super.handleBeginFrame(rawTimeStamp);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TestWindow get window => _window;
|
TestWindow get window => _window;
|
||||||
final TestWindow _window;
|
final TestWindow _window;
|
||||||
@ -1054,6 +1048,7 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
|||||||
}
|
}
|
||||||
_phase = newPhase;
|
_phase = newPhase;
|
||||||
if (hasScheduledFrame) {
|
if (hasScheduledFrame) {
|
||||||
|
addTime(const Duration(milliseconds: 500));
|
||||||
_currentFakeAsync!.flushMicrotasks();
|
_currentFakeAsync!.flushMicrotasks();
|
||||||
handleBeginFrame(Duration(
|
handleBeginFrame(Duration(
|
||||||
milliseconds: _clock!.now().millisecondsSinceEpoch,
|
milliseconds: _clock!.now().millisecondsSinceEpoch,
|
||||||
@ -1098,6 +1093,8 @@ class AutomatedTestWidgetsFlutterBinding extends TestWidgetsFlutterBinding {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
addTime(additionalTime);
|
||||||
|
|
||||||
return realAsyncZone.run<Future<T?>>(() async {
|
return realAsyncZone.run<Future<T?>>(() async {
|
||||||
_pendingAsyncTasks = Completer<void>();
|
_pendingAsyncTasks = Completer<void>();
|
||||||
T? result;
|
T? result;
|
||||||
|
@ -59,14 +59,6 @@ class TestWindow implements ui.SingletonFlutterWindow {
|
|||||||
}) : _window = window,
|
}) : _window = window,
|
||||||
platformDispatcher = TestPlatformDispatcher(platformDispatcher: window.platformDispatcher);
|
platformDispatcher = TestPlatformDispatcher(platformDispatcher: window.platformDispatcher);
|
||||||
|
|
||||||
|
|
||||||
int _frameNumber = 0;
|
|
||||||
/// Indicates that the test binding has pumped a frame.
|
|
||||||
void incrementFrameNumber() {
|
|
||||||
_frameNumber += 1;
|
|
||||||
platformDispatcher.frameData = _TestFrameData(_frameNumber);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The [dart:ui.SingletonFlutterWindow] that is wrapped by this [TestWindow].
|
/// The [dart:ui.SingletonFlutterWindow] that is wrapped by this [TestWindow].
|
||||||
final ui.SingletonFlutterWindow _window;
|
final ui.SingletonFlutterWindow _window;
|
||||||
|
|
||||||
@ -499,9 +491,6 @@ class TestWindow implements ui.SingletonFlutterWindow {
|
|||||||
platformDispatcher.onPlatformMessage = callback;
|
platformDispatcher.onPlatformMessage = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
ui.FrameData get frameData => platformDispatcher.frameData;
|
|
||||||
|
|
||||||
/// Delete any test value properties that have been set on this [TestWindow]
|
/// Delete any test value properties that have been set on this [TestWindow]
|
||||||
/// as well as its [platformDispatcher].
|
/// as well as its [platformDispatcher].
|
||||||
///
|
///
|
||||||
@ -516,7 +505,6 @@ class TestWindow implements ui.SingletonFlutterWindow {
|
|||||||
clearDisplayFeaturesTestValue();
|
clearDisplayFeaturesTestValue();
|
||||||
clearPhysicalSizeTestValue();
|
clearPhysicalSizeTestValue();
|
||||||
clearViewInsetsTestValue();
|
clearViewInsetsTestValue();
|
||||||
_frameNumber = 0;
|
|
||||||
platformDispatcher.clearAllTestValues();
|
platformDispatcher.clearAllTestValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,7 +882,6 @@ class TestPlatformDispatcher implements ui.PlatformDispatcher {
|
|||||||
clearLocalesTestValue();
|
clearLocalesTestValue();
|
||||||
clearSemanticsEnabledTestValue();
|
clearSemanticsEnabledTestValue();
|
||||||
clearTextScaleFactorTestValue();
|
clearTextScaleFactorTestValue();
|
||||||
frameData = const _TestFrameData(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -927,7 +914,7 @@ class TestPlatformDispatcher implements ui.PlatformDispatcher {
|
|||||||
ui.PlatformConfiguration get configuration => _platformDispatcher.configuration;
|
ui.PlatformConfiguration get configuration => _platformDispatcher.configuration;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ui.FrameData frameData = const _TestFrameData(0);
|
ui.FrameData get frameData => _platformDispatcher.frameData;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ByteData? getPersistentIsolateData() => _platformDispatcher.getPersistentIsolateData();
|
ByteData? getPersistentIsolateData() => _platformDispatcher.getPersistentIsolateData();
|
||||||
@ -943,10 +930,3 @@ class TestPlatformDispatcher implements ui.PlatformDispatcher {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TestFrameData implements ui.FrameData {
|
|
||||||
const _TestFrameData(this.frameNumber);
|
|
||||||
|
|
||||||
@override
|
|
||||||
final int frameNumber;
|
|
||||||
}
|
|
||||||
|
@ -33,35 +33,6 @@ void main() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('frameNumber', () async {
|
|
||||||
binding.window.clearAllTestValues();
|
|
||||||
expect(binding.window.frameData.frameNumber, 0);
|
|
||||||
await binding.runTest(() async {
|
|
||||||
// runTest pumps a frame.
|
|
||||||
expect(binding.window.frameData.frameNumber, 1);
|
|
||||||
|
|
||||||
// Scheduling should not pump
|
|
||||||
binding.scheduleFrame();
|
|
||||||
expect(binding.window.frameData.frameNumber, 1);
|
|
||||||
binding.handleBeginFrame(null);
|
|
||||||
expect(binding.window.frameData.frameNumber, 2);
|
|
||||||
binding.handleDrawFrame();
|
|
||||||
expect(binding.window.frameData.frameNumber, 2);
|
|
||||||
|
|
||||||
// Pump with no scheduled frame.
|
|
||||||
await binding.pump();
|
|
||||||
expect(binding.window.frameData.frameNumber, 2);
|
|
||||||
|
|
||||||
// Schedule and pump, similar to handleBeginFrame.
|
|
||||||
binding.scheduleFrame();
|
|
||||||
await binding.pump();
|
|
||||||
expect(binding.window.frameData.frameNumber, 3);
|
|
||||||
}, () {});
|
|
||||||
binding.postTest();
|
|
||||||
binding.window.clearAllTestValues();
|
|
||||||
expect(binding.window.frameData.frameNumber, 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
// The next three tests must run in order -- first using `test`, then `testWidgets`, then `test` again.
|
// The next three tests must run in order -- first using `test`, then `testWidgets`, then `test` again.
|
||||||
|
|
||||||
int order = 0;
|
int order = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user