|
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/rendering.dart'; |
8 | 7 | import 'package:flutter_test/flutter_test.dart'; |
@@ -241,7 +240,7 @@ void main() { |
241 | 240 | await tester.pumpWidget(buildAppBar(textScaleFactor: 3.0)); |
242 | 241 | expect(tester.getRect(expandedTitle).height, 43.0); |
243 | 242 | verifyTextNotClipped(expandedTitle, tester); |
244 | | - }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 |
| 243 | + }); |
245 | 244 |
|
246 | 245 | testWidgets('SliverAppBar.large expanded title has upper limit on text scaling', ( |
247 | 246 | WidgetTester tester, |
@@ -275,46 +274,44 @@ void main() { |
275 | 274 |
|
276 | 275 | await tester.pumpWidget(buildAppBar(textScaleFactor: 3.0)); |
277 | 276 | expect(tester.getRect(expandedTitle).height, closeTo(48.0, 0.1)); |
278 | | - }, skip: kIsWeb && !isSkiaWeb); // https://github.com/flutter/flutter/issues/99933 |
279 | | - |
280 | | - testWidgets( |
281 | | - 'SliverAppBar.medium expanded title position is adjusted with textScaleFactor', |
282 | | - (WidgetTester tester) async { |
283 | | - const String title = 'Medium AppBar'; |
284 | | - Widget buildAppBar({double textScaleFactor = 1.0}) { |
285 | | - return MaterialApp( |
286 | | - theme: ThemeData(useMaterial3: true), |
287 | | - home: MediaQuery.withClampedTextScaling( |
288 | | - minScaleFactor: textScaleFactor, |
289 | | - maxScaleFactor: textScaleFactor, |
290 | | - child: Material( |
291 | | - child: CustomScrollView( |
292 | | - slivers: <Widget>[ |
293 | | - const SliverAppBar.medium(title: Text(title, maxLines: 1)), |
294 | | - SliverToBoxAdapter(child: Container(height: 1200, color: Colors.orange[400])), |
295 | | - ], |
296 | | - ), |
| 277 | + }); |
| 278 | + |
| 279 | + testWidgets('SliverAppBar.medium expanded title position is adjusted with textScaleFactor', ( |
| 280 | + WidgetTester tester, |
| 281 | + ) async { |
| 282 | + const String title = 'Medium AppBar'; |
| 283 | + Widget buildAppBar({double textScaleFactor = 1.0}) { |
| 284 | + return MaterialApp( |
| 285 | + theme: ThemeData(useMaterial3: true), |
| 286 | + home: MediaQuery.withClampedTextScaling( |
| 287 | + minScaleFactor: textScaleFactor, |
| 288 | + maxScaleFactor: textScaleFactor, |
| 289 | + child: Material( |
| 290 | + child: CustomScrollView( |
| 291 | + slivers: <Widget>[ |
| 292 | + const SliverAppBar.medium(title: Text(title, maxLines: 1)), |
| 293 | + SliverToBoxAdapter(child: Container(height: 1200, color: Colors.orange[400])), |
| 294 | + ], |
297 | 295 | ), |
298 | 296 | ), |
299 | | - ); |
300 | | - } |
| 297 | + ), |
| 298 | + ); |
| 299 | + } |
301 | 300 |
|
302 | | - await tester.pumpWidget(buildAppBar()); |
| 301 | + await tester.pumpWidget(buildAppBar()); |
303 | 302 |
|
304 | | - final Finder expandedTitle = find.text(title).first; |
305 | | - expect(tester.getBottomLeft(expandedTitle).dy, 96.0); |
306 | | - verifyTextNotClipped(expandedTitle, tester); |
| 303 | + final Finder expandedTitle = find.text(title).first; |
| 304 | + expect(tester.getBottomLeft(expandedTitle).dy, 96.0); |
| 305 | + verifyTextNotClipped(expandedTitle, tester); |
307 | 306 |
|
308 | | - await tester.pumpWidget(buildAppBar(textScaleFactor: 2.0)); |
309 | | - expect(tester.getBottomLeft(expandedTitle).dy, 107.0); |
310 | | - verifyTextNotClipped(expandedTitle, tester); |
| 307 | + await tester.pumpWidget(buildAppBar(textScaleFactor: 2.0)); |
| 308 | + expect(tester.getBottomLeft(expandedTitle).dy, 107.0); |
| 309 | + verifyTextNotClipped(expandedTitle, tester); |
311 | 310 |
|
312 | | - await tester.pumpWidget(buildAppBar(textScaleFactor: 3.0)); |
313 | | - expect(tester.getBottomLeft(expandedTitle).dy, 107.0); |
314 | | - verifyTextNotClipped(expandedTitle, tester); |
315 | | - }, |
316 | | - skip: kIsWeb && !isSkiaWeb, // https://github.com/flutter/flutter/issues/99933 |
317 | | - ); |
| 311 | + await tester.pumpWidget(buildAppBar(textScaleFactor: 3.0)); |
| 312 | + expect(tester.getBottomLeft(expandedTitle).dy, 107.0); |
| 313 | + verifyTextNotClipped(expandedTitle, tester); |
| 314 | + }); |
318 | 315 |
|
319 | 316 | testWidgets('SliverAppBar.large expanded title position is adjusted with textScaleFactor', ( |
320 | 317 | WidgetTester tester, |
@@ -1264,9 +1261,7 @@ void main() { |
1264 | 1261 | // Test the expanded title is positioned correctly. |
1265 | 1262 | final Offset titleOffset = tester.getBottomLeft(expandedTitle); |
1266 | 1263 | expect(titleOffset.dx, 16.0); |
1267 | | - if (!kIsWeb || isSkiaWeb) { |
1268 | | - expect(titleOffset.dy, 96.0); |
1269 | | - } |
| 1264 | + expect(titleOffset.dy, 96.0); |
1270 | 1265 |
|
1271 | 1266 | verifyTextNotClipped(expandedTitle, tester); |
1272 | 1267 |
|
|
0 commit comments