81 lines
2.4 KiB
Dart
81 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:moonwell_launcher/app/design_system/mw_shells.dart';
|
|
import 'package:moonwell_launcher/app/launcher_version.dart';
|
|
import 'package:moonwell_launcher/app/theme/moonwell_design_system.dart';
|
|
|
|
void main() {
|
|
testWidgets('brand mark fits its requested width without overflow', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: MoonWellTheme.create(MoonWellThemeVariant.forest),
|
|
home: const Scaffold(body: Center(child: MwBrandMark(width: 220))),
|
|
),
|
|
);
|
|
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
|
|
testWidgets('login shell renders the key art asset', (tester) async {
|
|
await tester.binding.setSurfaceSize(const Size(1280, 720));
|
|
addTearDown(() => tester.binding.setSurfaceSize(null));
|
|
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: MoonWellTheme.create(MoonWellThemeVariant.forest),
|
|
home: LauncherVersionScope(
|
|
version: '9.8.7',
|
|
child: MwLoginShell(
|
|
form: const SizedBox(),
|
|
onDrag: _noop,
|
|
onDoubleTap: _noop,
|
|
onMinimize: _noop,
|
|
onMaximizeRestore: _noop,
|
|
onClose: _noop,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
final image = tester.widget<Image>(find.byType(Image));
|
|
expect((image.image as AssetImage).assetName, 'assets/login_key_art.png');
|
|
expect(find.textContaining('9.8.7'), findsOneWidget);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
|
|
testWidgets('launcher shell renders the main key art asset', (tester) async {
|
|
await tester.binding.setSurfaceSize(const Size(1280, 720));
|
|
addTearDown(() => tester.binding.setSurfaceSize(null));
|
|
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: MoonWellTheme.create(MoonWellThemeVariant.forest),
|
|
home: const MwLauncherShell(
|
|
news: SizedBox(),
|
|
syncActions: SizedBox(),
|
|
statusBar: SizedBox(),
|
|
account: SizedBox(),
|
|
onDrag: _noop,
|
|
onDoubleTap: _noop,
|
|
onMinimize: _noop,
|
|
onMaximizeRestore: _noop,
|
|
onClose: _noop,
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
final image = tester.widget<Image>(find.byType(Image));
|
|
expect(
|
|
(image.image as AssetImage).assetName,
|
|
'assets/launcher_key_art.png',
|
|
);
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
}
|
|
|
|
void _noop() {}
|