Tests / test (push) Canceled after 0s
Build Android (FCM) / build-android-fcm (push) Canceled after 0s
Build Android / build-android (push) Canceled after 0s
Build iOS / build-ios (push) Canceled after 0s
Build Linux / build-linux (push) Canceled after 0s
Build macOS / build-macos (push) Canceled after 0s
Build Windows / build-windows (push) Canceled after 0s
Native crypto / native-crypto (push) Canceled after 0s
Release (main) / android (oneme) (push) Canceled after 0s
Release (main) / android (qlyra) (push) Canceled after 0s
Release (main) / windows (push) Canceled after 0s
Release (main) / linux (push) Canceled after 0s
Release (main) / macos (push) Canceled after 0s
Release (main) / ios (push) Canceled after 0s
Release (main) / release (push) Canceled after 0s
85 lines
2.9 KiB
Dart
85 lines
2.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:ikar/core/config/app_bottom_navigation_style.dart';
|
|
import 'package:ikar/frontend/widgets/compact_bottom_navigation_bar.dart';
|
|
import 'package:ikar/frontend/widgets/bottom_navigation_style_card.dart';
|
|
import 'package:ikar/frontend/widgets/sliding_pill_nav.dart';
|
|
import 'package:ikar/l10n/app_localizations.dart';
|
|
|
|
void main() {
|
|
TestWidgetsFlutterBinding.ensureInitialized();
|
|
setUp(() {
|
|
SharedPreferences.setMockInitialValues({});
|
|
AppBottomNavigationStyle.current.value = BottomNavigationStyle.floating;
|
|
});
|
|
testWidgets(
|
|
'compact tabs retain badge, selection and account long press at large text size',
|
|
(tester) async {
|
|
var selected = -1;
|
|
var held = -1;
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
home: MediaQuery(
|
|
data: const MediaQueryData(
|
|
size: Size(320, 640),
|
|
textScaler: TextScaler.linear(2),
|
|
),
|
|
child: Scaffold(
|
|
bottomNavigationBar: CompactBottomNavigationBar(
|
|
items: const [
|
|
PillNavItem(
|
|
icon: Icons.chat,
|
|
label: 'Чаты',
|
|
unreadCount: 120,
|
|
),
|
|
PillNavItem(icon: Icons.call, label: 'Звонки'),
|
|
PillNavItem(icon: Icons.people, label: 'Контакты'),
|
|
PillNavItem(
|
|
icon: Icons.settings,
|
|
label: 'Настройки',
|
|
longPressable: true,
|
|
),
|
|
],
|
|
currentIndex: 0,
|
|
onTap: (index) => selected = index,
|
|
onItemLongPress: (index, _) => held = index,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
expect(find.text('99+'), findsOneWidget);
|
|
await tester.tap(find.byIcon(Icons.call));
|
|
expect(selected, 1);
|
|
await tester.longPress(find.byIcon(Icons.settings));
|
|
expect(held, 3);
|
|
expect(tester.takeException(), isNull);
|
|
},
|
|
);
|
|
testWidgets('appearance setting persists and restores compact layout', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
const MaterialApp(
|
|
locale: Locale('ru'),
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
home: Scaffold(body: BottomNavigationStyleCard()),
|
|
),
|
|
);
|
|
await tester.tap(find.text('Компактная'));
|
|
await tester.pumpAndSettle();
|
|
expect(
|
|
AppBottomNavigationStyle.current.value,
|
|
BottomNavigationStyle.compact,
|
|
);
|
|
AppBottomNavigationStyle.current.value = BottomNavigationStyle.floating;
|
|
await AppBottomNavigationStyle.load();
|
|
expect(
|
|
AppBottomNavigationStyle.current.value,
|
|
BottomNavigationStyle.compact,
|
|
);
|
|
});
|
|
}
|