Files
ZenXercise/test/support/test_database.dart
T
CedricandClaude Opus 5.5 bbdca95541 Stage 3: Plan editor with Steps, Supersets and reordering
- Plan model with immutable edits: add with Mode defaults, move, remove,
  Superset with next, take a member out, ungroup; Stretching length
  estimate from holds, sides, rounds and Transitions
- drift database (plans table, items as JSON, ADR 0005) and
  PlanRepository; Plans list per Mode with rename/duplicate/delete
- Editor: drag handles, step editor sheet (sets, reps or time, optional
  kg; hold, both sides, rounds; Superset sets and rest between),
  pause between holds for Stretching Plans
- Exercise picker reusing the Library browser; Add to plan from the
  Exercise detail page
- Theme: Mode-styled snackbar, FAB, menus, segmented buttons, switches

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 23:48:07 +01:00

22 lines
862 B
Dart

import 'dart:ffi';
import 'dart:io';
import 'package:drift/drift.dart';
import 'package:drift/native.dart';
import 'package:sqlite3/open.dart';
import 'package:zenxercise/src/database/database.dart';
/// An in-memory database for tests. On Windows hosts the sqlite3 library comes
/// from ZENXERCISE_SQLITE_DLL if set, otherwise from the system's winsqlite3.dll.
AppDatabase testDatabase() {
if (Platform.isWindows) {
open.overrideFor(OperatingSystem.windows, () {
final custom = Platform.environment['ZENXERCISE_SQLITE_DLL'];
return DynamicLibrary.open(custom ?? 'winsqlite3.dll');
});
}
driftRuntimeOptions.dontWarnAboutMultipleDatabases = true;
// Synchronous stream teardown keeps widget tests from hanging on pending timers.
return AppDatabase(DatabaseConnection(NativeDatabase.memory(), closeStreamsSynchronously: true));
}