From eaa8b2d90760cb0748d9e5c91a340798be6484fd Mon Sep 17 00:00:00 2001 From: Ming Ming Date: Mon, 4 Nov 2024 00:47:04 +0800 Subject: [PATCH] Add test case --- np_api/test/entity/file_parser_test.dart | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/np_api/test/entity/file_parser_test.dart b/np_api/test/entity/file_parser_test.dart index 32f63d60..2b41e7ec 100644 --- a/np_api/test/entity/file_parser_test.dart +++ b/np_api/test/entity/file_parser_test.dart @@ -16,6 +16,7 @@ void main() { test("file w/ metadata-photos-ifd0", _filesNc28MetadataIfd0); test("file w/ metadata-photos-exif", _filesNc28MetadataExif); test("file w/ metadata-photos-gps", _filesNc28MetadataGps); + test("file w/ metadata-photos-size", _filesNc28MetadataSize); }); }); } @@ -588,3 +589,50 @@ Future _filesNc28MetadataGps() async { ), ]); } + +Future _filesNc28MetadataSize() async { + const xml = """ + + + + /nextcloud/remote.php/dav/files/admin/1.jpg + + + Fri, 01 Jan 2021 02:03:04 GMT + "1324f58d4d5c8d81bed6e4ed9d5ea862" + image/jpeg + + 123 + 3963036 + false + + 4032 + 3024 + + + HTTP/1.1 200 OK + + + +"""; + final results = await FileParser().parse(xml); + expect(results, [ + File( + href: "/nextcloud/remote.php/dav/files/admin/1.jpg", + contentLength: 3963036, + contentType: "image/jpeg", + etag: "1324f58d4d5c8d81bed6e4ed9d5ea862", + lastModified: DateTime.utc(2021, 1, 1, 2, 3, 4), + hasPreview: false, + fileId: 123, + isCollection: false, + metadataPhotosSize: { + "width": "4032", + "height": "3024", + }, + ), + ]); +}