Ocideck/test/widget_test.dart
Brenno de Winter 2c4a6f7358
Some checks failed
CI / Format · Analyze · Test (push) Has been cancelled
CI / Format · Analyze · Test (pull_request) Has been cancelled
Sync presenter annotations live, keep styling out of saved .md
Presentation fixes:
- Mirror the in-progress pen/highlighter stroke to the audience window
  live (new 'inkLive' channel) so highlights appear as they are drawn,
  not only after the pen lifts.
- Cover the macOS menu bar on the beamer: raise the audience window
  above .mainMenu level so the Apple/Wi-Fi strip no longer shows during
  a presentation.

Styling no longer lives in the file:
- generateDeck no longer embeds the ThemeProfile; a saved .md holds only
  content. The profile is inlined only for the transient audience-window
  payload (inlineStyleProfile: true), never to disk.
- On open, the app applies the active style profile (FileService.openDeck
  / activeProfileFor, DeckNotifier.loadDeck); applyMarkdown preserves the
  current profile.

Quality pass / tests green:
- Complete the consent-screen translations (English plus 7 missing
  strings per other language).
- Pass the consent gate in widget/ui-scale tests by seeding the consent
  key, so the app shell renders.
- Update markdown round-trip tests for the new default and add coverage
  for live stroke streaming and styling-free saves.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 19:25:05 +02:00

56 lines
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/deck.dart';
import 'package:ocideck/models/slide.dart';
import 'package:ocideck/state/tabs_provider.dart';
import 'package:ocideck/widgets/app_shell.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() {
setUp(() {
// Past the consent gate so the app shell renders. We only seed the consent
// key, never wiping the whole prefs domain other tests may rely on.
SharedPreferences.setMockInitialValues({'app_consent_accepted': true});
});
testWidgets('Welcome screen shows startup logo', (WidgetTester tester) async {
await tester.pumpWidget(const ProviderScope(child: OciDeckApp()));
await tester.pumpAndSettle();
expect(
find.bySemanticsLabel('De Winter Information Solutions'),
findsOneWidget,
);
});
testWidgets('Welcome screen exposes settings', (WidgetTester tester) async {
await tester.pumpWidget(const ProviderScope(child: OciDeckApp()));
await tester.pumpAndSettle();
expect(find.byIcon(Icons.settings_outlined), findsOneWidget);
});
testWidgets('the only open presentation can be closed', (tester) async {
await tester.binding.setSurfaceSize(const Size(1600, 1000));
addTearDown(() => tester.binding.setSurfaceSize(null));
await tester.pumpWidget(const ProviderScope(child: OciDeckApp()));
await tester.pumpAndSettle();
final container = ProviderScope.containerOf(
tester.element(find.byType(AppShell)),
);
final tab = container.read(tabsProvider).current!;
tab.deckNotifier.loadDeck(
Deck(
title: 'Test',
slides: [Slide.create(SlideType.title).copyWith(title: 'Test')],
),
);
await tester.pump();
expect(find.byIcon(Icons.close), findsOneWidget);
await tester.tap(find.byIcon(Icons.close));
await tester.pump();
expect(container.read(tabsProvider).current!.isOpen, isFalse);
});
}