JJ_MKVMaker/test/support/test_explorer_device.dart

33 lines
1.4 KiB
Dart

import 'package:jj_mkvmaker/app/explorer_device.dart';
/// 시험용 [ExplorerDevice]: 정한 것만 바꾸고 나머지는 이 기기 그대로.
/// [android] · [trash] · [nomediaOn] 은 Windows 에서 Android 의 갈래를 지나게 할 뿐이다 - 논리만 확인, Android 실제 확인은 노트 10+
class TestExplorerDevice implements ExplorerDevice {
static const _real = RealExplorerDevice();
/// 저장 장치 목록 (null 이면 이 기기)
List<(String, String)> Function()? volumes;
/// 드라이브를 열 수 있는지 (null 이면 이 기기)
Future<bool> Function(String path)? probe;
/// 남은 공간 · 전체 (null 이면 이 기기) - 캡처가 실행마다 같게 정한다
(int, int)? Function(String path)? space;
/// 경로 입력 SMB 안내 · 앱 휴지통 · .nomedia 메뉴 (null 이면 이 기기)
bool? android, trash, nomediaOn;
@override
Future<List<(String, String)>> listVolumes() async => volumes?.call() ?? await _real.listVolumes();
@override
Future<bool> probeDrive(String path) => (probe ?? _real.probeDrive)(path);
@override
Future<(int, int)?> diskSpace(String path) async => space != null ? space!(path) : await _real.diskSpace(path);
@override
bool get androidPaths => android ?? _real.androidPaths;
@override
bool get androidTrash => trash ?? _real.androidTrash;
@override
bool get nomedia => nomediaOn ?? _real.nomedia;
}