Stabilisation quick fixes: orderly close, visible version and update band, chat pop-ups on, Windows shaders and hwdec, render logs
- Close: hide the window, dispose every player, thumbnail job and the sound engine, leave, then close normally; Linux runner _exit (the NVIDIA EGL exit handler crashed 10/10 closes, 0/41 now); Windows tears down inside the message loop, then TerminateProcess; watchdogs. - Version under the Settings tab; an update band instead of a dot, never over a video; checks at start and every 4 hours. - Chat pop-ups default to All again. - Shader read-back compared as a list (old mpv joins with ','), so Windows stops turning shaders off; Windows hwdec auto-copy. - Render diagnostics (`mpv: render` lines); RAM-only demuxer cache pin silences the file-cache warning; a volume readout test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e537f9d5f8
commit
ea607c1a52
29 files changed
+873
-168
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
@@ -7,6 +8,7 @@ import 'package:watch_together/src/schedule/ui/schedule_page.dart';
|
||||
import 'package:sync_relay_core/core.dart';
|
||||
import 'package:watch_together/src/screens/home/health_probe.dart';
|
||||
import 'package:watch_together/src/screens/home/media_picker.dart';
|
||||
import 'package:watch_together/src/screens/home/update_indicator.dart';
|
||||
import 'package:watch_together/src/shell/app_shell.dart';
|
||||
import 'package:watch_together/src/shell/library_link.dart' show soloPlayHint;
|
||||
import 'package:watch_together/src/state/session_state.dart';
|
||||
@@ -58,13 +60,18 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
test('chat pop-ups default to All', () {
|
||||
expect(AppSettings().chatPopups.value, ChatPopups.all);
|
||||
});
|
||||
|
||||
test('hwdec value follows mode', () {
|
||||
final s = AppSettings();
|
||||
expect(s.hwdec.value, 'auto');
|
||||
expect(s.hwdec.value, autoHwdec);
|
||||
expect(autoHwdec, Platform.isWindows ? 'auto-copy' : 'auto');
|
||||
s.setHwdecMode(HwdecMode.off);
|
||||
expect(s.hwdec.value, 'no');
|
||||
s.setHwdecMode(HwdecMode.custom);
|
||||
expect(s.hwdec.value, 'auto');
|
||||
expect(s.hwdec.value, autoHwdec);
|
||||
s.setHwdecCustom(' vaapi ');
|
||||
expect(s.hwdec.value, 'vaapi');
|
||||
});
|
||||
@@ -150,7 +157,7 @@ void main() {
|
||||
expect(find.text('Hardware decoding'), findsOneWidget);
|
||||
await tester.tap(find.byKey(const ValueKey('settings-updates')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Check for updates on start'), findsOneWidget);
|
||||
expect(find.text('Check for updates automatically'), findsOneWidget);
|
||||
await tester.tap(find.byKey(const ValueKey('settings-shortcuts')));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('Toggle ready'), findsOneWidget);
|
||||
@@ -288,4 +295,53 @@ void main() {
|
||||
expect(tester.takeException(), isNull, reason: source);
|
||||
}
|
||||
});
|
||||
|
||||
group('update bar', () {
|
||||
const m = UpdateManifest(
|
||||
version: '1.2.1', protocol: 1, url: 'http://x/a.tgz', notes: 'Faster joins');
|
||||
Future<UpdateController> pump(WidgetTester tester, UpdateStatus s,
|
||||
{String current = '1.2.0'}) async {
|
||||
final c = UpdateController(
|
||||
currentVersion: current,
|
||||
executablePath: '/nowhere/watch_together',
|
||||
restart: (_, _) async {});
|
||||
c.status.value = s;
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
home: Scaffold(body: Column(children: [UpdateBar(controller: c)]))));
|
||||
return c;
|
||||
}
|
||||
|
||||
testWidgets('says what is ready, the version running, Later hides it',
|
||||
(tester) async {
|
||||
await pump(tester,
|
||||
const UpdateStatus(UpdatePhase.available, manifest: m, canInstall: true));
|
||||
expect(find.text('Starsync 1.2.1 is ready'), findsOneWidget);
|
||||
expect(find.text('You are running 1.2.0 · Faster joins'), findsOneWidget);
|
||||
expect(find.text('Update and restart'), findsOneWidget);
|
||||
await tester.tap(find.byKey(const ValueKey('update-later')));
|
||||
await tester.pump();
|
||||
expect(find.byKey(const ValueKey('update-bar')), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('a copy that cannot update itself says it is older',
|
||||
(tester) async {
|
||||
await pump(tester, const UpdateStatus(UpdatePhase.available, manifest: m));
|
||||
expect(find.text('This copy of Starsync is older than the latest release (1.2.1)'),
|
||||
findsOneWidget);
|
||||
expect(find.text('Update and restart'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('a test build is not told which version it runs',
|
||||
(tester) async {
|
||||
await pump(tester,
|
||||
const UpdateStatus(UpdatePhase.available, manifest: m, canInstall: true),
|
||||
current: '1.2.1-dev.2');
|
||||
expect(find.text('Faster joins'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('nothing to install: no bar', (tester) async {
|
||||
await pump(tester, const UpdateStatus(UpdatePhase.idle));
|
||||
expect(find.byKey(const ValueKey('update-bar')), findsNothing);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -27,9 +27,9 @@ void main() {
|
||||
s.setShaderPreset(ShaderPreset.a);
|
||||
await p.init();
|
||||
final dynamic mpv = p.player.platform;
|
||||
final modeA = joinShaderPaths(
|
||||
await shaderPathsFor(ShaderPreset.a, ShaderQuality.hq, const []));
|
||||
expect(await mpv.getProperty('glsl-shaders'), modeA);
|
||||
final modeA =
|
||||
await shaderPathsFor(ShaderPreset.a, ShaderQuality.hq, const []);
|
||||
expect(shaderListMatches(modeA, await mpv.getProperty('glsl-shaders')), isTrue);
|
||||
expect(p.shaderNotice.value, isNull);
|
||||
|
||||
// Live change, announced.
|
||||
@@ -39,7 +39,7 @@ void main() {
|
||||
final caFast = await shaderPathsFor(
|
||||
ShaderPreset.ca, ShaderQuality.fast, const []);
|
||||
expect(caFast.first, startsWith(support.path));
|
||||
expect(await mpv.getProperty('glsl-shaders'), joinShaderPaths(caFast));
|
||||
expect(shaderListMatches(caFast, await mpv.getProperty('glsl-shaders')), isTrue);
|
||||
expect(p.shaderNotice.value?.text, 'Shaders: Mode C+A (Fast)');
|
||||
|
||||
// A missing custom file: toast, off, nothing set.
|
||||
|
||||
@@ -70,6 +70,22 @@ void main() {
|
||||
expect(joinShaderPaths([], windows: false), '');
|
||||
});
|
||||
|
||||
test("mpv's read-back: the list in ',', ';' or ':' form", () {
|
||||
const win = [r'C:\Users\a b\shaders\x.glsl', r'D:\y.glsl'];
|
||||
expect(shaderListMatches(win, r'C:\Users\a b\shaders\x.glsl;D:\y.glsl'), isTrue, reason: 'new mpv, Windows');
|
||||
expect(shaderListMatches(win, r'C:\Users\a b\shaders\x.glsl,D:\y.glsl'), isTrue, reason: 'old mpv, Windows');
|
||||
const unix = ['/home/a/x.glsl', '/home/a/y.glsl'];
|
||||
expect(shaderListMatches(unix, '/home/a/x.glsl:/home/a/y.glsl'), isTrue, reason: 'new mpv, Linux');
|
||||
expect(shaderListMatches(unix, '/home/a/x.glsl,/home/a/y.glsl'), isTrue, reason: 'old mpv, Linux');
|
||||
expect(shaderListMatches([r'C:\x.glsl'], r'C:\x.glsl'), isTrue, reason: 'one path');
|
||||
expect(shaderListMatches(const [], ''), isTrue, reason: 'off');
|
||||
expect(shaderListMatches(win, r'C:\Users\a b\shaders\x.glsl'), isFalse, reason: 'one dropped');
|
||||
expect(shaderListMatches(unix, '/home/a/y.glsl:/home/a/x.glsl'), isFalse, reason: 'order matters');
|
||||
expect(shaderListMatches(unix, ''), isFalse, reason: 'mpv kept none');
|
||||
expect(shaderListMatches(const [], 'null'), isFalse);
|
||||
expect(shaderListMatches(unix, null), isFalse, reason: 'read failed');
|
||||
});
|
||||
|
||||
test('path problems: missing file, separator inside a path', () {
|
||||
final d = _fresh('shaders_problem');
|
||||
final ok = File('${d.path}/ok.glsl')..writeAsStringSync('//');
|
||||
|
||||
@@ -68,14 +68,14 @@ void main() {
|
||||
coord.toasts.value = [];
|
||||
});
|
||||
|
||||
Future<void> pumpShell(WidgetTester tester, Size size) async {
|
||||
Future<void> pumpShell(WidgetTester tester, Size size, {UpdateController? updates}) async {
|
||||
tester.view.physicalSize = size;
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
theme: ThemeData.dark(),
|
||||
home: AppShell(
|
||||
updates: UpdateController(currentVersion: '0.0.0-dev'),
|
||||
updates: updates ?? UpdateController(currentVersion: '0.0.0-dev'),
|
||||
autoUpdateCheck: false,
|
||||
windowControls: false,
|
||||
videoBuilder: (context, controls) => const FakeVideo(),
|
||||
@@ -93,6 +93,36 @@ void main() {
|
||||
member('f', 'Finn'),
|
||||
];
|
||||
|
||||
group('version and update bar', () {
|
||||
testWidgets('the version under Settings; the bar on the tabs, off the full player until the video ends',
|
||||
(tester) async {
|
||||
final updates = UpdateController(currentVersion: '0.0.0-dev');
|
||||
await pumpShell(tester, const Size(1280, 800), updates: updates);
|
||||
expect(find.text('dev run'), findsOneWidget);
|
||||
expect(find.byKey(const ValueKey('update-bar')), findsNothing);
|
||||
updates.status.value = const UpdateStatus(UpdatePhase.available,
|
||||
manifest: UpdateManifest(version: '9.9.9', protocol: 1, url: 'http://x/a.tgz', notes: ''),
|
||||
canInstall: true);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const ValueKey('update-bar')), findsOneWidget);
|
||||
online(party);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const ValueKey('update-bar')), findsNothing);
|
||||
final r = coord.serverState.value!;
|
||||
coord.serverState.value = StateBroadcast(
|
||||
eventId: 2,
|
||||
transport: 'finished',
|
||||
position: 0,
|
||||
serverTime: r.serverTime,
|
||||
mediaId: r.mediaId,
|
||||
media: r.media,
|
||||
members: r.members,
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.byKey(const ValueKey('update-bar')), findsOneWidget);
|
||||
});
|
||||
});
|
||||
|
||||
group('party strip', () {
|
||||
testWidgets('offline: Join and Host, no party', (tester) async {
|
||||
await pumpShell(tester, const Size(1280, 800));
|
||||
|
||||
@@ -205,6 +205,26 @@ void main() {
|
||||
expect(dev.status.value.phase, UpdatePhase.idle);
|
||||
});
|
||||
|
||||
test('Later hides it until the next check; a check leaves an install be',
|
||||
() async {
|
||||
final c = UpdateController(
|
||||
currentVersion: '0.1.0',
|
||||
manifestUrl: server.manifestUrl,
|
||||
executablePath: '${work.path}/stray-binary',
|
||||
restart: (_, _) async {});
|
||||
await c.checkOnce();
|
||||
expect(c.status.value.phase, UpdatePhase.available);
|
||||
c.dismiss();
|
||||
expect(c.status.value.phase, UpdatePhase.idle);
|
||||
await c.checkNow();
|
||||
expect(c.status.value.phase, UpdatePhase.available);
|
||||
final m = c.status.value.manifest;
|
||||
c.status.value = UpdateStatus(UpdatePhase.downloading,
|
||||
manifest: m, progress: 0.4, canInstall: true);
|
||||
await c.checkNow();
|
||||
expect(c.status.value.phase, UpdatePhase.downloading);
|
||||
});
|
||||
|
||||
test('failed install shows error, install untouched, retry works',
|
||||
() async {
|
||||
server.manifestExtra = {'sha256': '0' * 64};
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:media_kit_video/media_kit_video.dart' show VideoState;
|
||||
import 'package:watch_together/src/controls/model/controls_prefs.dart';
|
||||
import 'package:watch_together/src/controls/frame.dart';
|
||||
import 'package:watch_together/src/shell/session_player.dart';
|
||||
import 'package:watch_together/src/state/session_state.dart';
|
||||
import 'package:watch_together/src/state/settings.dart';
|
||||
|
||||
// The wheel anywhere on the full player flashes the volume readout, in
|
||||
// both skins, windowed and fullscreen, with the controls up or hidden.
|
||||
// The picture is a black box with the session's controls on it (never a
|
||||
// media_kit `Video`).
|
||||
|
||||
void main() {
|
||||
final coord = SessionState.instance.coordinator;
|
||||
final s = AppSettings.instance;
|
||||
|
||||
// A real player for the volume steps to go to. Never disposed: the
|
||||
// steps' mpv calls start in the test's fake time and never finish, so a
|
||||
// dispose would wait on them for ever; the test process ending ends it.
|
||||
setUpAll(() async {
|
||||
MediaKit.ensureInitialized();
|
||||
await coord.playback.init();
|
||||
});
|
||||
|
||||
testWidgets('wheel over the video: readout for about a second', (tester) async {
|
||||
addTearDown(() => s.controlsSkin.value = ControlsSkin.standard);
|
||||
tester.view.physicalSize = const Size(1280, 720);
|
||||
tester.view.devicePixelRatio = 1;
|
||||
addTearDown(tester.view.reset);
|
||||
|
||||
final readout = find.byKey(const ValueKey('volume-readout'));
|
||||
double opacity() => readout.evaluate().isEmpty
|
||||
? 0
|
||||
: tester.widget<AnimatedOpacity>(find.ancestor(of: readout, matching: find.byType(AnimatedOpacity)).first).opacity;
|
||||
Future<void> wheel() async {
|
||||
await tester.sendEventToBinding(
|
||||
PointerScrollEvent(kind: PointerDeviceKind.mouse, position: const Offset(640, 300), scrollDelta: const Offset(0, -60)));
|
||||
await tester.pump();
|
||||
}
|
||||
|
||||
for (final skin in ControlsSkin.values) {
|
||||
for (final fullscreen in [false, true]) {
|
||||
final what = '${skin.name}, ${fullscreen ? 'fullscreen' : 'windowed'}';
|
||||
s.controlsSkin.value = skin;
|
||||
await tester.pumpWidget(MaterialApp(
|
||||
theme: ThemeData.dark(),
|
||||
home: Scaffold(
|
||||
body: SessionPlayer(
|
||||
key: ValueKey(what),
|
||||
mode: PlayerMode.full,
|
||||
fullscreen: fullscreen,
|
||||
onExpand: () {},
|
||||
onCollapse: () {},
|
||||
onClose: () {},
|
||||
onToggleFullscreen: () {},
|
||||
onToggleChat: () {},
|
||||
onChangeVideo: () {},
|
||||
onOpenIntegrations: () {},
|
||||
onLeave: () {},
|
||||
windowControls: false,
|
||||
videoBuilder: (context, controls) => Stack(fit: StackFit.expand, children: [
|
||||
const ColoredBox(color: Colors.black),
|
||||
if (controls != null) controls(VideoState()),
|
||||
]),
|
||||
),
|
||||
),
|
||||
));
|
||||
await tester.pump();
|
||||
expect(opacity(), 0, reason: '$what: nothing before a step');
|
||||
|
||||
// Controls up.
|
||||
expect(tester.state<ControlsFrameState>(find.byType(ControlsFrame)).visible, isTrue, reason: what);
|
||||
await wheel();
|
||||
expect(opacity(), 1, reason: '$what, controls up: shown');
|
||||
await tester.pump(const Duration(milliseconds: 900));
|
||||
expect(opacity(), 1, reason: '$what: still up within the second');
|
||||
await tester.pump(const Duration(milliseconds: 300));
|
||||
expect(opacity(), 0, reason: '$what: gone after the second');
|
||||
|
||||
// Controls hidden (no mouse movement past the hide delay).
|
||||
await tester.pump(Duration(seconds: s.controlsHideSecs.value + 1));
|
||||
await tester.pump(const Duration(milliseconds: 500));
|
||||
expect(tester.state<ControlsFrameState>(find.byType(ControlsFrame)).visible, isFalse, reason: what);
|
||||
await wheel();
|
||||
expect(opacity(), 1, reason: '$what, controls hidden: shown');
|
||||
await tester.pump(const Duration(milliseconds: 1200));
|
||||
expect(opacity(), 0, reason: '$what: gone after the second');
|
||||
}
|
||||
}
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
await tester.pump(const Duration(seconds: 5));
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user