Ocideck/test/export_dialog_test.dart
Brenno de Winter e63679978b Bundle EB Garamond font and add PDF export options
Privacy: replace the runtime google_fonts fetch with a locally bundled
EB Garamond (variable TTFs + OFL license), so the app no longer contacts
Google's servers. Removes the google_fonts dependency.

PDF export:
- Add a normal/compressed image-quality choice in the export dialog.
  Compressed re-encodes slides as JPEG (q60) at 1280px for a small handout,
  saved as a separate "-compact" file.
- Add a configurable export directory (Settings → Exportmap); when unset,
  exports land next to the deck as before.
- Prefix every export with a UTC timestamp (YYYYMMDDHHMMSS) so exports sort
  chronologically and never overwrite each other.

Tests: export service (compression, output dir, timestamp) and an export
dialog widget test asserting the quality choice renders.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 15:03:27 +02:00

37 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ocideck/models/settings.dart';
import 'package:ocideck/services/export_service.dart';
import 'package:ocideck/widgets/dialogs/export_dialog.dart';
void main() {
testWidgets('export dialog offers a normal/compressed image choice', (
tester,
) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: ExportDialog(
deckPath: '/tmp/deck.md',
slides: const [],
themeProfile: const ThemeProfile(),
projectPath: null,
exportService: ExportService(),
),
),
),
);
// The image-quality selector and both options must be visible on open.
expect(find.text('Afbeeldingskwaliteit (PDF)'), findsOneWidget);
expect(
find.widgetWithText(SegmentedButton<bool>, 'Normaal'),
findsOneWidget,
);
expect(
find.widgetWithText(SegmentedButton<bool>, 'Gecomprimeerd'),
findsOneWidget,
);
expect(find.text('Exporteer als PDF'), findsOneWidget);
});
}