feat: initial Cutdex application
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.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,99 @@
|
||||
import 'package:cutdex/errors/app_failure.dart';
|
||||
import 'package:cutdex/workspace/media_timeline_duration.dart';
|
||||
import 'package:cutdex_sdk/runtime.dart';
|
||||
import 'package:cutdex_sdk/timeline/model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
test(
|
||||
'microsecond and 2997/100 container timebases lose less than one tick',
|
||||
() {
|
||||
for (final (source, ticks) in [
|
||||
(MediaTime(5853355833, 1000000), 8260255751529),
|
||||
(MediaTime(70170000, 11988), 8260252252252),
|
||||
]) {
|
||||
final result = mediaTimelineDuration(source);
|
||||
final original = RationalTime(source.numerator, source.denominator);
|
||||
expect(TimelineClock.standard.toTicks(result), ticks);
|
||||
expect(result, lessThanOrEqualTo(original));
|
||||
expect(original - result, lessThan(RationalTime.timelineTicks(1)));
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
test('native MPG duration is representable without exceeding the source', () {
|
||||
final source = MediaTime(64737467444, 10000000);
|
||||
expect(
|
||||
() => TimelineClock.standard.toTicks(
|
||||
RationalTime(source.numerator, source.denominator),
|
||||
),
|
||||
throwsArgumentError,
|
||||
);
|
||||
final duration = mediaTimelineDuration(source);
|
||||
final ticks = TimelineClock.standard.toTicks(duration);
|
||||
expect(ticks, 9135751405697);
|
||||
// Check exact integers: discarded time is nonnegative and below one tick.
|
||||
final remainder =
|
||||
BigInt.from(source.numerator) *
|
||||
BigInt.from(TimelineClock.ticksPerSecond) -
|
||||
BigInt.from(ticks) * BigInt.from(source.denominator);
|
||||
expect(remainder, BigInt.from(2800000));
|
||||
expect(remainder >= BigInt.zero, isTrue);
|
||||
expect(remainder < BigInt.from(source.denominator), isTrue);
|
||||
});
|
||||
|
||||
test('exact seconds, NTSC frames and audio samples retain their times', () {
|
||||
for (final source in [
|
||||
MediaTime(5, 1),
|
||||
MediaTime(1001, 30000),
|
||||
MediaTime(1, 48000),
|
||||
MediaTime(1, 44100),
|
||||
MediaTime(1, 24),
|
||||
MediaTime(1, 25),
|
||||
MediaTime(1, 30),
|
||||
MediaTime(1, 384000),
|
||||
MediaTime(1, TimelineClock.ticksPerSecond),
|
||||
]) {
|
||||
expect(
|
||||
mediaTimelineDuration(source),
|
||||
RationalTime(source.numerator, source.denominator),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('nonpositive and sub-tick durations cannot create empty clips', () {
|
||||
for (final source in [
|
||||
MediaTime(0, 1),
|
||||
MediaTime(-1, 1),
|
||||
MediaTime(1, 0xffffffff),
|
||||
]) {
|
||||
expect(() => mediaTimelineDuration(source), throwsStateError);
|
||||
}
|
||||
});
|
||||
|
||||
test('large intermediates remain exact; out-of-range ticks are rejected', () {
|
||||
const maximum = 0x7fffffffffffffff;
|
||||
expect(
|
||||
TimelineClock.standard.toTicks(
|
||||
mediaTimelineDuration(MediaTime(maximum, 0xffffffff)),
|
||||
),
|
||||
3030528924763199999,
|
||||
);
|
||||
expect(
|
||||
TimelineClock.standard.toTicks(
|
||||
mediaTimelineDuration(MediaTime(maximum, TimelineClock.ticksPerSecond)),
|
||||
),
|
||||
maximum,
|
||||
);
|
||||
expect(
|
||||
() => mediaTimelineDuration(MediaTime(maximum, 1)),
|
||||
throwsA(
|
||||
isA<AppException>().having(
|
||||
(error) => error.failure.code,
|
||||
'code',
|
||||
AppErrorCode.mediaDurationOutOfRange,
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user