Gitea CI / Check code and tests (push) Successful in 6m37s
Gitea CI / Build Windows x64 app (push) Successful in 3m18s
Gitea CI / Build Android APK (push) Successful in 3m47s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m7s
Gitea CI / Assemble and validate CI artifacts (push) Successful in 50s
Gitea CI / Gitea CI passed (push) Successful in 2s
Gitea Release / Prepare draft Release (push) Successful in 9s
Gitea Release / Upload Android to draft Release (push) Successful in 16s
Gitea Release / Upload Windows to draft Release (push) Successful in 22s
Gitea Release / Verify and publish Release (push) Successful in 14s
79 lines
2.9 KiB
Dart
79 lines
2.9 KiB
Dart
import 'package:cutdex/features/projects/sidebar_category_tabs.dart';
|
|
import 'package:cutdex/l10n/app_localizations.dart';
|
|
import 'package:cutdex_ui/theme.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
testWidgets('sidebar categories fit themes, narrow widths and large text', (
|
|
tester,
|
|
) async {
|
|
for (final palette in AppPalette.values) {
|
|
for (final brightness in Brightness.values) {
|
|
for (final locale in const [Locale('zh'), Locale('en'), Locale('de')]) {
|
|
for (final width in [120.0, 180.0, 280.0]) {
|
|
var media = false;
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: AppTheme.desktopWorkspaceTheme(
|
|
AppTheme.forPalette(palette, brightness),
|
|
),
|
|
locale: locale,
|
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
|
supportedLocales: AppLocalizations.supportedLocales,
|
|
home: Scaffold(
|
|
body: Align(
|
|
alignment: Alignment.topLeft,
|
|
child: SizedBox(
|
|
width: width,
|
|
child: MediaQuery(
|
|
data: const MediaQueryData(
|
|
textScaler: TextScaler.linear(2),
|
|
),
|
|
child: StatefulBuilder(
|
|
builder: (context, setState) => SidebarCategoryTabs(
|
|
mediaSelected: media,
|
|
onSelected: (value) =>
|
|
setState(() => media = value),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
final header = tester.getRect(
|
|
find.byKey(const Key('sidebar-category-header')),
|
|
);
|
|
final chat = tester.getRect(
|
|
find.byKey(const Key('sidebar-tab-chat')),
|
|
);
|
|
final resources = tester.getRect(
|
|
find.byKey(const Key('sidebar-tab-resources')),
|
|
);
|
|
expect(header.height, 36);
|
|
expect(chat.height, 28);
|
|
expect(resources.height, 28);
|
|
expect(chat.left - header.left, 12);
|
|
expect(header.right - resources.right, 12);
|
|
expect(resources.left - chat.right, 4);
|
|
await tester.tap(find.byKey(const Key('sidebar-tab-resources')));
|
|
await tester.pump();
|
|
expect(media, isTrue);
|
|
await tester.tap(find.byKey(const Key('sidebar-tab-chat')));
|
|
await tester.pump();
|
|
expect(media, isFalse);
|
|
expect(
|
|
tester.takeException(),
|
|
isNull,
|
|
reason: '$palette $brightness $locale width=$width',
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|