Objavljen vir
Prenos vir ZIP
CH-J SM Mobile
Brskajte po imenikih in datotekah za določeno izdajo programa.
CH-J / SM Mobile
134 datoteke
sm-mobile-20261016T050549Z-3678f2a05fa9
Dodano: · Zgrajena:
1
import 'package:flutter/material.dart';2
import 'package:flutter_test/flutter_test.dart';3
import 'package:sm_mobile/core/app_controller.dart';4
import 'package:sm_mobile/l10n/strings.dart';5
import 'package:sm_mobile/main.dart';6
import 'package:sm_mobile/models/server_profile.dart';7
import 'package:sm_mobile/ui/profile_editor.dart';8
import 'support.dart';10
void main() {11
for (final locale in ['cs', 'de', 'en']) {12
testWidgets('onboarding gates server access and localizes $locale', (13
tester,14
) async {15
final c = AppController(MemoryStore());16
await tester.runAsync(() => c.initialize());17
c.locale = Locale(locale);18
await tester.pumpWidget(SmMobileApp(c));19
await tester.pumpAndSettle();20
final ctx = tester.element(find.byType(Scaffold).first);21
expect(find.text(ctx.tr('guidance')), findsOneWidget);22
expect(find.text(ctx.tr('addServer')), findsNothing);23
await tester.ensureVisible(find.text(ctx.tr('continueAction')));24
await tester.pumpAndSettle();25
await tester.tap(find.text(ctx.tr('continueAction')));26
await tester.pumpAndSettle();27
final accept = tester.widget<FilledButton>(28
find.widgetWithText(FilledButton, ctx.tr('accept')),29
);30
expect(accept.onPressed, null);31
await tester.ensureVisible(find.text(ctx.tr('decline')));32
await tester.pumpAndSettle();33
await tester.tap(find.text(ctx.tr('decline')));34
await tester.pumpAndSettle();35
expect(find.text(ctx.tr('licenseDeclined')), findsOneWidget);36
expect(c.accepted, false);37
await tester.pumpWidget(const SizedBox());38
c.dispose();39
});40
}41
testWidgets('onboarding remains usable in landscape with large text', (42
tester,43
) async {44
tester.view.physicalSize = const Size(740, 340);45
tester.view.devicePixelRatio = 1;46
tester.platformDispatcher.textScaleFactorTestValue = 2;47
addTearDown(() {48
tester.view.resetPhysicalSize();49
tester.view.resetDevicePixelRatio();50
tester.platformDispatcher.clearTextScaleFactorTestValue();51
});52
final c = AppController(MemoryStore());53
await tester.runAsync(() => c.initialize());54
await tester.pumpWidget(SmMobileApp(c));55
await tester.pumpAndSettle();56
expect(tester.takeException(), null);57
await tester.pumpWidget(const SizedBox());58
c.dispose();59
});60
testWidgets('profile editor renders required inputs and auth picker', (61
tester,62
) async {63
final c = AppController(MemoryStore());64
await tester.pumpWidget(65
MaterialApp(66
localizationsDelegates: AppLocalizations.localizationsDelegates,67
supportedLocales: AppLocalizations.supportedLocales,68
home: ProfileEditor(c),69
),70
);71
await tester.pumpAndSettle();72
expect(find.byType(TextField), findsNWidgets(4));73
expect(find.byType(DropdownButtonFormField<AuthMethod>), findsOneWidget);74
await tester.pumpWidget(const SizedBox());75
c.dispose();76
});77
test('all three locales provide identical nonempty message sets', () async {78
final en = await AppLocalizations.delegate.load(const Locale('en'));79
final cs = await AppLocalizations.delegate.load(const Locale('cs'));80
final de = await AppLocalizations.delegate.load(const Locale('de'));81
expect({en.hostChanged, cs.hostChanged, de.hostChanged}.length, 3);82
for (final l in [en, cs, de]) {83
expect(l.consent, contains('1.14'));84
expect(l.unsafePath, isNotEmpty);85
}86
});87
}SHA-256
8282f4da858dfb9c3e2f7afea34f4307aa315626648892f3d63054c496238fa6CH-J Proprietary Software License 1.14 · Vir je na voljo pod CH-J Proprietary Software License 1.14. Njena razpoložljivost ne spreminja pogojev licence ali dodeljuje dodatnih pravic.
Arhiv SHA-256
c486a807e4828998b9c57ab0f2e760f7980b31965fe118e89d3e1a5a2b65be65