diff --git a/history.md b/history.md index 2c50a80f62..cf28a91cb5 100644 --- a/history.md +++ b/history.md @@ -63,6 +63,7 @@ Semantic Versioning 2.0.0 is from version 0.1.6+ - [x] (Fixed) _Front-end_ increase description limit (Issue #1810) (PR #1814) - [x] (Fixed) _Back-end_ Change reading order to favor XMP for description/title field (PR #1814) - [x] (Fixed) _Back-end_ OrderBy ImageFormat and then alphabet (PR #1815) +- [x] (Added) _Back-end_ WebP support for sync, reading & writing (PR #1813) ## version 0.6.2 - 2024-10-11 {#v0.6.2} diff --git a/starsky/starsky.foundation.platform/Helpers/ExtensionRolesHelper.cs b/starsky/starsky.foundation.platform/Helpers/ExtensionRolesHelper.cs index 3c02bfb494..de3d2fa289 100644 --- a/starsky/starsky.foundation.platform/Helpers/ExtensionRolesHelper.cs +++ b/starsky/starsky.foundation.platform/Helpers/ExtensionRolesHelper.cs @@ -11,7 +11,7 @@ namespace starsky.foundation.platform.Helpers; public static partial class ExtensionRolesHelper { /// - /// ImageFormat based on first bytes + /// ImageFormat based on first bytes, so read first bytes /// [SuppressMessage("ReSharper", "InconsistentNaming")] public enum ImageFormat @@ -25,6 +25,7 @@ public enum ImageFormat bmp = 13, gif = 14, png = 15, + webp = 16, // Sidecar files xmp = 30, @@ -109,6 +110,11 @@ private static readonly List /// private static readonly List ExtensionMp4 = new() { "mp4", "mov" }; + /// + /// WebP imageFormat + /// + private static readonly List ExtensionWebp = new() { "webp" }; + private static readonly Dictionary> MapFileTypesToExtensionDictionary = new() @@ -120,7 +126,8 @@ private static readonly Dictionary> { ImageFormat.png, ExtensionPng }, { ImageFormat.gpx, ExtensionGpx }, { ImageFormat.mp4, ExtensionMp4 }, - { ImageFormat.xmp, ExtensionXmp } + { ImageFormat.xmp, ExtensionXmp }, + { ImageFormat.webp, ExtensionWebp } }; /// @@ -141,6 +148,7 @@ public static List ExtensionSyncSupportedList extensionList.AddRange(ExtensionMp4); extensionList.AddRange(ExtensionXmp); extensionList.AddRange(ExtensionJsonSidecar); + extensionList.AddRange(ExtensionWebp); return extensionList; } } @@ -159,6 +167,7 @@ private static List ExtensionExifToolSupportedList extensionList.AddRange(ExtensionGif); extensionList.AddRange(ExtensionPng); extensionList.AddRange(ExtensionMp4); + extensionList.AddRange(ExtensionWebp); return extensionList; } } @@ -180,6 +189,7 @@ public static List ExtensionThumbSupportedList extensionList.AddRange(ExtensionBmp); extensionList.AddRange(ExtensionGif); extensionList.AddRange(ExtensionPng); + extensionList.AddRange(ExtensionWebp); return extensionList; } } @@ -441,7 +451,7 @@ private static byte[] ReadBuffer(Stream stream, int size) /// /// Get the format of the image by looking the first bytes - /// Stream is Flushed / Disposed afterwards + /// Stream is Flushed / Disposed afterward /// /// stream /// ImageFormat enum @@ -525,9 +535,30 @@ public static ImageFormat GetImageFormat(byte[] bytes) return ImageFormat.meta_json; } + if ( GetImageFormatMetaWebp(bytes) != null ) + { + return ImageFormat.webp; + } + return ImageFormat.unknown; } + private static ImageFormat? GetImageFormatMetaWebp(byte[] bytes) + { + var webpFirstPart = new byte[] { 82, 73, 70, 70 }; + var webpSecondPart = new byte[] { 87, 69, 66, 80 }; + + var isFirstPart = webpFirstPart.SequenceEqual(bytes.Take(webpFirstPart.Length)); + var isSecondPart = webpSecondPart.SequenceEqual(bytes.Skip(8).Take(webpSecondPart.Length)); + + if ( isFirstPart && isSecondPart ) + { + return ImageFormat.webp; + } + + return null; + } + private static ImageFormat? GetImageFormatMetaJson(byte[] bytes) { var metaJsonUnix = new byte[] diff --git a/starsky/starsky.foundation.readmeta/ReadMetaHelpers/ReadMetaExif.cs b/starsky/starsky.foundation.readmeta/ReadMetaHelpers/ReadMetaExif.cs index 27be3d41b5..2a75d9dcc4 100644 --- a/starsky/starsky.foundation.readmeta/ReadMetaHelpers/ReadMetaExif.cs +++ b/starsky/starsky.foundation.readmeta/ReadMetaHelpers/ReadMetaExif.cs @@ -399,6 +399,11 @@ private static ExtensionRolesHelper.ImageFormat GetFileSpecificTags( return ExtensionRolesHelper.ImageFormat.gif; } + if ( allExifItems.Exists(p => p.Name == "WebP") ) + { + return ExtensionRolesHelper.ImageFormat.webp; + } + return ExtensionRolesHelper.ImageFormat.unknown; } @@ -565,13 +570,13 @@ private static string GetXmpData(Directory? exifItem, string propertyPath) if ( !string.IsNullOrEmpty(xmpTitle) ) { return xmpTitle; - } - + } + var iptcDirectory = allExifItems.OfType().FirstOrDefault(); var iptcObjectName = iptcDirectory?.Tags.FirstOrDefault( p => p.Name == "Object Name")?.Description; iptcObjectName ??= string.Empty; - + return iptcObjectName; } diff --git a/starsky/starsky/clientapp/src/components/atoms/list-image/list-image.tsx b/starsky/starsky/clientapp/src/components/atoms/list-image/list-image.tsx index 9213816cb0..ab5f934be4 100644 --- a/starsky/starsky/clientapp/src/components/atoms/list-image/list-image.tsx +++ b/starsky/starsky/clientapp/src/components/atoms/list-image/list-image.tsx @@ -78,6 +78,7 @@ const ListImage: React.FunctionComponent = memo((props) => { props.imageFormat !== ImageFormat.bmp && props.imageFormat !== ImageFormat.gif && props.imageFormat !== ImageFormat.jpg && + props.imageFormat !== ImageFormat.webp && props.imageFormat !== ImageFormat.png ) { return ( diff --git a/starsky/starsky/clientapp/src/components/organisms/preference-app-settings-desktop/preference-app-settings-desktop.spec.tsx b/starsky/starsky/clientapp/src/components/organisms/preference-app-settings-desktop/preference-app-settings-desktop.spec.tsx index f737cab91a..dbdb21e1a1 100644 --- a/starsky/starsky/clientapp/src/components/organisms/preference-app-settings-desktop/preference-app-settings-desktop.spec.tsx +++ b/starsky/starsky/clientapp/src/components/organisms/preference-app-settings-desktop/preference-app-settings-desktop.spec.tsx @@ -253,9 +253,10 @@ describe("PreferencesAppSettingsDesktop", () => { await waitFor(() => { const query = - "DefaultDesktopEditor%5B0%5D.ImageFormats%5B0%5D=jpg&DefaultDesktopEditor%5B0%5D.ImageFormats%" + - "5B1%5D=png&DefaultDesktopEditor%5B0%5D.ImageFormats%5B2%5D=bmp&DefaultDesktopEditor%5B0%5D.ImageFormats%5B3%5D=tiff&" + - "DefaultDesktopEditor%5B0%5D.ApplicationPath=test"; + "DefaultDesktopEditor%5B0%5D.ImageFormats%5B0%5D=jpg&DefaultDesktopEditor%5B0%5D." + + "ImageFormats%5B1%5D=png&DefaultDesktopEditor%5B0%5D.ImageFormats%5B2%5D=bmp&" + + "DefaultDesktopEditor%5B0%5D.ImageFormats%5B3%5D=tiff&DefaultDesktopEditor%5B0%5D." + + "ImageFormats%5B4%5D=webp&DefaultDesktopEditor%5B0%5D.ApplicationPath=test"; expect(spyFetchPost).toHaveBeenCalledTimes(1); expect(spyFetchPost).toHaveBeenCalledWith(new UrlQuery().UrlApiAppSettings(), query); @@ -354,13 +355,15 @@ describe("updateDefaultEditorPhotos", () => { expect(spyFetchPost).toHaveBeenCalled(); const query = - "DefaultDesktopEditor%5B0%5D.ImageFormats%5B0%5D=jpg&DefaultDesktopEditor%5B0%5D.ImageFormats%" + - "5B1%5D=png&DefaultDesktopEditor%5B0%5D.ImageFormats%5B2%5D=bmp&DefaultDesktopEditor%5B0%5D.ImageFormats%5B3%5D=tiff&" + - "DefaultDesktopEditor%5B0%5D.ApplicationPath=test"; + "DefaultDesktopEditor%5B0%5D.ImageFormats%5B0%5D=jpg&DefaultDesktopEditor%5B0%5D.ImageFormats" + + "%5B1%5D=png&DefaultDesktopEditor%5B0%5D.ImageFormats%5B2%5D=bmp&DefaultDesktopEditor%5B0%5D." + + "ImageFormats%5B3%5D=tiff&DefaultDesktopEditor%5B0%5D.ImageFormats%5B4%5D=webp&DefaultDesktopEditor%5B0%5D." + + "ApplicationPath=test"; + expect(spyFetchPost).toHaveBeenCalledWith(new UrlQuery().UrlApiAppSettings(), query); }); - it("Create new item in Array if emthy array", async () => { + it("should update existing editor and add new editor if array is not empty", async () => { const value = { target: { innerText: "test" } } as unknown as ChangeEvent; @@ -388,10 +391,14 @@ describe("updateDefaultEditorPhotos", () => { expect(spyFetchPost).toHaveBeenCalled(); const query2 = - "DefaultDesktopEditor%5B0%5D.ImageFormats%5B0%5D=jpg&DefaultDesktopEditor%5B0%5D.ImageFormats%5B1%5D=png&DefaultDesktopEditor" + - "%5B0%5D.ImageFormats%5B2%5D=bmp&DefaultDesktopEditor%5B0%5D.ImageFormats%5B3%5D=tiff&DefaultDesktopEditor%5B0%5D.ApplicationPath=%2Fexist_app&" + - "DefaultDesktopEditor%5B1%5D.ImageFormats%5B0%5D=jpg&DefaultDesktopEditor%5B1%5D.ImageFormats%5B1%5D=png&DefaultDesktopEditor%5B1%5D.ImageFormats%5B2%5D=bmp&" + - "DefaultDesktopEditor%5B1%5D.ImageFormats%5B3%5D=tiff&DefaultDesktopEditor%5B1%5D.ApplicationPath=test"; + "DefaultDesktopEditor%5B0%5D.ImageFormats%5B0%5D=jpg&DefaultDesktopEditor%5B0%5D." + + "ImageFormats%5B1%5D=png&DefaultDesktopEditor%5B0%5D.ImageFormats%5B2%5D=bmp&" + + "DefaultDesktopEditor%5B0%5D.ImageFormats%5B3%5D=tiff&" + + "DefaultDesktopEditor%5B0%5D.ImageFormats%5B4%5D=webp&DefaultDesktopEditor" + + "%5B0%5D.ApplicationPath=%2Fexist_app&DefaultDesktopEditor%5B1%5D.ImageFormats%5B0%5D=jpg" + + "&DefaultDesktopEditor%5B1%5D.ImageFormats%5B1%5D=png&DefaultDesktopEditor%5B1%5D.ImageFormats%5B2%5D=bmp" + + "&DefaultDesktopEditor%5B1%5D.ImageFormats%5B3%5D=tiff&DefaultDesktopEditor%5B1%5D.ImageFormats%5B4%5D=webp" + + "&DefaultDesktopEditor%5B1%5D.ApplicationPath=test"; expect(spyFetchPost).toHaveBeenCalledWith(new UrlQuery().UrlApiAppSettings(), query2); }); diff --git a/starsky/starsky/clientapp/src/components/organisms/preference-app-settings-desktop/preference-app-settings-desktop.tsx b/starsky/starsky/clientapp/src/components/organisms/preference-app-settings-desktop/preference-app-settings-desktop.tsx index e2dc8d99e3..8076e54942 100644 --- a/starsky/starsky/clientapp/src/components/organisms/preference-app-settings-desktop/preference-app-settings-desktop.tsx +++ b/starsky/starsky/clientapp/src/components/organisms/preference-app-settings-desktop/preference-app-settings-desktop.tsx @@ -13,7 +13,13 @@ import FormControl from "../../atoms/form-control/form-control"; import SwitchButton from "../../atoms/switch-button/switch-button"; const defaultEditorApplication = { - imageFormats: [ImageFormat.jpg, ImageFormat.png, ImageFormat.bmp, ImageFormat.tiff] + imageFormats: [ + ImageFormat.jpg, + ImageFormat.png, + ImageFormat.bmp, + ImageFormat.tiff, + ImageFormat.webp + ] } as IAppSettingsDefaultEditorApplication; export async function UpdateDefaultEditorPhotos( diff --git a/starsky/starsky/clientapp/src/interfaces/IFileIndexItem.ts b/starsky/starsky/clientapp/src/interfaces/IFileIndexItem.ts index 22e07d4990..91c0ef074f 100644 --- a/starsky/starsky/clientapp/src/interfaces/IFileIndexItem.ts +++ b/starsky/starsky/clientapp/src/interfaces/IFileIndexItem.ts @@ -44,6 +44,7 @@ export enum ImageFormat { bmp = "bmp", gif = "gif", png = "png", + webp = "webp", xmp = "xmp", meta_json = "meta_json", gpx = "gpx", diff --git a/starsky/starsky/clientapp/src/style/css/21-archive-folder.css b/starsky/starsky/clientapp/src/style/css/21-archive-folder.css index 805629dd81..0289dc7875 100644 --- a/starsky/starsky/clientapp/src/style/css/21-archive-folder.css +++ b/starsky/starsky/clientapp/src/style/css/21-archive-folder.css @@ -1,48 +1,48 @@ .folder { - display: flex; - flex-flow: row wrap; + display: flex; + flex-flow: row wrap; } .list-image-box { - width: 300px; - height: 300px; - padding: 10px; - background-color: transparent; + width: 300px; + height: 300px; + padding: 10px; + background-color: transparent; } .list-image-box > .box-content { - display: block; - box-shadow: 0px 0px 5px 2px rgba(162, 161, 161, 0.25); - height: 100%; - border-radius: 5px; - text-decoration: none; - color: #263238; - width: 100%; - transition: box-shadow ease-in-out 0.7s; + display: block; + box-shadow: 0px 0px 5px 2px rgba(162, 161, 161, 0.25); + height: 100%; + border-radius: 5px; + text-decoration: none; + color: #263238; + width: 100%; + transition: box-shadow ease-in-out 0.7s; } .list-image-box > .box-content:focus { - box-shadow: 0px 0px 5px 2px rgba(40, 53, 147, 0.75); + box-shadow: 0px 0px 5px 2px rgba(40, 53, 147, 0.75); } .list-image-box--select > .box-content { - cursor: grabbing; - background-color: transparent; + cursor: grabbing; + background-color: transparent; } @media (prefers-color-scheme: dark) { - .list-image-box > .box-content { - box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.25); - } + .list-image-box > .box-content { + box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.25); + } } /* center for phones */ @media screen and (max-width: 500px) { - .list-image-box { - margin-left: auto; - margin-right: auto; - width: 100%; - } + .list-image-box { + margin-left: auto; + margin-right: auto; + width: 100%; + } } /* @@ -50,297 +50,302 @@ large phones and disabled in collapsed mode between 1 and 2 items */ @media screen and (min-width: 500px) and (max-width: 799px) { - .list-image-box { - width: 50%; - } + .list-image-box { + width: 50%; + } } /* between 2 and 3 items */ @media screen and (min-width: 800px) and (max-width: 970px) { - .list-image-box { - width: 33%; - } + .list-image-box { + width: 33%; + } } /* between 3 and 4 items */ @media screen and (min-width: 971px) and (max-width: 1279px) { - .list-image-box { - width: 25%; - } + .list-image-box { + width: 25%; + } } /* between 5 and 6 items */ @media screen and (min-width: 1280px) and (max-width: 1559px) { - .list-image-box { - width: 20%; - } + .list-image-box { + width: 20%; + } } /* between 6 and 7 items */ @media screen and (min-width: 1560px) and (max-width: 1870px) { - .list-image-box { - width: 16.6%; - } + .list-image-box { + width: 16.6%; + } } /* select */ .list-image-box--select > .isDirectory-true.box-content:before, .list-image-box--select > .isDirectory-false.box-content:before { - position: absolute; - margin-left: 10px; - margin-top: 10px; - width: 40px; - height: 40px; - display: block; - border-radius: 20px; - border: #607d8b solid 5px; - box-shadow: 0px 0px 5px 2px rgba(162, 161, 161, 0.5); - content: ""; - z-index: 5; + position: absolute; + margin-left: 10px; + margin-top: 10px; + width: 40px; + height: 40px; + display: block; + border-radius: 20px; + border: #607d8b solid 5px; + box-shadow: 0px 0px 5px 2px rgba(162, 161, 161, 0.5); + content: ""; + z-index: 5; } /* select */ .list-image-box--select > .isDirectory-true.box-content--selected:before, .list-image-box--select > .isDirectory-false.box-content--selected:before { - width: 40px; - height: 40px; - background-image: url("../images/baseline-check_circle-cover-sized-1565c0-24px.svg"); - background-size: contain; - border: 0px; - z-index: 5; + width: 40px; + height: 40px; + background-image: url("../images/baseline-check_circle-cover-sized-1565c0-24px.svg"); + background-size: contain; + border: 0px; + z-index: 5; } .list-image-box > .box-content > .caption { - display: block; - height: 31%; - border-bottom-left-radius: 5px; - border-bottom-right-radius: 5px; - border-left-width: 0px; - border-right-width: 0px; - transition: background ease-in-out 0.5s; + display: block; + height: 31%; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + border-left-width: 0px; + border-right-width: 0px; + transition: background ease-in-out 0.5s; } @media (prefers-color-scheme: dark) { - .list-image-box > .box-content > .caption { - color: white; - } + .list-image-box > .box-content > .caption { + color: white; + } } .list-image-box--view > .box-content:hover .caption { - background-color: #b0bec5; + background-color: #b0bec5; } .list-image-box--view > .box-content:hover { - background-color: #cfd8dc; + background-color: #cfd8dc; } /* should not exist */ .list-image-box > .box-content.colorclass---1 .caption { - border-top: #90a4ae solid 12px; + border-top: #90a4ae solid 12px; } /* geen/kleurloos */ .list-image-box > .box-content.colorclass--0 .caption { - border-top: #90a4ae solid 12px; + border-top: #90a4ae solid 12px; } /* pink */ .list-image-box > .box-content.colorclass--1 .caption { - border-top: #f06292 solid 12px; + border-top: #f06292 solid 12px; } /* red */ .list-image-box > .box-content.colorclass--2 .caption { - border-top: #ef5350 solid 12px; + border-top: #ef5350 solid 12px; } /* Orange */ .list-image-box > .box-content.colorclass--3 .caption { - border-top: #ffb74d solid 12px; + border-top: #ffb74d solid 12px; } /* yellow */ .list-image-box > .box-content.colorclass--4 .caption { - border-top: #ffeb3b solid 12px; + border-top: #ffeb3b solid 12px; } /* green */ .list-image-box > .box-content.colorclass--5 .caption { - border-top: #66bb6a solid 12px; + border-top: #66bb6a solid 12px; } /* azure */ .list-image-box > .box-content.colorclass--6 .caption { - border-top: #26c6da solid 12px; + border-top: #26c6da solid 12px; } /* blue */ .list-image-box > .box-content.colorclass--7 .caption { - border-top: #5c6bc0 solid 12px; + border-top: #5c6bc0 solid 12px; } /* grey = 8*/ .list-image-box > .box-content.colorclass--8 .caption { - border-top: #455a64 solid 12px; + border-top: #455a64 solid 12px; } .folder > .warning-box { - margin-top: 15px; + margin-top: 15px; } .folder > .warning-box.warning-box--left { - margin-left: 10px; + margin-left: 10px; } /* // .tags */ .list-image-box > .box-content > .caption > div { - padding-left: 10px; - padding-right: 10px; - padding-top: 5px; - line-height: 1.15; /* not 1.3 */ - overflow: hidden; - text-overflow: ellipsis; /* ... */ + padding-left: 10px; + padding-right: 10px; + padding-top: 5px; + line-height: 1.15; /* not 1.3 */ + overflow: hidden; + text-overflow: ellipsis; /* ... */ } .list-image-box > .box-content > .caption > .name { - padding-top: 8px; - font-weight: 300; - white-space: nowrap; + padding-top: 8px; + font-weight: 300; + white-space: nowrap; } .list-image-box > .box-content > .caption > .tags { - padding-top: 5px; - font-size: 16px; - display: block; /* Fallback for non-webkit */ - display: -webkit-box; - max-width: 100%; - height: 40px; /* $font-size*$line-height*$lines-to-show Fallback for non-webkit */ - margin: 0 auto; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; - overflow: hidden; + padding-top: 5px; + font-size: 16px; + display: block; /* Fallback for non-webkit */ + display: -webkit-box; + max-width: 100%; + height: 40px; /* $font-size*$line-height*$lines-to-show Fallback for non-webkit */ + margin: 0 auto; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + overflow: hidden; } .list-image-box > .box-content.isDirectory-true > .caption > .name:before { - background-image: url("../images/baseline-folder-24px.svg"); - background-size: cover; - height: 14px; - width: 14px; - margin-right: 5px; - content: ""; - display: inline-block; + background-image: url("../images/baseline-folder-24px.svg"); + background-size: cover; + height: 14px; + width: 14px; + margin-right: 5px; + content: ""; + display: inline-block; } @media (prefers-color-scheme: dark) { - .list-image-box > .box-content.isDirectory-true > .caption > .name:before { - filter: invert(100%); - } + .list-image-box > .box-content.isDirectory-true > .caption > .name:before { + filter: invert(100%); + } } .list-image-box > .box-content > .img-box { - height: 69%; - width: 100%; + height: 69%; + width: 100%; } .list-image-box > .box-content > .img-box > img { - width: 100%; - height: 100%; - border-top-left-radius: 5px; - border-top-right-radius: 5px; - object-fit: contain; - object-position: center; - border: 0px #fff solid; + width: 100%; + height: 100%; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + object-fit: contain; + object-position: center; + border: 0px #fff solid; } .list-image-box > .box-content.isDirectory-true > .img-box > img { - width: 60%; - height: 49%; - margin-left: 20%; - margin-top: 15%; - opacity: 0.5; - transition: opacity ease-in-out 0.15s; + width: 60%; + height: 49%; + margin-left: 20%; + margin-top: 15%; + opacity: 0.5; + transition: opacity ease-in-out 0.15s; } .list-image-box > .box-content.isDirectory-true:hover > .img-box > img { - opacity: 1; + opacity: 1; } .list-image-box > .box-content > .img-box--error > img { - display: none; + display: none; } .list-image-box .box-content .img-box--loading, .list-image-box > .box-content.isDirectory-true > .img-box, .list-image-box > .box-content > .img-box--error { - height: 70%; - background-repeat: no-repeat; - background-position: center center; - background-size: 60px 60px; + height: 70%; + background-repeat: no-repeat; + background-position: center center; + background-size: 60px 60px; } .list-image-box > .box-content.isDirectory-true > .img-box--error { - background-image: url("../images/folder-no-child-styled.svg"); + background-image: url("../images/folder-no-child-styled.svg"); } .list-image-box > .box-content.isDirectory-true > .img-box--error:hover { - background-image: url("../images/folder-no-child-styled-hover.svg"); + background-image: url("../images/folder-no-child-styled-hover.svg"); } .list-image-box > .box-content.isDirectory-false > .img-box--error { - background-image: url("../images/baseline-broken_image-24px.svg"); + background-image: url("../images/baseline-broken_image-24px.svg"); } .list-image-box > .box-content.isDirectory-false > .img-box--gpx { - background-image: url("../images/baseline-file-gpx-24px.svg"); + background-image: url("../images/baseline-file-gpx-24px.svg"); } .list-image-box > .box-content.isDirectory-false > .img-box--tiff { - background-image: url("../images/baseline-file-raw-24px.svg"); + background-image: url("../images/baseline-file-raw-24px.svg"); } .list-image-box > .box-content.isDirectory-false > .img-box--mp4 { - background-image: url("../images/baseline-file-mp4-24px.svg"); + background-image: url("../images/baseline-file-mp4-24px.svg"); } .list-image-box > .box-content.isDirectory-false > .img-box--jpg { - background-image: url("../images/baseline-file-jpg-24px.svg"); + background-image: url("../images/baseline-file-jpg-24px.svg"); +} + +.list-image-box > .box-content.isDirectory-false > .img-box--webp { + background-image: url("../images/baseline-file-outline.svg"); } .list-image-box > .box-content.isDirectory-false > .img-box--xmp { - background-image: url("../images/baseline-file-xmp-24px.svg"); + background-image: url("../images/baseline-file-xmp-24px.svg"); } .list-image-box > .box-content.isDirectory-false > .img-box--bmp { - background-image: url("../images/baseline-file-bmp-24px.svg"); + background-image: url("../images/baseline-file-bmp-24px.svg"); } .list-image-box > .box-content.isDirectory-false > .img-box--png { - background-image: url("../images/baseline-file-png-24px.svg"); + background-image: url("../images/baseline-file-png-24px.svg"); } @media (prefers-color-scheme: dark) { - .list-image-box > .box-content.isDirectory-false > .img-box--error, - .list-image-box > .box-content.isDirectory-false > .img-box--gpx, - .list-image-box > .box-content.isDirectory-false > .img-box--tiff, - .list-image-box > .box-content.isDirectory-false > .img-box--mp4, - .list-image-box > .box-content.isDirectory-false > .img-box--jpg, - .list-image-box > .box-content.isDirectory-false > .img-box--bmp, - .list-image-box > .box-content.isDirectory-false > .img-box--png { - filter: invert(100%); - } + .list-image-box > .box-content.isDirectory-false > .img-box--error, + .list-image-box > .box-content.isDirectory-false > .img-box--gpx, + .list-image-box > .box-content.isDirectory-false > .img-box--tiff, + .list-image-box > .box-content.isDirectory-false > .img-box--mp4, + .list-image-box > .box-content.isDirectory-false > .img-box--jpg, + .list-image-box > .box-content.isDirectory-false > .img-box--bmp, + .list-image-box > .box-content.isDirectory-false > .img-box--png, + .list-image-box > .box-content.isDirectory-false > .img-box--webp { + filter: invert(100%); + } } .list-image-box > .box-content > .img-box--loading > img { - width: 0px; - height: 0px; + width: 0px; + height: 0px; } .list-image-box .box-content .img-box--loading { - background-image: url("../images/preloader-fancy.svg"); + background-image: url("../images/preloader-fancy.svg"); } @media (prefers-color-scheme: dark) { - .list-image-box .box-content .img-box--loading { - filter: invert(100%); - } + .list-image-box .box-content .img-box--loading { + filter: invert(100%); + } } diff --git a/starsky/starskytest/FakeCreateAn/CreateAnImageWebP/CreateAnImageWebP.cs b/starsky/starskytest/FakeCreateAn/CreateAnImageWebP/CreateAnImageWebP.cs new file mode 100644 index 0000000000..9502a53b4a --- /dev/null +++ b/starsky/starskytest/FakeCreateAn/CreateAnImageWebP/CreateAnImageWebP.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Immutable; +using System.IO; +using System.Reflection; +using starsky.foundation.storage.Storage; +using starskytest.FakeMocks; + +namespace starskytest.FakeCreateAn.CreateAnImageWebP; + +public class CreateAnImageWebP +{ + public readonly ImmutableArray Bytes = [..Array.Empty()]; + + public CreateAnImageWebP() + { + var dirName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + if ( string.IsNullOrEmpty(dirName) ) + { + return; + } + + var path = Path.Combine(dirName, "FakeCreateAn", + "CreateAnImageWebP", "test.webp"); + + Bytes = [..StreamToBytes(path)]; + } + + private static byte[] StreamToBytes(string path) + { + var input = new StorageHostFullPathFilesystem(new FakeIWebLogger()).ReadStream(path); + using var ms = new MemoryStream(); + input.CopyTo(ms); + input.Dispose(); + return ms.ToArray(); + } +} + diff --git a/starsky/starskytest/FakeCreateAn/CreateAnImageWebP/test.webp b/starsky/starskytest/FakeCreateAn/CreateAnImageWebP/test.webp new file mode 100644 index 0000000000..ec0f71f3fe Binary files /dev/null and b/starsky/starskytest/FakeCreateAn/CreateAnImageWebP/test.webp differ diff --git a/starsky/starskytest/starsky.foundation.platform/Helpers/ExtensionRolesHelperTest.cs b/starsky/starskytest/starsky.foundation.platform/Helpers/ExtensionRolesHelperTest.cs index ba299fd27e..934688a845 100644 --- a/starsky/starskytest/starsky.foundation.platform/Helpers/ExtensionRolesHelperTest.cs +++ b/starsky/starskytest/starsky.foundation.platform/Helpers/ExtensionRolesHelperTest.cs @@ -5,570 +5,598 @@ using starsky.foundation.platform.Helpers; using starskytest.FakeCreateAn; using starskytest.FakeCreateAn.CreateAnImageCorrupt; +using starskytest.FakeCreateAn.CreateAnImageWebP; -namespace starskytest.starsky.foundation.platform.Helpers +namespace starskytest.starsky.foundation.platform.Helpers; + +[TestClass] +public sealed class ExtensionRolesHelperTest { - [TestClass] - public sealed class ExtensionRolesHelperTest + [TestMethod] + public void Files_ExtensionThumbSupportedList_TiffMp4MovXMPCheck() { - [TestMethod] - public void Files_ExtensionThumbSupportedList_TiffMp4MovXMPCheck() - { - Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.tiff")); - Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.mp4")); - Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.mov")); - Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.xmp")); - } - - [TestMethod] - public void Files_ExtensionThumbSupportedList_JpgCheck() - { - Assert.IsTrue(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.jpg")); - Assert.IsTrue(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.bmp")); - } + Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.tiff")); + Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.mp4")); + Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.mov")); + Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.xmp")); + } - [TestMethod] - public void Files_ExtensionThumbSupportedList_null() - { - Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported(null)); - // equal or less then three chars - Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported("nul")); - } + [TestMethod] + public void Files_ExtensionThumbSupportedList_JpgCheck() + { + Assert.IsTrue(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.jpg")); + Assert.IsTrue(ExtensionRolesHelper.IsExtensionThumbnailSupported("file.bmp")); + } - [TestMethod] - public void Files_ExtensionThumbSupportedList_FolderName() - { - Assert.IsFalse( - ExtensionRolesHelper.IsExtensionThumbnailSupported("Some Foldername")); - } + [TestMethod] + public void Files_ExtensionThumbSupportedList_null() + { + Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported(null)); + // equal or less then three chars + Assert.IsFalse(ExtensionRolesHelper.IsExtensionThumbnailSupported("nul")); + } - [TestMethod] - public void Files_ExtensionSyncSupportedList_TiffCheck() - { - var extensionSyncSupportedList = ExtensionRolesHelper.ExtensionSyncSupportedList; - Assert.IsTrue(extensionSyncSupportedList.Contains("tiff")); - Assert.IsTrue(extensionSyncSupportedList.Contains("jpg")); - } + [TestMethod] + public void Files_ExtensionThumbSupportedList_FolderName() + { + Assert.IsFalse( + ExtensionRolesHelper.IsExtensionThumbnailSupported("Some Foldername")); + } - [TestMethod] - public void Files_GetImageFormat_png_Test() - { - var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 137, 80, 78, 71 }); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.png, fileType); - } + [TestMethod] + public void Files_ExtensionSyncSupportedList_TiffCheck() + { + var extensionSyncSupportedList = ExtensionRolesHelper.ExtensionSyncSupportedList; + Assert.IsTrue(extensionSyncSupportedList.Contains("tiff")); + Assert.IsTrue(extensionSyncSupportedList.Contains("jpg")); + } - [TestMethod] - public void GetImageFormat_Png_Test() - { - var newImage = CreateAnPng.Bytes.Take(15).ToArray(); - var result = ExtensionRolesHelper.GetImageFormat(newImage); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.png, result); - } + [TestMethod] + public void Files_GetImageFormat_png_Test() + { + var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 137, 80, 78, 71 }); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.png, fileType); + } - [TestMethod] - public void Files_GetImageFormat_jpeg2_Test() - { - var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 255, 216, 255, 225 }); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); - } + [TestMethod] + public void GetImageFormat_Png_Test() + { + var newImage = CreateAnPng.Bytes.Take(15).ToArray(); + var result = ExtensionRolesHelper.GetImageFormat(newImage); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.png, result); + } + [TestMethod] + public void Files_GetImageFormat_jpeg2_Test() + { + var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 255, 216, 255, 225 }); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); + } - [TestMethod] - public void Files_GetImageFormat_jpeg_FF_D8_FF_DB_Test() - { - var fileType = - ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray("FFD8FFDB")); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); - } - - [TestMethod] - public void Files_GetImageFormat_jpeg_FF_D8_FF_E0_00_10_Test() - { - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray( - "FF D8 FF E0 00 10 4A 46 49 46 00 01".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); - } - - [TestMethod] - public void Files_GetImageFormat_jpeg_FF_D8_FF_EE_Test() - { - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray("FF D8 FF EE ".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); - } - [TestMethod] - public void Files_GetImageFormat_jpeg_FF_D8_FF_E1___45_78_Test() - { - // FF D8 FF E1 ?? ?? 45 78 - // 69 66 00 00 - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray("FF D8 FF E1".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); - } - - [TestMethod] - public void Files_GetImageFormat_jpeg_FF_D8_FF_E0_Test() - { - // FF D8 FF E0 - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray("FF D8 FF E0 ".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); - } - - [TestMethod] - public void Files_GetImageFormat_png_89_50_4E_47_0D_0A_1A_0A() - { - // 89 50 4E 47 0D 0A 1A 0A - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray( - "89 50 4E 47 0D 0A 1A 0A".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.png, fileType); - } - - [TestMethod] - public void Files_GetImageFormat_pdf() - { - // 25 50 44 46 2D - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray("25 50 44 46 2D".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.pdf, fileType); - } - - [TestMethod] - public void Files_GetImageFormat_Mpeg4_66_74_79_70_69_73_6F_6D() - { - // 66 74 79 70 69 73 6F 6D - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray( - "66 74 79 70 69 73 6F 6D".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.mp4, fileType); - } - - [TestMethod] - public void Files_GetImageFormat_Tiff_49_49_2A_00_little_endian() - { - // 49_49_2A_00_little_endian - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray("49 49 2A 00".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); - } - - [TestMethod] - public void Files_GetImageFormat_Tiff_olympusRaw() - { - var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 73, 73, 82 }); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); - } + [TestMethod] + public void Files_GetImageFormat_jpeg_FF_D8_FF_DB_Test() + { + var fileType = + ExtensionRolesHelper.GetImageFormat( + ExtensionRolesHelper.HexStringToByteArray("FFD8FFDB")); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); + } - [TestMethod] - public void Files_GetImageFormat_Tiff_fujiFilmRaw() - { - var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 70, 85, 74 }); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); - } + [TestMethod] + public void Files_GetImageFormat_jpeg_FF_D8_FF_E0_00_10_Test() + { + var fileType = ExtensionRolesHelper.GetImageFormat( + ExtensionRolesHelper.HexStringToByteArray( + "FF D8 FF E0 00 10 4A 46 49 46 00 01".Replace(" ", ""))); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); + } - [TestMethod] - public void Files_GetImageFormat_Tiff_panasonicRaw() - { - var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 73, 73, 85, 0 }); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); - } + [TestMethod] + public void Files_GetImageFormat_jpeg_FF_D8_FF_EE_Test() + { + var fileType = ExtensionRolesHelper.GetImageFormat( + ExtensionRolesHelper.HexStringToByteArray("FF D8 FF EE ".Replace(" ", ""))); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); + } - [TestMethod] - public void Files_GetImageFormat_Tiff_4D_4D_00_2A_big_endian() - { - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray("4D 4D 00 2A".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); - } + [TestMethod] + public void Files_GetImageFormat_jpeg_FF_D8_FF_E1___45_78_Test() + { + // FF D8 FF E1 ?? ?? 45 78 + // 69 66 00 00 + var fileType = ExtensionRolesHelper.GetImageFormat( + ExtensionRolesHelper.HexStringToByteArray("FF D8 FF E1".Replace(" ", ""))); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); + } - [TestMethod] - public void Files_GetImageFormat_zip_50_4B_03_04() - { - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray("50 4B 03 04".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.zip, fileType); - } + [TestMethod] + public void Files_GetImageFormat_jpeg_FF_D8_FF_E0_Test() + { + // FF D8 FF E0 + var fileType = ExtensionRolesHelper.GetImageFormat( + ExtensionRolesHelper.HexStringToByteArray("FF D8 FF E0 ".Replace(" ", ""))); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, fileType); + } - [TestMethod] - public void Files_GetImageFormat_bmp_42_4D() - { - var fileType = ExtensionRolesHelper.GetImageFormat( - ExtensionRolesHelper.HexStringToByteArray("42 4D".Replace(" ", ""))); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.bmp, fileType); - } + [TestMethod] + public void Files_GetImageFormat_png_89_50_4E_47_0D_0A_1A_0A() + { + // 89 50 4E 47 0D 0A 1A 0A + var fileType = ExtensionRolesHelper.GetImageFormat( + ExtensionRolesHelper.HexStringToByteArray( + "89 50 4E 47 0D 0A 1A 0A".Replace(" ", ""))); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.png, fileType); + } - [TestMethod] - public void Files_GetImageFormat_MetaJson_1() - { - var metaJson = new byte[] - { - 123, 10, 32, 32, 34, 36, 105, 100, 34, 58, 32, 34, 104, 116, 116, 112, 115, 58, - 47, 47, 100, 111, 99, 115, 46, 113, 100, 114, 97, 119, 46, 110, 108, 47, 115, - 99, 104, 101, 109, 97, 47, 109, 101, 116, 97, 45, 100, 97, 116, 97, 45, 99, 111, - 110, 116, 97, 105, 110, 101, 114, 46, 106, 115, 111, 110, 34, 44 - }; - - var fileType = ExtensionRolesHelper.GetImageFormat(metaJson); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.meta_json, fileType); - } - - [TestMethod] - public void Files_GetImageFormat_MetaJson_Windows() - { - var metaJsonWindows = new byte[] - { - // 13 is CR - 123, 13, 10, 32, 32, 34, 36, 105, 100, 34, 58, 32, 34, 104, 116, 116, 112, 115, 58, - 47, 47, 100, 111, 99, 115, 46, 113, 100, 114, 97, 119, 46, 110, 108, 47, 115, 99, - 104, 101, 109, 97, 47, 109, 101, 116, 97, 45, 100, 97, 116, 97, 45, 99, 111, 110, - 116, 97, 105, 110, 101, 114, 46, 106, 115, 111, 110, 34 - }; - // B0D0A202022246964223A202268747470733A2F2F646F63732E71647261772E6E6C2F736368656D612F6D6574612D646174612D636F6E7461696E65722E6A736F6E22 - - var fileType = ExtensionRolesHelper.GetImageFormat(metaJsonWindows); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.meta_json, fileType); - } - - [TestMethod] - public void Files_GetImageFormat_corrupt_Test() - { - var fileType = - ExtensionRolesHelper.GetImageFormat(new CreateAnImageCorrupt().Bytes.ToArray()); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.unknown, fileType); - } + [TestMethod] + public void Files_GetImageFormat_pdf() + { + // 25 50 44 46 2D + var fileType = ExtensionRolesHelper.GetImageFormat( + ExtensionRolesHelper.HexStringToByteArray("25 50 44 46 2D".Replace(" ", ""))); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.pdf, fileType); + } - [TestMethod] - public void GetImageFormat_Jpeg_Test() - { - var newImage = CreateAnImage.Bytes.Take(15).ToArray(); - var result = ExtensionRolesHelper.GetImageFormat(newImage); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.jpg, result); - } + [TestMethod] + public void Files_GetImageFormat_Mpeg4_66_74_79_70_69_73_6F_6D() + { + // 66 74 79 70 69 73 6F 6D + var fileType = ExtensionRolesHelper.GetImageFormat( + ExtensionRolesHelper.HexStringToByteArray( + "66 74 79 70 69 73 6F 6D".Replace(" ", ""))); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.mp4, fileType); + } - [TestMethod] - public void Files_GetImageFormat_tiff2_Test() - { - var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 77, 77, 42 }); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); - } + [TestMethod] + public void Files_GetImageFormat_Tiff_49_49_2A_00_little_endian() + { + // 49_49_2A_00_little_endian + var fileType = ExtensionRolesHelper.GetImageFormat( + ExtensionRolesHelper.HexStringToByteArray("49 49 2A 00".Replace(" ", ""))); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); + } - [TestMethod] - public void Files_GetImageFormat_tiff3_Test() - { - var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 77, 77, 0 }); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); - } + [TestMethod] + public void Files_GetImageFormat_Tiff_olympusRaw() + { + var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 73, 73, 82 }); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); + } - [TestMethod] - public void Files_GetImageFormat_bmp_Test() - { - byte[] bmBytes = Encoding.ASCII.GetBytes("BM"); - var fileType = ExtensionRolesHelper.GetImageFormat(bmBytes); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.bmp, fileType); - } + [TestMethod] + public void Files_GetImageFormat_Tiff_fujiFilmRaw() + { + var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 70, 85, 74 }); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); + } - [TestMethod] - public void Files_GetImageFormat_gif_Test() - { - byte[] bmBytes = Encoding.ASCII.GetBytes("GIF"); - var fileType = ExtensionRolesHelper.GetImageFormat(bmBytes); - Assert.AreEqual(ExtensionRolesHelper.ImageFormat.gif, fileType); - } + [TestMethod] + public void Files_GetImageFormat_Tiff_panasonicRaw() + { + var fileType = ExtensionRolesHelper.GetImageFormat(new byte[] { 73, 73, 85, 0 }); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.tiff, fileType); + } - [TestMethod] - public void Files_GetImageFormat_xmp_Test() - { - byte[] bmBytes = Encoding.ASCII.GetBytes("\r\n\n\r\n\n\r\n\n\r\n\n { "/" }, + new List { "/test.webp" }, new List { newImage }); + + var item = + new ReadMetaExif(fakeStorage, null!, new FakeIWebLogger()).ReadExifFromFile( + "/test.webp"); + + Assert.AreEqual(ColorClassParser.Color.WinnerAlt, item.ColorClass); + Assert.AreEqual(9, item.Aperture); + Assert.AreEqual(ColorClassParser.Color.WinnerAlt, item.ColorClass); + Assert.AreEqual(new DateTime(2024, 11, 6, 17, 14, 2, DateTimeKind.Local), item.DateTime); + Assert.AreEqual(18, item.FocalLength); + Assert.AreEqual(0, item.Id); + Assert.AreEqual(ExtensionRolesHelper.ImageFormat.webp, item.ImageFormat); + Assert.AreEqual(( ushort ) 1, item.ImageHeight); + Assert.AreEqual(ImageStabilisationType.Unknown, item.ImageStabilisation); + Assert.AreEqual(( ushort ) 1, item.ImageWidth); + Assert.IsFalse(item.IsDirectory); + Assert.AreEqual(( ushort ) 12800, item.IsoSpeed); + Assert.AreEqual(50.8646861111, item.Latitude, 0.0000000001); + Assert.AreEqual("E 18-200mm F3.5-6.3 OSS LE", item.LensModel); + Assert.AreEqual(69, item.LocationAltitude); + Assert.AreEqual(string.Empty, item.LocationCity); + Assert.AreEqual(string.Empty, item.LocationCountry); + Assert.AreEqual("NLD", item.LocationCountryCode); + Assert.AreEqual(string.Empty, item.LocationState); + Assert.AreEqual(5.8325499999, item.Longitude, 0.0000000001); + Assert.AreEqual("Sony", item.Make); + Assert.AreEqual("Sony|ILCE-6600|E 18-200mm F3.5-6.3 OSS LE", item.MakeModel); + Assert.AreEqual("ILCE-6600", item.Model); + Assert.AreEqual(FileIndexItem.Rotation.Horizontal, item.Orientation); + Assert.AreEqual("1/60", item.ShutterSpeed); + Assert.AreEqual(string.Empty, item.SidecarExtensions); + Assert.AreEqual("Qdraw 1.0", item.Software); + Assert.AreEqual("Geulpoort, Valkenburg, Geul, poort, kasteel, kerk", item.Tags); + Assert.AreEqual("Geulpoort", item.Title); + } + [TestMethod] public void ImageStabilisationOn() { diff --git a/starsky/starskytest/starskytest.csproj b/starsky/starskytest/starskytest.csproj index 326bbfb689..96eb29710a 100644 --- a/starsky/starskytest/starskytest.csproj +++ b/starsky/starskytest/starskytest.csproj @@ -143,6 +143,10 @@ PreserveNewest + + + PreserveNewest +