- Linux app id dev.foxyz.starsync, binary starsync; Windows starsync.exe, company foxyz; server starsync-server; Dart package starsync; archives starsync-<ver>-*. - 1.2.x compatibility: watch_together and watch-together-server launchers (Linux) / copies (Windows) in the archive; the updater accepts both names and relaunches the new binary; update.sh/.bat use whichever server exists. - First start copies (never moves) the old support folder and this app's Hive boxes out of ~/Documents into <support>/hive; a marker makes it run once; AppDirs is a port; settings schema version with ordered migrations. - Launcher entry dev.foxyz.starsync.desktop; the old one removed. - Repository name and URLs unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
2.3 KiB
Dart
47 lines
2.3 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:starsync/src/shell/handoff.dart';
|
|
|
|
// What a drop or a paste is: decided from paths and text alone (the file
|
|
// system stands behind a fake).
|
|
|
|
void main() {
|
|
const fs = {
|
|
'/v/a.mkv': FileSystemEntityType.file,
|
|
'/v/b.MP4': FileSystemEntityType.file,
|
|
'/v/notes.txt': FileSystemEntityType.file,
|
|
'/v/cover.jpg': FileSystemEntityType.file,
|
|
'/v/Season 1': FileSystemEntityType.directory,
|
|
'/v/folder.mkv': FileSystemEntityType.directory,
|
|
r'C:\Videos\c.mkv': FileSystemEntityType.file,
|
|
};
|
|
Handoff of({List<String> paths = const [], String? text}) =>
|
|
classifyHandoff(paths: paths, text: text, typeOf: (p) => fs[p] ?? FileSystemEntityType.notFound);
|
|
|
|
test('videos by extension, in order; others dropped with them are left out', () {
|
|
final h = of(paths: ['/v/notes.txt', '/v/b.MP4', '/v/Season 1', '/v/a.mkv']);
|
|
expect((h as HandoffVideos).paths, ['/v/b.MP4', '/v/a.mkv']);
|
|
});
|
|
|
|
test('a folder (even one named like a video), else an image, else nothing', () {
|
|
expect((of(paths: ['/v/notes.txt', '/v/folder.mkv']) as HandoffFolder).path, '/v/folder.mkv');
|
|
expect((of(paths: ['/v/cover.jpg']) as HandoffImage).path, '/v/cover.jpg');
|
|
expect(of(paths: ['/v/notes.txt']), isA<HandoffNothing>());
|
|
expect(of(paths: ['/gone/x.mkv']), isA<HandoffNothing>());
|
|
expect(of(), isA<HandoffNothing>());
|
|
});
|
|
|
|
test('pasted text: a link, absolute paths or file URIs; files win over text', () {
|
|
expect(of(text: ' https://cdn.example/a b'), isA<HandoffNothing>());
|
|
expect((of(text: ' https://youtu.be/x?t=1 \n') as HandoffLink).url, 'https://youtu.be/x?t=1');
|
|
expect((of(text: 'HTTP://x.example/v.mp4') as HandoffLink).url, 'HTTP://x.example/v.mp4');
|
|
expect((of(text: '/v/a.mkv\n/v/b.MP4') as HandoffVideos).paths, ['/v/a.mkv', '/v/b.MP4']);
|
|
expect((of(text: 'file:///v/Season%201') as HandoffFolder).path, '/v/Season 1');
|
|
expect((of(text: r'C:\Videos\c.mkv') as HandoffVideos).paths, [r'C:\Videos\c.mkv']);
|
|
expect(of(text: 'v/a.mkv'), isA<HandoffNothing>(), reason: 'relative');
|
|
expect(of(text: 'hello'), isA<HandoffNothing>());
|
|
expect((of(paths: ['/v/Season 1'], text: 'https://x.example') as HandoffFolder).path, '/v/Season 1');
|
|
});
|
|
}
|