|
2 | 2 | // Use of this source code is governed by a BSD-style license that can be
|
3 | 3 | // found in the LICENSE file.
|
4 | 4 |
|
5 |
| -import 'package:flutter/foundation.dart'; |
6 | 5 | import 'package:flutter/material.dart';
|
7 | 6 | import 'package:flutter_test/flutter_test.dart';
|
8 | 7 |
|
@@ -153,73 +152,17 @@ void main() {
|
153 | 152 | tester.state<NavigatorState>(find.byType(Navigator)).pushNamed('/next');
|
154 | 153 |
|
155 | 154 | await tester.pumpAndSettle();
|
156 |
| - final String? expectedLabel; |
157 |
| - switch(defaultTargetPlatform) { |
158 |
| - case TargetPlatform.android: |
159 |
| - expectedLabel = 'Back'; |
160 |
| - break; |
161 |
| - case TargetPlatform.fuchsia: |
162 |
| - case TargetPlatform.iOS: |
163 |
| - case TargetPlatform.linux: |
164 |
| - case TargetPlatform.macOS: |
165 |
| - case TargetPlatform.windows: |
166 |
| - expectedLabel = null; |
167 |
| - } |
| 155 | + |
168 | 156 | expect(tester.getSemantics(find.byType(BackButton)), matchesSemantics(
|
169 | 157 | tooltip: 'Back',
|
170 |
| - label: expectedLabel, |
171 |
| - isButton: true, |
172 |
| - hasEnabledState: true, |
173 |
| - isEnabled: true, |
174 |
| - hasTapAction: true, |
175 |
| - isFocusable: true, |
176 |
| - )); |
177 |
| - handle.dispose(); |
178 |
| - }, variant: TargetPlatformVariant.all()); |
179 |
| - |
180 |
| - testWidgets('CloseButton semantics', (WidgetTester tester) async { |
181 |
| - final SemanticsHandle handle = tester.ensureSemantics(); |
182 |
| - await tester.pumpWidget( |
183 |
| - MaterialApp( |
184 |
| - home: const Material(child: Text('Home')), |
185 |
| - routes: <String, WidgetBuilder>{ |
186 |
| - '/next': (BuildContext context) { |
187 |
| - return const Material( |
188 |
| - child: Center( |
189 |
| - child: CloseButton(), |
190 |
| - ), |
191 |
| - ); |
192 |
| - }, |
193 |
| - }, |
194 |
| - ), |
195 |
| - ); |
196 |
| - |
197 |
| - tester.state<NavigatorState>(find.byType(Navigator)).pushNamed('/next'); |
198 |
| - |
199 |
| - await tester.pumpAndSettle(); |
200 |
| - final String? expectedLabel; |
201 |
| - switch(defaultTargetPlatform) { |
202 |
| - case TargetPlatform.android: |
203 |
| - expectedLabel = 'Close'; |
204 |
| - break; |
205 |
| - case TargetPlatform.fuchsia: |
206 |
| - case TargetPlatform.iOS: |
207 |
| - case TargetPlatform.linux: |
208 |
| - case TargetPlatform.macOS: |
209 |
| - case TargetPlatform.windows: |
210 |
| - expectedLabel = null; |
211 |
| - } |
212 |
| - expect(tester.getSemantics(find.byType(CloseButton)), matchesSemantics( |
213 |
| - tooltip: 'Close', |
214 |
| - label: expectedLabel, |
215 | 158 | isButton: true,
|
216 | 159 | hasEnabledState: true,
|
217 | 160 | isEnabled: true,
|
218 | 161 | hasTapAction: true,
|
219 | 162 | isFocusable: true,
|
220 | 163 | ));
|
221 | 164 | handle.dispose();
|
222 |
| - }, variant: TargetPlatformVariant.all()); |
| 165 | + }); |
223 | 166 |
|
224 | 167 | testWidgets('CloseButton color', (WidgetTester tester) async {
|
225 | 168 | await tester.pumpWidget(
|
|
0 commit comments