Files
BudgetApp/test/widget_test.dart
T
2025-08-02 15:25:25 +03:00

58 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:budget_app/l10n/app_localizations.dart';
void main() {
testWidgets('Basic Material app smoke test', (WidgetTester tester) async {
// Build a simple Material app with localization to test the basic setup
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('en'),
Locale('ru'),
],
home: const Scaffold(
body: Center(
child: Text('Budget App Test'),
),
),
),
);
// Verify that our test app loads
expect(find.text('Budget App Test'), findsOneWidget);
});
testWidgets('Localization setup works', (WidgetTester tester) async {
// Test that localization is properly set up
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('en'),
Locale('ru'),
],
locale: const Locale('en'),
home: const Scaffold(
body: Text('Test'),
),
),
);
// Should load without throwing localization errors
expect(find.text('Test'), findsOneWidget);
});
}