diff --git a/controlgallery/AtomUIGallery.Desktop/configs/InstallerConfig.appimage.xml b/controlgallery/AtomUIGallery.Desktop/configs/InstallerConfig.appimage.xml index e9bc9c0e5..c76cf7056 100644 --- a/controlgallery/AtomUIGallery.Desktop/configs/InstallerConfig.appimage.xml +++ b/controlgallery/AtomUIGallery.Desktop/configs/InstallerConfig.appimage.xml @@ -5,10 +5,10 @@ __VERSION__ net.atomui.gallery AtomUIGallery Installer - Assets/Images/icons + Assets/Images/AppLogo.iconset Qinware Qinware Technology Co., Ltd. https://www.qinware.com Copyright Qinware Technology Co., Ltd. - Assets/Images/AtomUIGallery.png - \ No newline at end of file + Assets/Images/AppLogo.iconset/icon_512x512.png + diff --git a/tests/AtomUIGallery.Tests/Workspace/GalleryInstallerAssetTests.cs b/tests/AtomUIGallery.Tests/Workspace/GalleryInstallerAssetTests.cs new file mode 100644 index 000000000..ff6225427 --- /dev/null +++ b/tests/AtomUIGallery.Tests/Workspace/GalleryInstallerAssetTests.cs @@ -0,0 +1,51 @@ +using System; +using System.IO; +using System.Linq; +using System.Xml.Linq; +using Shouldly; +using Xunit; + +namespace AtomUIGallery.Tests.Workspace; + +public class GalleryInstallerAssetTests +{ + [Fact] + public void AppImage_Config_References_Existing_Installer_Assets() + { + var desktopProjectPath = GetRepoDirectory("controlgallery/AtomUIGallery.Desktop"); + var configPath = Path.Combine(desktopProjectPath, "configs/InstallerConfig.appimage.xml"); + var config = XDocument.Load(configPath); + + var appIcon = ReadRequiredElement(config, "AppIcon"); + var appIconPath = Path.Combine(desktopProjectPath, appIcon); + Directory.Exists(appIconPath).ShouldBeTrue($"Missing AppImage AppIcon directory: {appIconPath}"); + + var installerApplicationIcon = ReadRequiredElement(config, "InstallerApplicationIcon"); + var installerIconPath = Path.Combine(desktopProjectPath, installerApplicationIcon); + File.Exists(installerIconPath).ShouldBeTrue($"Missing AppImage InstallerApplicationIcon file: {installerIconPath}"); + } + + private static string ReadRequiredElement(XDocument document, string elementName) + { + var value = document.Root?.Elements(elementName).SingleOrDefault()?.Value; + value.ShouldNotBeNullOrWhiteSpace(); + return value; + } + + private static string GetRepoDirectory(string relativePath) + { + var directory = new DirectoryInfo(AppContext.BaseDirectory); + while (directory is not null) + { + var candidate = Path.Combine(directory.FullName, relativePath); + if (Directory.Exists(candidate)) + { + return candidate; + } + + directory = directory.Parent; + } + + throw new DirectoryNotFoundException($"Could not find repository directory: {relativePath}"); + } +}