Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
26 lines
1017 B
Dart
26 lines
1017 B
Dart
import 'dart:convert';
|
|
import 'dart:io';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
const _source = String.fromEnvironment('CUTDEX_TEST_SOURCE');
|
|
const _encodedSource = String.fromEnvironment('CUTDEX_TEST_SOURCE_BASE64');
|
|
const _document = String.fromEnvironment('CUTDEX_TEST_SOURCE_DOCUMENT');
|
|
|
|
const hasNativeMediaFixture =
|
|
_source != '' || _encodedSource != '' || _document != '';
|
|
|
|
/// Uses a host file, a sandbox document, or embedded media written to a temporary file.
|
|
Future<File> nativeMediaFixture() async {
|
|
if (_encodedSource.isEmpty) {
|
|
if (_document.isEmpty) return File(_source).absolute;
|
|
final directory = await getApplicationDocumentsDirectory();
|
|
return File('${directory.path}/$_document');
|
|
}
|
|
final directory = await Directory.systemTemp.createTemp('cutdex-media-');
|
|
addTearDown(() => directory.delete(recursive: true));
|
|
return File('${directory.path}/source.mp4')
|
|
.writeAsBytes(base64Decode(_encodedSource));
|
|
}
|