Files
sync_replay_project/apps/desktop/test/queue_panel_test.dart
T
foxyzandClaude Opus 5.5 4d00b7455e
ci / core (push) Successful in 27s
ci / server (push) Successful in 1m7s
ci / updater-windows (push) Failing after 6m4s
Restructure step 3: your server, Invite, version gate, AppGraph
- One server per app run (loopback, no password); Invite attaches an
  all-interfaces listener to the same server and Stop sharing detaches
  it (guests told with 4016); members, media and Up next never reset.
  No solo mode: you're home on your own server unless in a friend's.
- Navigation: none / yours / friend; a join passes a version gate on
  /health first (clear "they/you need to update", update offer).
- Invite as a value (host, port, name, password flag, version, fp
  reserved); addresses filtered (loopback, link-local, 198.18/15,
  bridges) and ranked; Sharing chip, Copy invite, Stop sharing.
- Alone looks like a plain player (alone replaces solo).
- AppGraph builds and disposes systems; widgets use AppScope;
  SessionState deleted; a test caps the remaining singletons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 22:52:52 +03:00

65 lines
2.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:starsync/src/queue/queue_ui.dart';
import 'package:starsync/src/session/session_coordinator.dart';
import 'package:starsync/src/shell/library_link.dart' show LinkPreview;
import 'package:starsync/src/widgets/text_focus.dart';
import 'test_graph.dart';
/// This file's composition root (see test_graph.dart).
final _graph = testGraph();
void main() {
testWidgets('Up next popover: holds the keys, Ctrl+V adds with a preview row, + Add link opens a field',
(tester) async {
final coord = SessionCoordinator();
var clip = (files: const <String>[], text: 'look https://example.com/v' as String?);
await tester.pumpWidget(scoped(_graph, MaterialApp(
theme: ThemeData.dark(),
home: Scaffold(
body: Center(
child: QueuePanel(
queue: coord.queue,
onClose: () {},
readClipboard: () async => clip,
preview: (url) async => const LinkPreview(title: 'A video', subtitle: 'example.com'),
),
),
),
)));
await tester.pump();
expect(textInputFocused(), isTrue, reason: 'the player keys rest while it is open');
expect(find.byKey(const ValueKey('queue-add-field')), findsNothing);
// Ctrl+V: the link goes in at once, as a row with its preview; not in
// a server here, so it says why.
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.keyV);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pump();
await tester.pump();
expect(find.text('A video'), findsOneWidget);
expect(find.text('not in a server'), findsOneWidget);
// Nothing to add on the clipboard.
clip = (files: const <String>[], text: 'just words');
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.keyV);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pump();
expect(find.byKey(const ValueKey('queue-add-error')), findsOneWidget);
// + Add link: a small field with focus; Esc closes it, focus stays.
await tester.tap(find.byKey(const ValueKey('queue-add-link')));
await tester.pump();
await tester.pump();
expect(find.byKey(const ValueKey('queue-add-field')), findsOneWidget);
await tester.sendKeyEvent(LogicalKeyboardKey.escape);
await tester.pump();
expect(find.byKey(const ValueKey('queue-add-field')), findsNothing);
expect(textInputFocused(), isTrue);
});
}