Unverified Commit db48cadd authored by David Worsham's avatar David Worsham Committed by GitHub

Remove unused physicalDepth code (#60152)

parent 9e30d51a
...@@ -97,7 +97,6 @@ class MediaQueryData { ...@@ -97,7 +97,6 @@ class MediaQueryData {
this.viewInsets = EdgeInsets.zero, this.viewInsets = EdgeInsets.zero,
this.systemGestureInsets = EdgeInsets.zero, this.systemGestureInsets = EdgeInsets.zero,
this.viewPadding = EdgeInsets.zero, this.viewPadding = EdgeInsets.zero,
this.physicalDepth = double.maxFinite,
this.alwaysUse24HourFormat = false, this.alwaysUse24HourFormat = false,
this.accessibleNavigation = false, this.accessibleNavigation = false,
this.invertColors = false, this.invertColors = false,
...@@ -113,7 +112,6 @@ class MediaQueryData { ...@@ -113,7 +112,6 @@ class MediaQueryData {
assert(viewInsets != null), assert(viewInsets != null),
assert(systemGestureInsets != null), assert(systemGestureInsets != null),
assert(viewPadding != null), assert(viewPadding != null),
assert(physicalDepth != null),
assert(alwaysUse24HourFormat != null), assert(alwaysUse24HourFormat != null),
assert(accessibleNavigation != null), assert(accessibleNavigation != null),
assert(invertColors != null), assert(invertColors != null),
...@@ -137,7 +135,6 @@ class MediaQueryData { ...@@ -137,7 +135,6 @@ class MediaQueryData {
viewPadding = EdgeInsets.fromWindowPadding(window.viewPadding, window.devicePixelRatio), viewPadding = EdgeInsets.fromWindowPadding(window.viewPadding, window.devicePixelRatio),
viewInsets = EdgeInsets.fromWindowPadding(window.viewInsets, window.devicePixelRatio), viewInsets = EdgeInsets.fromWindowPadding(window.viewInsets, window.devicePixelRatio),
systemGestureInsets = EdgeInsets.fromWindowPadding(window.systemGestureInsets, window.devicePixelRatio), systemGestureInsets = EdgeInsets.fromWindowPadding(window.systemGestureInsets, window.devicePixelRatio),
physicalDepth = window.physicalDepth,
accessibleNavigation = window.accessibilityFeatures.accessibleNavigation, accessibleNavigation = window.accessibilityFeatures.accessibleNavigation,
invertColors = window.accessibilityFeatures.invertColors, invertColors = window.accessibilityFeatures.invertColors,
disableAnimations = window.accessibilityFeatures.disableAnimations, disableAnimations = window.accessibilityFeatures.disableAnimations,
...@@ -291,19 +288,6 @@ class MediaQueryData { ...@@ -291,19 +288,6 @@ class MediaQueryData {
/// {@end-tool} /// {@end-tool}
final EdgeInsets systemGestureInsets; final EdgeInsets systemGestureInsets;
/// The physical depth is the maximum elevation that the Window allows.
///
/// Physical layers drawn at or above this elevation will have their elevation
/// clamped to this value. This can happen if the physical layer itself has
/// an elevation larger than the available depth, or if some ancestor of the
/// layer causes it to have a cumulative elevation that is larger than the
/// available depth.
///
/// The default value is [double.maxFinite], which is used for platforms that
/// do not specify a maximum elevation. This property is currently only
/// expected to be set to a non-default value on Fuchsia.
final double physicalDepth;
/// Whether to use 24-hour format when formatting time. /// Whether to use 24-hour format when formatting time.
/// ///
/// The behavior of this flag is different across platforms: /// The behavior of this flag is different across platforms:
...@@ -394,7 +378,6 @@ class MediaQueryData { ...@@ -394,7 +378,6 @@ class MediaQueryData {
EdgeInsets viewPadding, EdgeInsets viewPadding,
EdgeInsets viewInsets, EdgeInsets viewInsets,
EdgeInsets systemGestureInsets, EdgeInsets systemGestureInsets,
double physicalDepth,
bool alwaysUse24HourFormat, bool alwaysUse24HourFormat,
bool highContrast, bool highContrast,
bool disableAnimations, bool disableAnimations,
...@@ -412,7 +395,6 @@ class MediaQueryData { ...@@ -412,7 +395,6 @@ class MediaQueryData {
viewPadding: viewPadding ?? this.viewPadding, viewPadding: viewPadding ?? this.viewPadding,
viewInsets: viewInsets ?? this.viewInsets, viewInsets: viewInsets ?? this.viewInsets,
systemGestureInsets: systemGestureInsets ?? this.systemGestureInsets, systemGestureInsets: systemGestureInsets ?? this.systemGestureInsets,
physicalDepth: physicalDepth ?? this.physicalDepth,
alwaysUse24HourFormat: alwaysUse24HourFormat ?? this.alwaysUse24HourFormat, alwaysUse24HourFormat: alwaysUse24HourFormat ?? this.alwaysUse24HourFormat,
invertColors: invertColors ?? this.invertColors, invertColors: invertColors ?? this.invertColors,
highContrast: highContrast ?? this.highContrast, highContrast: highContrast ?? this.highContrast,
...@@ -581,7 +563,6 @@ class MediaQueryData { ...@@ -581,7 +563,6 @@ class MediaQueryData {
&& other.padding == padding && other.padding == padding
&& other.viewPadding == viewPadding && other.viewPadding == viewPadding
&& other.viewInsets == viewInsets && other.viewInsets == viewInsets
&& other.physicalDepth == physicalDepth
&& other.alwaysUse24HourFormat == alwaysUse24HourFormat && other.alwaysUse24HourFormat == alwaysUse24HourFormat
&& other.highContrast == highContrast && other.highContrast == highContrast
&& other.disableAnimations == disableAnimations && other.disableAnimations == disableAnimations
...@@ -601,7 +582,6 @@ class MediaQueryData { ...@@ -601,7 +582,6 @@ class MediaQueryData {
padding, padding,
viewPadding, viewPadding,
viewInsets, viewInsets,
physicalDepth,
alwaysUse24HourFormat, alwaysUse24HourFormat,
highContrast, highContrast,
disableAnimations, disableAnimations,
...@@ -622,7 +602,6 @@ class MediaQueryData { ...@@ -622,7 +602,6 @@ class MediaQueryData {
'padding: $padding', 'padding: $padding',
'viewPadding: $viewPadding', 'viewPadding: $viewPadding',
'viewInsets: $viewInsets', 'viewInsets: $viewInsets',
'physicalDepth: $physicalDepth',
'alwaysUse24HourFormat: $alwaysUse24HourFormat', 'alwaysUse24HourFormat: $alwaysUse24HourFormat',
'accessibleNavigation: $accessibleNavigation', 'accessibleNavigation: $accessibleNavigation',
'highContrast: $highContrast', 'highContrast: $highContrast',
......
...@@ -71,7 +71,6 @@ void main() { ...@@ -71,7 +71,6 @@ void main() {
expect(data.boldText, false); expect(data.boldText, false);
expect(data.highContrast, false); expect(data.highContrast, false);
expect(data.platformBrightness, Brightness.light); expect(data.platformBrightness, Brightness.light);
expect(data.physicalDepth, equals(WidgetsBinding.instance.window.physicalDepth));
}); });
testWidgets('MediaQueryData.copyWith defaults to source', (WidgetTester tester) async { testWidgets('MediaQueryData.copyWith defaults to source', (WidgetTester tester) async {
...@@ -84,7 +83,6 @@ void main() { ...@@ -84,7 +83,6 @@ void main() {
expect(copied.viewPadding, data.viewPadding); expect(copied.viewPadding, data.viewPadding);
expect(copied.viewInsets, data.viewInsets); expect(copied.viewInsets, data.viewInsets);
expect(copied.systemGestureInsets, data.systemGestureInsets); expect(copied.systemGestureInsets, data.systemGestureInsets);
expect(copied.physicalDepth, data.physicalDepth);
expect(copied.alwaysUse24HourFormat, data.alwaysUse24HourFormat); expect(copied.alwaysUse24HourFormat, data.alwaysUse24HourFormat);
expect(copied.accessibleNavigation, data.accessibleNavigation); expect(copied.accessibleNavigation, data.accessibleNavigation);
expect(copied.invertColors, data.invertColors); expect(copied.invertColors, data.invertColors);
...@@ -104,7 +102,6 @@ void main() { ...@@ -104,7 +102,6 @@ void main() {
const EdgeInsets customViewPadding = EdgeInsets.all(11.24031); const EdgeInsets customViewPadding = EdgeInsets.all(11.24031);
const EdgeInsets customViewInsets = EdgeInsets.all(1.67262); const EdgeInsets customViewInsets = EdgeInsets.all(1.67262);
const EdgeInsets customSystemGestureInsets = EdgeInsets.all(1.5556); const EdgeInsets customSystemGestureInsets = EdgeInsets.all(1.5556);
const double customPhysicalDepth = 120.0;
final MediaQueryData data = MediaQueryData.fromWindow(WidgetsBinding.instance.window); final MediaQueryData data = MediaQueryData.fromWindow(WidgetsBinding.instance.window);
final MediaQueryData copied = data.copyWith( final MediaQueryData copied = data.copyWith(
...@@ -115,7 +112,6 @@ void main() { ...@@ -115,7 +112,6 @@ void main() {
viewPadding: customViewPadding, viewPadding: customViewPadding,
viewInsets: customViewInsets, viewInsets: customViewInsets,
systemGestureInsets: customSystemGestureInsets, systemGestureInsets: customSystemGestureInsets,
physicalDepth: customPhysicalDepth,
alwaysUse24HourFormat: true, alwaysUse24HourFormat: true,
accessibleNavigation: true, accessibleNavigation: true,
invertColors: true, invertColors: true,
...@@ -131,7 +127,6 @@ void main() { ...@@ -131,7 +127,6 @@ void main() {
expect(copied.viewPadding, customViewPadding); expect(copied.viewPadding, customViewPadding);
expect(copied.viewInsets, customViewInsets); expect(copied.viewInsets, customViewInsets);
expect(copied.systemGestureInsets, customSystemGestureInsets); expect(copied.systemGestureInsets, customSystemGestureInsets);
expect(copied.physicalDepth, customPhysicalDepth);
expect(copied.alwaysUse24HourFormat, true); expect(copied.alwaysUse24HourFormat, true);
expect(copied.accessibleNavigation, true); expect(copied.accessibleNavigation, true);
expect(copied.invertColors, true); expect(copied.invertColors, true);
...@@ -655,17 +650,6 @@ void main() { ...@@ -655,17 +650,6 @@ void main() {
fail('The assert was never called when it should have been'); fail('The assert was never called when it should have been');
}); });
test('physicalDepth parameter in MediaQueryData cannot be null', () {
try {
MediaQueryData(physicalDepth: null);
} on AssertionError catch (error) {
expect(error.toString(), contains('physicalDepth != null'));
expect(error.toString(), contains('is not true'));
return;
}
fail('The assert was never called when it should have been');
});
test('alwaysUse24HourFormat parameter in MediaQueryData cannot be null', () { test('alwaysUse24HourFormat parameter in MediaQueryData cannot be null', () {
try { try {
MediaQueryData(alwaysUse24HourFormat: null); MediaQueryData(alwaysUse24HourFormat: null);
......
...@@ -86,22 +86,6 @@ class TestWindow implements Window { ...@@ -86,22 +86,6 @@ class TestWindow implements Window {
onMetricsChanged(); onMetricsChanged();
} }
@override
double get physicalDepth => _physicalDepthTestValue ?? _window.physicalDepth;
double _physicalDepthTestValue;
/// Hides the real physical depth and reports the given
/// [physicalDepthTestValue] instead.
set physicalDepthTestValue (double physicalDepthTestValue) {
_physicalDepthTestValue = physicalDepthTestValue;
onMetricsChanged();
}
/// Deletes any existing test physical depth and returns to using the real
/// physical depth.
void clearPhysicalDepthTestValue() {
_physicalDepthTestValue = null;
onMetricsChanged();
}
@override @override
WindowPadding get viewInsets => _viewInsetsTestValue ?? _window.viewInsets; WindowPadding get viewInsets => _viewInsetsTestValue ?? _window.viewInsets;
WindowPadding _viewInsetsTestValue; WindowPadding _viewInsetsTestValue;
...@@ -418,7 +402,6 @@ class TestWindow implements Window { ...@@ -418,7 +402,6 @@ class TestWindow implements Window {
clearLocalesTestValue(); clearLocalesTestValue();
clearPaddingTestValue(); clearPaddingTestValue();
clearPhysicalSizeTestValue(); clearPhysicalSizeTestValue();
clearPhysicalDepthTestValue();
clearSemanticsEnabledTestValue(); clearSemanticsEnabledTestValue();
clearTextScaleFactorTestValue(); clearTextScaleFactorTestValue();
clearViewInsetsTestValue(); clearViewInsetsTestValue();
......
...@@ -43,20 +43,6 @@ void main() { ...@@ -43,20 +43,6 @@ void main() {
); );
}); });
testWidgets('TestWindow can fake physical depth', (WidgetTester tester) async {
verifyThatTestWindowCanFakeProperty<double>(
tester: tester,
realValue: ui.window.physicalDepth,
fakeValue: 120.0,
propertyRetriever: () {
return WidgetsBinding.instance.window.physicalDepth;
},
propertyFaker: (TestWidgetsFlutterBinding binding, double fakeValue) {
binding.window.physicalDepthTestValue = fakeValue;
},
);
});
testWidgets('TestWindow can fake view insets', (WidgetTester tester) async { testWidgets('TestWindow can fake view insets', (WidgetTester tester) async {
verifyThatTestWindowCanFakeProperty<WindowPadding>( verifyThatTestWindowCanFakeProperty<WindowPadding>(
tester: tester, tester: tester,
......
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