Gitea CI / Assemble and validate CI artifacts (push) Successful in 1m47s
Gitea CI / Check code and tests (push) Successful in 7m15s
Gitea CI / Build Android APK (push) Successful in 4m6s
Gitea CI / Build Windows x64 app (push) Successful in 3m34s
Gitea CI / Audit and package Windows x64 (push) Successful in 1m29s
Gitea CI / Gitea CI passed (push) Successful in 1s
Gitea Release / Prepare draft Release (push) Failing after 8s
Gitea Release / Upload Android to draft Release (push) Skipped
Gitea Release / Upload Windows to draft Release (push) Skipped
Gitea Release / Verify and publish Release (push) Skipped
83 lines
2.7 KiB
Dart
83 lines
2.7 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'package:cutdex_timeline_ui/cutdex_timeline_ui.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
test(
|
|
'adding a header preserves all body regions at their viewport positions',
|
|
() {
|
|
for (final audioOnly in [false, true]) {
|
|
final before = TimelineClipLayout(
|
|
bounds: const Rect.fromLTWH(25, 64, 240, 76),
|
|
nameHeight: 16,
|
|
audioOnly: audioOnly,
|
|
hasVideoAudio: !audioOnly,
|
|
);
|
|
final after = TimelineClipLayout(
|
|
bounds: const Rect.fromLTWH(25, 48, 240, 92),
|
|
headerHeight: 16,
|
|
nameHeight: 16,
|
|
audioOnly: audioOnly,
|
|
hasVideoAudio: !audioOnly,
|
|
);
|
|
for (final pair in [
|
|
(before.body, after.body),
|
|
(before.name, after.name),
|
|
(before.preview, after.preview),
|
|
(before.waveformBackground, after.waveformBackground),
|
|
(before.waveform, after.waveform),
|
|
]) {
|
|
expect(before.toViewport(pair.$1), after.toViewport(pair.$2));
|
|
}
|
|
expect(
|
|
before.bounds.topLeft + before.keyframeCenter,
|
|
after.bounds.topLeft + after.keyframeCenter,
|
|
);
|
|
expect(after.header.bottom, after.body.top);
|
|
expect(after.name.bottom, after.preview.top);
|
|
if (!audioOnly) {
|
|
expect(after.preview.bottom, after.waveformBackground.top);
|
|
expect(after.preview.height, 44);
|
|
}
|
|
}
|
|
},
|
|
);
|
|
|
|
test(
|
|
'small clip regions stay inside the clip and omit an undersized waveform',
|
|
() {
|
|
for (final width in [0.0, 1.0, 3.0, 20.0]) {
|
|
for (final height in [0.0, 16.0, 20.0, 35.0]) {
|
|
for (final audioOnly in [false, true]) {
|
|
final layout = TimelineClipLayout(
|
|
bounds: Rect.fromLTWH(-80, 150, width, height),
|
|
headerHeight: 16,
|
|
nameHeight: 16,
|
|
audioOnly: audioOnly,
|
|
hasVideoAudio: !audioOnly,
|
|
);
|
|
for (final region in [
|
|
layout.header,
|
|
layout.body,
|
|
layout.bodyPaintBounds,
|
|
layout.name,
|
|
layout.preview,
|
|
layout.waveformBackground,
|
|
layout.waveform,
|
|
]) {
|
|
expect(region.width, greaterThanOrEqualTo(0));
|
|
expect(region.height, greaterThanOrEqualTo(0));
|
|
expect(region.left, greaterThanOrEqualTo(0));
|
|
expect(region.top, greaterThanOrEqualTo(0));
|
|
expect(region.right, lessThanOrEqualTo(width));
|
|
expect(region.bottom, lessThanOrEqualTo(height));
|
|
}
|
|
expect(layout.waveform.isEmpty, isTrue);
|
|
}
|
|
}
|
|
}
|
|
},
|
|
);
|
|
}
|