|
| 1 | +import 'package:flutter_test/flutter_test.dart'; |
| 2 | +import 'package:platform/platform.dart' as platform; |
| 3 | +import 'package:stackwallet/utilities/util.dart'; |
| 4 | + |
| 5 | +void main() { |
| 6 | + setUp(() { |
| 7 | + final previousPlatform = Util.layoutPlatform; |
| 8 | + final previousWidth = Util.screenWidth; |
| 9 | + final previousIsIpad = Util.isIpad; |
| 10 | + addTearDown(() { |
| 11 | + Util.layoutPlatform = previousPlatform; |
| 12 | + Util.screenWidth = previousWidth; |
| 13 | + Util.isIpad = previousIsIpad; |
| 14 | + }); |
| 15 | + }); |
| 16 | + |
| 17 | + for (final (os, width, ipad, desktop) in <(String, double?, bool, bool)>[ |
| 18 | + ('android', 390, false, false), |
| 19 | + ('android', 1000, false, false), |
| 20 | + ('ios', 390, false, false), |
| 21 | + ('ios', 1024, false, false), |
| 22 | + ('ios', 390, true, true), |
| 23 | + ('ios', 1024, true, true), |
| 24 | + ('macos', 390, false, true), |
| 25 | + ('windows', 390, false, true), |
| 26 | + ('linux', 799, false, false), |
| 27 | + ('linux', 800, false, true), |
| 28 | + ('linux', null, false, true), |
| 29 | + ]) { |
| 30 | + test('layout for $os at width $width with isIpad=$ipad', () { |
| 31 | + Util.layoutPlatform = platform.FakePlatform(operatingSystem: os); |
| 32 | + Util.screenWidth = width; |
| 33 | + Util.isIpad = ipad; |
| 34 | + |
| 35 | + expect(Util.isDesktop, desktop); |
| 36 | + }); |
| 37 | + } |
| 38 | +} |
0 commit comments