π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix lint errors in video editor integration test and video widget
Prateek Sunal8ca3b0d3c253
diff --git a/mobile/apps/photos/integration_test/video_editor_test.dart b/mobile/apps/photos/integration_test/video_editor_test.dartindex 4ae30863e2..3c9bf4e466 100644--- a/mobile/apps/photos/integration_test/video_editor_test.dart+++ b/mobile/apps/photos/integration_test/video_editor_test.dart@@ -1,11 +1,13 @@import 'dart:io';+import 'package:flutter_test/flutter_test.dart';+import 'package:fluttertoast/fluttertoast.dart';import 'package:integration_test/integration_test.dart';import 'package:logging/logging.dart';import 'package:native_video_editor/native_video_editor.dart';+import 'package:package_info_plus/package_info_plus.dart';import 'package:path/path.dart' as path_helper;import 'package:photo_manager/photo_manager.dart';-import 'package:package_info_plus/package_info_plus.dart';import 'package:photos/core/configuration.dart';import 'package:photos/core/network/network.dart';import 'package:photos/db/files_db.dart';@@ -19,7 +21,6 @@ import 'package:photos/ui/tools/editor/video_editor/crop_value.dart';import 'package:photos/utils/file_util.dart';import 'package:shared_preferences/shared_preferences.dart';import 'package:video_editor/video_editor.dart';-import 'package:fluttertoast/fluttertoast.dart';/// Trim configurationclass TrimConfig {@@ -27,8 +28,11 @@ class TrimConfig {final Duration? duration;final Duration startOffset;- const TrimConfig(- {required this.label, this.duration, this.startOffset = Duration.zero});+ const TrimConfig({+ required this.label,+ this.duration,+ this.startOffset = Duration.zero,+ });bool get shouldTrim => duration != null;@@ -60,8 +64,10 @@ class TrimConfigs {}/// Create a trim config from start offset and length- static TrimConfig fromRange(- {required int startSeconds, required int lengthSeconds}) {+ static TrimConfig fromRange({+ required int startSeconds,+ required int lengthSeconds,+ }) {return TrimConfig(label: "trim-${startSeconds}s-${startSeconds + lengthSeconds}s",duration: Duration(seconds: lengthSeconds),@@ -249,7 +255,8 @@ void main() {testFiles.fold(0, (sum, config) => sum + config.totalIterations);logger.info('βββββββββββββββββββββββββββββββββββββββββββββββββββββββ');logger.info(- 'Starting test with $totalFiles file(s), ${testFiles.length} configuration(s)');+ 'Starting test with $totalFiles file(s), ${testFiles.length} configuration(s)',+ );logger.info('Total iterations: $totalIterations');logger.info('βββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n');@@ -263,7 +270,8 @@ void main() {final config = testFiles[configIndex];logger.info(- '\nβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');+ '\nβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ',+ );logger.info('β CONFIG ${configIndex + 1}/${testFiles.length}');logger.info('β Files: ${config.fileIds}');logger.info('β Iterations per file: ${config.totalIterationsPerFile}');@@ -271,7 +279,8 @@ void main() {logger.info('β Crop: ${config.cropOptions}');logger.info('β Rotate: ${config.rotateOptions}');logger.info(- 'βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n');+ 'βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\n',+ );// Process each file in this configurationfor (int fileIndex = 0;@@ -281,7 +290,8 @@ void main() {logger.info('βββββββββββββββββββββββββββββββββββββββββββββββββββββ');logger.info(- 'File ${fileIndex + 1}/${config.fileIds.length} in config ${configIndex + 1}: ID $fileId');+ 'File ${fileIndex + 1}/${config.fileIds.length} in config ${configIndex + 1}: ID $fileId',+ );logger.info('βββββββββββββββββββββββββββββββββββββββββββββββββββββ');// Load source file@@ -385,7 +395,8 @@ void main() {}logger.info(- 'File $fileId completed: $fileIterationCount/${config.totalIterationsPerFile} iterations\n');+ 'File $fileId completed: $fileIterationCount/${config.totalIterationsPerFile} iterations\n',+ );}logger.info('βββββββββββββββββββββββββββββββββββββββββββββββββββββββ');@@ -408,10 +419,12 @@ void main() {if (failedExports.isNotEmpty) {logger.severe(- '\nβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');+ '\nβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ',+ );logger.severe('β EXPORT FAILURES (${failedExports.length})');logger.severe(- 'βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');+ 'βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ',+ );failedExports.forEach((desc, error) {logger.severe(' β $desc');logger.severe(' Error: $error\n');@@ -420,10 +433,12 @@ void main() {if (validationFailures.isNotEmpty) {logger.warning(- '\nβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');+ '\nβββββββββββββββββββββββββββββββββββββββββββββββββββββββββ',+ );logger.warning('β VALIDATION FAILURES (${validationFailures.length})');logger.warning(- 'βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ');+ 'βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ',+ );// Group by failure typefinal groupedFailures = <String, List<ValidationFailure>>{};@@ -435,10 +450,12 @@ void main() {groupedFailures.forEach((type, failures) {logger.warning(- '\n ${type.toUpperCase()} (${failures.length} failures):');+ '\n ${type.toUpperCase()} (${failures.length} failures):',+ );for (final failure in failures) {logger.warning(- ' β File ${failure.fileId}: ${failure.description}');+ ' β File ${failure.fileId}: ${failure.description}',+ );logger.warning(' Expected: ${failure.expected}');logger.warning(' Actual: ${failure.actual}');}@@ -483,7 +500,8 @@ Future<IterationResult> _processVideoIteration({controller = VideoEditorController.file(sourceIoFile,minDuration: const Duration(- milliseconds: 100), // Allow very short videos for testing+ milliseconds: 100,+ ), // Allow very short videos for testing);await controller.initialize();@@ -493,7 +511,8 @@ Future<IterationResult> _processVideoIteration({logger.info(' - Original duration: ${originalDuration.inMilliseconds}ms');logger.info(- ' - Original size: ${originalSize.width.toInt()}x${originalSize.height.toInt()}');+ ' - Original size: ${originalSize.width.toInt()}x${originalSize.height.toInt()}',+ );// Track expected dimensions (will be updated after crop)var expectedWidth = originalSize.width.toInt();@@ -562,10 +581,7 @@ Future<IterationResult> _processVideoIteration({if (cropValue != null) {final aspectRatio = cropValue.getFraction()?.toDouble();if (aspectRatio != null) {- _applyAspectCropToController(- controller: controller,- aspectRatio: aspectRatio,- );+ controller.preferredCropAspectRatio = aspectRatio;} else {controller.applyCacheCrop();}@@ -579,7 +595,8 @@ Future<IterationResult> _processVideoIteration({expectedWidth = cropCalc.width;expectedHeight = cropCalc.height;logger.info(- ' β Crop applied: $cropOption (${expectedWidth}x$expectedHeight)');+ ' β Crop applied: $cropOption (${expectedWidth}x$expectedHeight)',+ );} catch (e) {logger.warning(' - Failed to calculate crop dimensions: $e');logger.info(' β Crop applied: $cropOption');@@ -641,7 +658,10 @@ Future<IterationResult> _processVideoIteration({},onError: (e, s) {logger.severe(- ' β Native export failed - NO FFmpeg fallback in test!', e, s);+ ' β Native export failed - NO FFmpeg fallback in test!',+ e,+ s,+ );},);@@ -699,7 +719,7 @@ Future<IterationResult> _processVideoIteration({rotateOption: rotateOption,);if (settingsToast != null) {- Fluttertoast.showToast(+ await Fluttertoast.showToast(msg: settingsToast,toastLength: Toast.LENGTH_SHORT,gravity: ToastGravity.TOP,@@ -712,7 +732,8 @@ Future<IterationResult> _processVideoIteration({final videoInfo =await NativeVideoEditor.getVideoInfo(exportedFile.path);final actualDuration = Duration(- milliseconds: (videoInfo['duration'] as num?)?.toInt() ?? 0);+ milliseconds: (videoInfo['duration'] as num?)?.toInt() ?? 0,+ );final actualWidth = (videoInfo['width'] as num?)?.toInt() ?? 0;final actualHeight = (videoInfo['height'] as num?)?.toInt() ?? 0;@@ -736,7 +757,8 @@ Future<IterationResult> _processVideoIteration({),);logger.warning(- ' β Duration mismatch! Expected: ${expectedDuration.inMilliseconds}ms, Got: ${actualDuration.inMilliseconds}ms');+ ' β Duration mismatch! Expected: ${expectedDuration.inMilliseconds}ms, Got: ${actualDuration.inMilliseconds}ms',+ );}// Validate dimensions (accounting for crop and rotation)@@ -786,7 +808,8 @@ Future<IterationResult> _processVideoIteration({),);logger.warning(- ' β Width mismatch! Expected: $finalExpectedWidth, Got: $actualWidth');+ ' β Width mismatch! Expected: $finalExpectedWidth, Got: $actualWidth',+ );}// Check height (allow some tolerance for encoding)@@ -801,7 +824,8 @@ Future<IterationResult> _processVideoIteration({),);logger.warning(- ' β Height mismatch! Expected: $finalExpectedHeight, Got: $actualHeight');+ ' β Height mismatch! Expected: $finalExpectedHeight, Got: $actualHeight',+ );}if (failures.isEmpty) {diff --git a/mobile/apps/photos/lib/ui/viewer/file/video_widget.dart b/mobile/apps/photos/lib/ui/viewer/file/video_widget.dartindex 70f59e162a..7f1c530f48 100644--- a/mobile/apps/photos/lib/ui/viewer/file/video_widget.dart+++ b/mobile/apps/photos/lib/ui/viewer/file/video_widget.dart@@ -211,14 +211,12 @@ class _VideoWidgetState extends State<VideoWidget> {void _maybeShowTransformToast() {if (!kDebugMode) return;final name = widget.file.title ?? widget.file.displayName;- if (name == null) return;final editedIndex = name.indexOf('_edited');if (editedIndex == -1) return;final prefix = name.substring(0, editedIndex);final hasTrim = prefix.contains('_t');- final cropMatch =- RegExp(r'_c_([0-9]+(?:[:_-][0-9]+)?)').firstMatch(prefix);+ final cropMatch = RegExp(r'_c_([0-9]+(?:[:_-][0-9]+)?)').firstMatch(prefix);final rotateMatch = RegExp(r'_r_([^_]+)').firstMatch(prefix);if (!hasTrim && cropMatch == null && rotateMatch == null) return;