Files
sync_replay_project/apps/desktop/test/sound_device_e2e_test.dart
T
foxyzandClaude Opus 5.5 51c1c5ab78
ci / core (push) Successful in 31s
ci / server (push) Successful in 1m3s
ci / updater-windows (push) Successful in 6m6s
Restructure step R: the app is Starsync (dev.foxyz.starsync)
- 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>
2026-10-15 20:21:20 +03:00

36 lines
1.6 KiB
Dart

import 'dart:io';
import 'package:flutter/services.dart';
import 'package:flutter_soloud/flutter_soloud.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:starsync/src/platform/audio/sound_engine.dart';
import 'package:starsync/src/sfx/sfx.dart';
import 'package:starsync/src/sfx/sound_bank.dart';
import 'package:starsync/src/sfx/synth_sfx.dart';
// Needs a real audio output: opens the device through flutter_soloud and
// plays every sound of every preset once, quietly (WT_SFX_VOLUME, default
// 0.1, on the square curve like the app).
void main() {
// flutter_soloud's init asks path_provider for a temp dir.
TestWidgetsFlutterBinding.ensureInitialized().defaultBinaryMessenger.setMockMethodCallHandler(
const MethodChannel('plugins.flutter.io/path_provider'), (_) async => Directory.systemTemp.path);
test('every sound loads and plays on the real device', timeout: const Timeout(Duration(minutes: 2)), () async {
final volume = double.tryParse(Platform.environment['WT_SFX_VOLUME'] ?? '') ?? 0.1;
final engine = SoundEngine();
expect(await engine.warmUp(), isTrue, reason: 'audio device opened');
final sfx = SynthSfx(volume: () => volume, engine: engine);
for (final p in SoundPreset.values) {
for (final k in SfxKind.values) {
await sfx.preview(k, readyIndex: 2, preset: p);
expect(SoLoud.instance.getActiveVoiceCount(), greaterThan(0), reason: '${p.name}/${k.name}');
await Future<void>.delayed(const Duration(milliseconds: 250));
}
}
await Future<void>.delayed(const Duration(seconds: 2));
await sfx.dispose();
expect(SoLoud.instance.isInitialized, isFalse);
});
}