правки по лаунчеру

This commit is contained in:
2026-07-28 20:43:53 +04:00
parent 155922a3f1
commit 0b6f7fc647
51 changed files with 3158 additions and 437 deletions
@@ -0,0 +1,142 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:moonwell_launcher/app/design_system/mw_launcher_components.dart';
import 'package:moonwell_launcher/app/theme/moonwell_design_system.dart';
void main() {
testWidgets('game rail shows WoW and MoonWell Karts', (tester) async {
await tester.pumpWidget(
MaterialApp(
theme: MoonWellTheme.create(MoonWellThemeVariant.forest),
home: const Scaffold(
body: SizedBox(width: 240, child: MwGameRail(username: 'Sindoring')),
),
),
);
expect(find.text('MOONWELL · WOW'), findsOneWidget);
expect(find.text('OPEN BETA'), findsOneWidget);
expect(find.text('S'), findsOneWidget);
expect(find.text('MOONWELL KARTS'), findsOneWidget);
expect(find.text('В РАЗРАБОТКЕ'), findsOneWidget);
expect(find.text('SOON'), findsNothing);
expect(find.textContaining('TIDES OF ELUNE'), findsNothing);
expect(find.textContaining('PROJECT VERGE'), findsNothing);
});
testWidgets('game rail settings button invokes settings callback', (
tester,
) async {
var settingsRequested = false;
await tester.pumpWidget(
MaterialApp(
theme: MoonWellTheme.create(MoonWellThemeVariant.forest),
home: Scaffold(
body: SizedBox(
width: 240,
child: MwGameRail(onSettings: () => settingsRequested = true),
),
),
),
);
await tester.tap(find.byTooltip('Настройки'));
expect(settingsRequested, isTrue);
});
testWidgets('sync area displays realm data received from API', (
tester,
) async {
await tester.pumpWidget(
MaterialApp(
theme: MoonWellTheme.create(MoonWellThemeVariant.forest),
home: const Scaffold(
body: SizedBox(
width: 1000,
height: 150,
child: MwSyncActionArea(
state: MwSyncPresentation.ready,
status: 'Клиент готов.',
realmName: 'MoonWell',
realmOnline: true,
realmGameBuild: 12340,
onPrimary: _noop,
),
),
),
),
);
expect(find.text('MOONWELL'), findsOneWidget);
expect(find.text('ONLINE · BUILD 12340'), findsOneWidget);
});
testWidgets('news item invokes its link callback when pressed', (
tester,
) async {
var pressed = false;
await tester.pumpWidget(
MaterialApp(
theme: MoonWellTheme.create(MoonWellThemeVariant.forest),
home: Scaffold(
body: MwNewsItem(
item: MwNewsItemData(
title: 'Update 1.2',
body: 'News body',
onPressed: () => pressed = true,
),
),
),
),
);
await tester.tap(find.text('Update 1.2'));
expect(pressed, isTrue);
});
testWidgets('account affordance displays username without balance', (
tester,
) async {
await tester.pumpWidget(
MaterialApp(
theme: MoonWellTheme.create(MoonWellThemeVariant.forest),
home: Scaffold(
body: MwAccountAffordance(username: 'PLAYERONE', onLogout: _noop),
),
),
);
expect(find.text('PLAYERONE'), findsOneWidget);
expect(find.textContaining('1250'), findsNothing);
expect(find.text('P'), findsOneWidget);
await tester.tap(find.byType(PopupMenuButton<String>));
await tester.pumpAndSettle();
expect(find.text('Выйти'), findsOneWidget);
expect(find.text('Настройки'), findsNothing);
});
testWidgets('settings panel excludes logout action', (tester) async {
await tester.pumpWidget(
MaterialApp(
theme: MoonWellTheme.create(MoonWellThemeVariant.forest),
home: Scaffold(
body: MwSettingsPanel(
installationPath: r'C:\Games\MoonWell',
onChooseDirectory: _noop,
onVerify: _noop,
),
),
),
);
expect(find.text('Выбрать папку'), findsOneWidget);
expect(find.text('Проверить файлы'), findsOneWidget);
expect(find.text('Выйти'), findsNothing);
});
}
void _noop() {}