fix: getAspectRatio fallback to db width and height (#24131)

fix: getExif fallback to db width and height

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong
2025-11-24 21:53:17 +05:30
committed by GitHub
parent 0498f6cb9d
commit c860809aa1
4 changed files with 222 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:fake_async/fake_async.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:immich_mobile/domain/models/asset/base_asset.model.dart' as domain;
import 'package:immich_mobile/entities/album.entity.dart';
import 'package:immich_mobile/entities/android_device_asset.entity.dart';
import 'package:immich_mobile/entities/asset.entity.dart';
@@ -116,4 +117,43 @@ abstract final class TestUtils {
}
return result;
}
static domain.RemoteAsset createRemoteAsset({required String id, int? width, int? height, String? ownerId}) {
return domain.RemoteAsset(
id: id,
checksum: 'checksum1',
ownerId: ownerId ?? 'owner1',
name: 'test.jpg',
type: domain.AssetType.image,
createdAt: DateTime(2024, 1, 1),
updatedAt: DateTime(2024, 1, 1),
durationInSeconds: 0,
isFavorite: false,
width: width,
height: height,
);
}
static domain.LocalAsset createLocalAsset({
required String id,
String? remoteId,
int? width,
int? height,
int orientation = 0,
}) {
return domain.LocalAsset(
id: id,
remoteId: remoteId,
checksum: 'checksum1',
name: 'test.jpg',
type: domain.AssetType.image,
createdAt: DateTime(2024, 1, 1),
updatedAt: DateTime(2024, 1, 1),
durationInSeconds: 0,
isFavorite: false,
width: width,
height: height,
orientation: orientation,
);
}
}