@@ -10,13 +10,11 @@ import 'package:flutter_test/flutter_test.dart';
10
10
11
11
void main () {
12
12
// Constants taken from _ContextMenuActionState.
13
- const CupertinoDynamicColor kBackgroundColor =
14
- CupertinoDynamicColor .withBrightness (
13
+ const CupertinoDynamicColor kBackgroundColor = CupertinoDynamicColor .withBrightness (
15
14
color: Color (0xFFF1F1F1 ),
16
15
darkColor: Color (0xFF212122 ),
17
16
);
18
- const CupertinoDynamicColor kBackgroundColorPressed =
19
- CupertinoDynamicColor .withBrightness (
17
+ const CupertinoDynamicColor kBackgroundColorPressed = CupertinoDynamicColor .withBrightness (
20
18
color: Color (0xFFDDDDDD ),
21
19
darkColor: Color (0xFF3F3F40 ),
22
20
);
@@ -117,24 +115,33 @@ void main() {
117
115
paints..rect (color: kBackgroundColor.darkColor));
118
116
});
119
117
120
- testWidgets ('icon and textStyle colors are correct out of the box' ,
121
- (WidgetTester tester) async {
118
+ testWidgets ('icon and textStyle colors are correct out of the box' , (WidgetTester tester) async {
122
119
await tester.pumpWidget (getApp ());
123
120
expect (getTextStyle (tester).color, CupertinoColors .label);
124
121
expect (getIcon (tester).color, CupertinoColors .label);
125
122
});
126
123
127
- testWidgets ('icon and textStyle colors are correct for destructive actions' ,
128
- (WidgetTester tester) async {
124
+ testWidgets ('icon and textStyle colors are correct for destructive actions' , (WidgetTester tester) async {
129
125
await tester.pumpWidget (getApp (isDestructiveAction: true ));
130
126
expect (getTextStyle (tester).color, kDestructiveActionColor);
131
127
expect (getIcon (tester).color, kDestructiveActionColor);
132
128
});
133
129
134
- testWidgets ('textStyle is correct for defaultAction' ,
135
- (WidgetTester tester) async {
130
+ testWidgets ('textStyle is correct for defaultAction for Brightness.light' , (WidgetTester tester) async {
136
131
await tester.pumpWidget (getApp (isDefaultAction: true ));
137
132
expect (getTextStyle (tester).fontWeight, kDefaultActionWeight);
133
+ final Element context = tester.element (find.byType (CupertinoContextMenuAction ));
134
+ // The dynamic color should have been resolved.
135
+ expect (getTextStyle (tester).color, CupertinoColors .label.resolveFrom (context));
136
+ });
137
+
138
+ testWidgets ('textStyle is correct for defaultAction for Brightness.dark' , (WidgetTester tester) async {
139
+ // Regression test for https://github.com/flutter/flutter/issues/144492.
140
+ await tester.pumpWidget (getApp (isDefaultAction: true , brightness: Brightness .dark));
141
+ expect (getTextStyle (tester).fontWeight, kDefaultActionWeight);
142
+ final Element context = tester.element (find.byType (CupertinoContextMenuAction ));
143
+ // The dynamic color should have been resolved.
144
+ expect (getTextStyle (tester).color, CupertinoColors .label.resolveFrom (context));
138
145
});
139
146
140
147
testWidgets (
0 commit comments