Ocideck/test/ui_text_scale_test.dart
Brenno de Winter 68725341a7 Add image-library dedupe and untagged filter, UI text scaling, table paste
Image library:
- "Clean up duplicates" finds byte-identical images by md5, keeps one
  file per group (preferring the most-used, then the oldest), merges
  the tags/descriptions and captions of the copies, repoints slides in
  open decks and in .md presentations on disk, and deletes the copies
  after a confirmation that lists every group.
- A header toggle filters to images without tags/description, so it is
  easy to see which ones still need attention.
- The delete warning now also lists presentations on disk that still
  reference the image (marked "not open"), next to the open decks.

Editor and accessibility (already in tree):
- Interface text scaling up to 200%, keyboard-operable panel divider,
  keyboard-first add-slide dialog, and screen-reader improvements.
- Paste a spreadsheet/CSV/markdown selection into a table cell to fill
  the whole grid.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 13:36:44 +02:00

66 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:ocideck/app.dart';
import 'package:ocideck/models/slide.dart';
import 'package:ocideck/state/settings_provider.dart';
import 'package:ocideck/widgets/app_shell.dart';
import 'package:ocideck/widgets/slides/slide_preview.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() {
testWidgets('the interface text-scale setting scales the editor UI', (
tester,
) async {
SharedPreferences.setMockInitialValues({});
await tester.pumpWidget(const ProviderScope(child: OciDeckApp()));
await tester.pump();
final container = ProviderScope.containerOf(
tester.element(find.byType(AppShell)),
);
TextScaler scalerAtShell() =>
MediaQuery.textScalerOf(tester.element(find.byType(AppShell)));
expect(scalerAtShell().scale(10), 10);
await container.read(settingsProvider.notifier).setUiTextScale(1.5);
await tester.pump();
expect(scalerAtShell().scale(10), 15);
// The setting is clamped to WCAG's 200%.
await container.read(settingsProvider.notifier).setUiTextScale(5.0);
await tester.pump();
expect(scalerAtShell().scale(10), 20);
});
testWidgets('the slide canvas opts out of text scaling', (tester) async {
final slide = Slide.create(
SlideType.bullets,
).copyWith(title: 'Titel', bullets: const ['Punt een']);
await tester.pumpWidget(
MaterialApp(
builder: (context, child) => MediaQuery(
data: MediaQuery.of(
context,
).copyWith(textScaler: const TextScaler.linear(2)),
child: child!,
),
home: Scaffold(
body: SizedBox(
width: 800,
height: 450,
child: SlidePreviewWidget(slide: slide),
),
),
),
);
await tester.pump();
// The slide is a fixed design surface: its text must render unscaled so
// the auto-fit measuring stays truthful.
final inSlide = MediaQuery.textScalerOf(
tester.element(find.text('Punt een')),
);
expect(inSlide.scale(10), 10);
});
}