Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mobile][photos] Trim video speed test coverage

r4khul4c429f9350e8
diff --git a/mobile/apps/photos/test/ui/tools/editor/video_editor_contract_test.dart b/mobile/apps/photos/test/ui/tools/editor/video_editor_contract_test.dart
index 0a2eede7f4..38a9767b8f 100644
--- a/mobile/apps/photos/test/ui/tools/editor/video_editor_contract_test.dart
+++ b/mobile/apps/photos/test/ui/tools/editor/video_editor_contract_test.dart
@@ -55,32 +55,8 @@ void main() {
'scale=trunc(iw/2)*2:trunc(ih/2)*2',
]);
});
-
- test('applies speed after spatial edits', () {
- expect(buildFfmpegVideoFilters(crop: null, rotation: 90, speed: 2), [
- 'transpose=1',
- 'scale=trunc(iw/2)*2:trunc(ih/2)*2',
- 'setpts=PTS/2.0',
- ]);
- });
});
- test(
- 'audio tempo scales the initial offset without stretching samples twice',
- () {
- expect(buildFfmpegAudioTempoFilters(0.25), [
- 'atempo=0.5',
- 'atempo=0.5',
- 'asetpts=PTS-STARTPTS+STARTPTS/0.25',
- ]);
- expect(buildFfmpegAudioTempoFilters(2), [
- 'atempo=2.0',
- 'asetpts=PTS-STARTPTS+STARTPTS/2.0',
- ]);
- expect(buildFfmpegAudioTempoFilters(1), isEmpty);
- },
- );
-
test('FFmpeg plan preserves file paths as structured arguments', () {
final controller = VideoEditorController.file(
File("/tmp/input video's source.mp4"),
@@ -97,7 +73,7 @@ void main() {
expect(plan.arguments, containsAllInOrder(['-map', '0:a?']));
});
- test('FFmpeg reads only the trimmed source before changing speed', () {
+ test('speed export plan retimes both streams', () {
final controller = VideoEditorController.file(File('/tmp/input.mp4'));
addTearDown(controller.dispose);
controller.updateSpeed(0.25);
@@ -107,7 +83,10 @@ void main() {
outputPath: '/tmp/output.mp4',
);
- expect(plan.arguments, containsAllInOrder(['-t', '0.000000', '-i']));
+ expect(
+ plan.arguments.indexOf('-t'),
+ lessThan(plan.arguments.indexOf('-i')),
+ );
expect(
plan.arguments,
containsAllInOrder([
diff --git a/mobile/apps/photos/test/ui/tools/editor/video_editor_controller_test.dart b/mobile/apps/photos/test/ui/tools/editor/video_editor_controller_test.dart
index b1c5b29a6c..b2f9c513d1 100644
--- a/mobile/apps/photos/test/ui/tools/editor/video_editor_controller_test.dart
+++ b/mobile/apps/photos/test/ui/tools/editor/video_editor_controller_test.dart
@@ -20,8 +20,6 @@ void main() {
controller.updateSpeed(2.0);
expect(controller.snapshot().speed, 2.0);
- expect(() => controller.updateSpeed(0), throwsArgumentError);
- expect(() => controller.updateSpeed(double.nan), throwsArgumentError);
});
test('edited durations follow the chosen speed', () {
diff --git a/mobile/apps/photos/test/ui/tools/editor/video_editor_main_actions_test.dart b/mobile/apps/photos/test/ui/tools/editor/video_editor_main_actions_test.dart
deleted file mode 100644
index 335337a2e8..0000000000
--- a/mobile/apps/photos/test/ui/tools/editor/video_editor_main_actions_test.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_test/flutter_test.dart';
-import 'package:photos/ui/tools/editor/video_editor/video_editor_main_actions.dart';
-
-void main() {
- testWidgets('spaces actions across the available editor width', (
- tester,
- ) async {
- const firstKey = Key('first');
- const secondKey = Key('second');
- const thirdKey = Key('third');
- const fourthKey = Key('fourth');
-
- await tester.pumpWidget(
- const MaterialApp(
- home: Scaffold(
- body: SizedBox(
- width: 600,
- child: VideoEditorMainActions(
- children: [
- SizedBox(key: firstKey, width: 90, height: 60),
- SizedBox(key: secondKey, width: 90, height: 60),
- SizedBox(key: thirdKey, width: 90, height: 60),
- SizedBox(key: fourthKey, width: 90, height: 60),
- ],
- ),
- ),
- ),
- ),
- );
-
- expect(tester.getTopLeft(find.byKey(firstKey)).dx, 0);
- expect(tester.getTopLeft(find.byKey(secondKey)).dx, 170);
- expect(tester.getTopLeft(find.byKey(thirdKey)).dx, 340);
- expect(tester.getTopLeft(find.byKey(fourthKey)).dx, 510);
- });
-}
diff --git a/mobile/apps/photos/test/ui/tools/editor/video_speed_options_test.dart b/mobile/apps/photos/test/ui/tools/editor/video_speed_options_test.dart
index 139c81f3fd..c690a614ce 100644
--- a/mobile/apps/photos/test/ui/tools/editor/video_speed_options_test.dart
+++ b/mobile/apps/photos/test/ui/tools/editor/video_speed_options_test.dart
@@ -34,30 +34,4 @@ void main() {
0.5,
);
});
-
- testWidgets('speed chips can be activated through semantics', (tester) async {
- double selectedSpeed = 1.0;
-
- await tester.pumpWidget(
- MaterialApp(
- theme: darkThemeData,
- home: Scaffold(
- body: VideoSpeedOptions(
- currentSpeed: selectedSpeed,
- onSpeedSelected: (speed) => selectedSpeed = speed,
- ),
- ),
- ),
- );
-
- final chip = tester.widget<Semantics>(
- find.byWidgetPredicate(
- (widget) => widget is Semantics && widget.properties.label == '0.5x',
- ),
- );
- expect(chip.properties.button, isTrue);
- expect(chip.properties.onTap, isNotNull);
- chip.properties.onTap!();
- expect(selectedSpeed, 0.5);
- });
}