Unverified Commit 7ff3a50f authored by Miguel Beltran's avatar Miguel Beltran Committed by GitHub

Set highContrast value from AccessibilityFeatures into MediaQueryData (#48811)

parent 9da15d8f
...@@ -124,7 +124,7 @@ class MediaQueryData { ...@@ -124,7 +124,7 @@ class MediaQueryData {
invertColors = window.accessibilityFeatures.invertColors, invertColors = window.accessibilityFeatures.invertColors,
disableAnimations = window.accessibilityFeatures.disableAnimations, disableAnimations = window.accessibilityFeatures.disableAnimations,
boldText = window.accessibilityFeatures.boldText, boldText = window.accessibilityFeatures.boldText,
highContrast = false, highContrast = window.accessibilityFeatures.highContrast,
alwaysUse24HourFormat = window.alwaysUse24HourFormat; alwaysUse24HourFormat = window.alwaysUse24HourFormat;
/// The size of the media in logical pixels (e.g, the size of the screen). /// The size of the media in logical pixels (e.g, the size of the screen).
......
...@@ -67,6 +67,7 @@ void main() { ...@@ -67,6 +67,7 @@ void main() {
expect(data.invertColors, false); expect(data.invertColors, false);
expect(data.disableAnimations, false); expect(data.disableAnimations, false);
expect(data.boldText, false); expect(data.boldText, false);
expect(data.highContrast, false);
expect(data.platformBrightness, Brightness.light); expect(data.platformBrightness, Brightness.light);
expect(data.physicalDepth, equals(WidgetsBinding.instance.window.physicalDepth)); expect(data.physicalDepth, equals(WidgetsBinding.instance.window.physicalDepth));
}); });
...@@ -87,6 +88,7 @@ void main() { ...@@ -87,6 +88,7 @@ void main() {
expect(copied.invertColors, data.invertColors); expect(copied.invertColors, data.invertColors);
expect(copied.disableAnimations, data.disableAnimations); expect(copied.disableAnimations, data.disableAnimations);
expect(copied.boldText, data.boldText); expect(copied.boldText, data.boldText);
expect(copied.highContrast, data.highContrast);
expect(copied.platformBrightness, data.platformBrightness); expect(copied.platformBrightness, data.platformBrightness);
}); });
...@@ -117,6 +119,7 @@ void main() { ...@@ -117,6 +119,7 @@ void main() {
invertColors: true, invertColors: true,
disableAnimations: true, disableAnimations: true,
boldText: true, boldText: true,
highContrast: true,
platformBrightness: Brightness.dark, platformBrightness: Brightness.dark,
); );
expect(copied.size, customSize); expect(copied.size, customSize);
...@@ -132,6 +135,7 @@ void main() { ...@@ -132,6 +135,7 @@ void main() {
expect(copied.invertColors, true); expect(copied.invertColors, true);
expect(copied.disableAnimations, true); expect(copied.disableAnimations, true);
expect(copied.boldText, true); expect(copied.boldText, true);
expect(copied.highContrast, true);
expect(copied.platformBrightness, Brightness.dark); expect(copied.platformBrightness, Brightness.dark);
}); });
...@@ -158,6 +162,7 @@ void main() { ...@@ -158,6 +162,7 @@ void main() {
invertColors: true, invertColors: true,
disableAnimations: true, disableAnimations: true,
boldText: true, boldText: true,
highContrast: true,
), ),
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
...@@ -190,6 +195,7 @@ void main() { ...@@ -190,6 +195,7 @@ void main() {
expect(unpadded.invertColors, true); expect(unpadded.invertColors, true);
expect(unpadded.disableAnimations, true); expect(unpadded.disableAnimations, true);
expect(unpadded.boldText, true); expect(unpadded.boldText, true);
expect(unpadded.highContrast, true);
}); });
testWidgets('MediaQuery.removePadding only removes specified padding', (WidgetTester tester) async { testWidgets('MediaQuery.removePadding only removes specified padding', (WidgetTester tester) async {
...@@ -215,6 +221,7 @@ void main() { ...@@ -215,6 +221,7 @@ void main() {
invertColors: true, invertColors: true,
disableAnimations: true, disableAnimations: true,
boldText: true, boldText: true,
highContrast: true,
), ),
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
...@@ -244,6 +251,7 @@ void main() { ...@@ -244,6 +251,7 @@ void main() {
expect(unpadded.invertColors, true); expect(unpadded.invertColors, true);
expect(unpadded.disableAnimations, true); expect(unpadded.disableAnimations, true);
expect(unpadded.boldText, true); expect(unpadded.boldText, true);
expect(unpadded.highContrast, true);
}); });
testWidgets('MediaQuery.removeViewInsets removes specified viewInsets', (WidgetTester tester) async { testWidgets('MediaQuery.removeViewInsets removes specified viewInsets', (WidgetTester tester) async {
...@@ -269,6 +277,7 @@ void main() { ...@@ -269,6 +277,7 @@ void main() {
invertColors: true, invertColors: true,
disableAnimations: true, disableAnimations: true,
boldText: true, boldText: true,
highContrast: true,
), ),
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
...@@ -301,6 +310,7 @@ void main() { ...@@ -301,6 +310,7 @@ void main() {
expect(unpadded.invertColors, true); expect(unpadded.invertColors, true);
expect(unpadded.disableAnimations, true); expect(unpadded.disableAnimations, true);
expect(unpadded.boldText, true); expect(unpadded.boldText, true);
expect(unpadded.highContrast, true);
}); });
testWidgets('MediaQuery.removeViewInsets removes only specified viewInsets', (WidgetTester tester) async { testWidgets('MediaQuery.removeViewInsets removes only specified viewInsets', (WidgetTester tester) async {
...@@ -326,6 +336,7 @@ void main() { ...@@ -326,6 +336,7 @@ void main() {
invertColors: true, invertColors: true,
disableAnimations: true, disableAnimations: true,
boldText: true, boldText: true,
highContrast: true,
), ),
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
...@@ -355,6 +366,7 @@ void main() { ...@@ -355,6 +366,7 @@ void main() {
expect(unpadded.invertColors, true); expect(unpadded.invertColors, true);
expect(unpadded.disableAnimations, true); expect(unpadded.disableAnimations, true);
expect(unpadded.boldText, true); expect(unpadded.boldText, true);
expect(unpadded.highContrast, true);
}); });
testWidgets('MediaQuery.removeViewPadding removes specified viewPadding', (WidgetTester tester) async { testWidgets('MediaQuery.removeViewPadding removes specified viewPadding', (WidgetTester tester) async {
...@@ -380,6 +392,7 @@ void main() { ...@@ -380,6 +392,7 @@ void main() {
invertColors: true, invertColors: true,
disableAnimations: true, disableAnimations: true,
boldText: true, boldText: true,
highContrast: true,
), ),
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
...@@ -412,6 +425,7 @@ void main() { ...@@ -412,6 +425,7 @@ void main() {
expect(unpadded.invertColors, true); expect(unpadded.invertColors, true);
expect(unpadded.disableAnimations, true); expect(unpadded.disableAnimations, true);
expect(unpadded.boldText, true); expect(unpadded.boldText, true);
expect(unpadded.highContrast, true);
}); });
testWidgets('MediaQuery.removeViewPadding removes only specified viewPadding', (WidgetTester tester) async { testWidgets('MediaQuery.removeViewPadding removes only specified viewPadding', (WidgetTester tester) async {
...@@ -437,6 +451,7 @@ void main() { ...@@ -437,6 +451,7 @@ void main() {
invertColors: true, invertColors: true,
disableAnimations: true, disableAnimations: true,
boldText: true, boldText: true,
highContrast: true,
), ),
child: Builder( child: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
...@@ -466,6 +481,7 @@ void main() { ...@@ -466,6 +481,7 @@ void main() {
expect(unpadded.invertColors, true); expect(unpadded.invertColors, true);
expect(unpadded.disableAnimations, true); expect(unpadded.disableAnimations, true);
expect(unpadded.boldText, true); expect(unpadded.boldText, true);
expect(unpadded.highContrast, true);
}); });
testWidgets('MediaQuery.textScaleFactorOf', (WidgetTester tester) async { testWidgets('MediaQuery.textScaleFactorOf', (WidgetTester tester) async {
......
...@@ -256,6 +256,7 @@ class FakeAccessibilityFeatures implements AccessibilityFeatures { ...@@ -256,6 +256,7 @@ class FakeAccessibilityFeatures implements AccessibilityFeatures {
this.disableAnimations = false, this.disableAnimations = false,
this.boldText = false, this.boldText = false,
this.reduceMotion = false, this.reduceMotion = false,
this.highContrast = false,
}); });
@override @override
...@@ -273,6 +274,9 @@ class FakeAccessibilityFeatures implements AccessibilityFeatures { ...@@ -273,6 +274,9 @@ class FakeAccessibilityFeatures implements AccessibilityFeatures {
@override @override
final bool reduceMotion; final bool reduceMotion;
@override
final bool highContrast;
/// This gives us some grace time when the dart:ui side adds something to /// This gives us some grace time when the dart:ui side adds something to
/// [AccessibilityFeatures], and makes things easier when we do rolls to /// [AccessibilityFeatures], and makes things easier when we do rolls to
/// give us time to catch up. /// give us time to catch up.
......
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