Merge pull request #106 from Team-LJY/features/application-icon
Windows와 Linux에 공통 응용 프로그램 아이콘 적용
- 작성자
- LeeJunyoung
- 작성 시각
- 커밋
142b89f6bbceacaff661d9405592637e6d18a2ff
변경된 파일 18개
+277-1| @@ -363,3 +363,11 @@ | ||
| 363 | 363 | ## 12. 범위 밖 |
| 364 | 364 | |
| 365 | 365 | 다크 모드, 설정 화면, 미리보기, 최근 연 파일 목록, 언어 선택, 화면 크기에 따른 글자 크기 조절, 기존 압축파일 재암호화는 v0.1 이후에 다룬다. |
| 366 | 추가: | |
| 367 | 추가: ## 공통 응용 프로그램 아이콘 | |
| 368 | 추가: | |
| 369 | 추가: 모든 Zipelo 플랫폼과 후속 응용 프로그램은 `experiments/rust-ui-memory-app/src/assets/icons/zipelo.png`를 공통 원본으로 사용한다. 사용자가 제공한 원본의 모양과 투명도를 유지하며 별도 디자인으로 대체하지 않는다. | |
| 370 | 추가: | |
| 371 | 추가: - `zipelo-256.png`: 실행 창과 Ubuntu의 hicolor 앱 아이콘이다. | |
| 372 | 추가: - `zipelo.ico`: Windows 실행 파일, 설치 및 제거 프로그램의 아이콘이다. 16, 24, 32, 48, 64, 128, 256픽셀을 포함한다. | |
| 373 | 추가: - 파생 파일은 공통 PNG에서 Lanczos 축소로 만든다. 새 플랫폼의 아이콘 형식도 같은 원본에서 변환한다. |
| @@ -0,0 +1,111 @@ | ||
| 1 | 추가: use std::{env, ffi::OsString, path::PathBuf, process::Command}; | |
| 2 | 추가: | |
| 3 | 추가: fn msvc_compiler() -> Option<OsString> { | |
| 4 | 추가: if let Some(compiler) = env::var_os("RC") { | |
| 5 | 추가: return Some(compiler); | |
| 6 | 추가: } | |
| 7 | 추가: let mut candidates = Vec::new(); | |
| 8 | 추가: for root in ["ProgramFiles(x86)", "ProgramFiles"] { | |
| 9 | 추가: let Some(root) = env::var_os(root) else { | |
| 10 | 추가: continue; | |
| 11 | 추가: }; | |
| 12 | 추가: let bin = PathBuf::from(root).join("Windows Kits/10/bin"); | |
| 13 | 추가: let Ok(entries) = std::fs::read_dir(bin) else { | |
| 14 | 추가: continue; | |
| 15 | 추가: }; | |
| 16 | 추가: for entry in entries.flatten() { | |
| 17 | 추가: let version = entry | |
| 18 | 추가: .file_name() | |
| 19 | 추가: .to_string_lossy() | |
| 20 | 추가: .split('.') | |
| 21 | 추가: .map(str::parse::<u32>) | |
| 22 | 추가: .collect::<Result<Vec<_>, _>>(); | |
| 23 | 추가: let compiler = entry.path().join("x64/rc.exe"); | |
| 24 | 추가: if let Ok(version) = version { | |
| 25 | 추가: if compiler.is_file() { | |
| 26 | 추가: candidates.push((version, compiler)); | |
| 27 | 추가: } | |
| 28 | 추가: } | |
| 29 | 추가: } | |
| 30 | 추가: } | |
| 31 | 추가: candidates | |
| 32 | 추가: .into_iter() | |
| 33 | 추가: .max_by(|a, b| a.0.cmp(&b.0)) | |
| 34 | 추가: .map(|(_, path)| path.into_os_string()) | |
| 35 | 추가: .or_else(|| { | |
| 36 | 추가: env::var_os("PATH").and_then(|paths| { | |
| 37 | 추가: env::split_paths(&paths) | |
| 38 | 추가: .map(|path| path.join("rc.exe")) | |
| 39 | 추가: .find(|path| path.is_file()) | |
| 40 | 추가: .map(PathBuf::into_os_string) | |
| 41 | 추가: }) | |
| 42 | 추가: }) | |
| 43 | 추가: } | |
| 44 | 추가: | |
| 45 | 추가: fn main() { | |
| 46 | 추가: println!("cargo:rerun-if-changed=src/assets/icons/zipelo.ico"); | |
| 47 | 추가: for variable in ["RC", "ProgramFiles(x86)", "ProgramFiles", "PATH"] { | |
| 48 | 추가: println!("cargo:rerun-if-env-changed={variable}"); | |
| 49 | 추가: } | |
| 50 | 추가: println!("cargo:rerun-if-env-changed=CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER"); | |
| 51 | 추가: if env::var("CARGO_CFG_TARGET_OS").as_deref() != Ok("windows") | |
| 52 | 추가: || env::var_os("CARGO_FEATURE_UI").is_none() | |
| 53 | 추가: { | |
| 54 | 추가: return; | |
| 55 | 추가: } | |
| 56 | 추가: let msvc = env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc"); | |
| 57 | 추가: let compiler = if msvc { | |
| 58 | 추가: let Some(compiler) = msvc_compiler() else { | |
| 59 | 추가: println!("cargo:warning=아이콘 없이 빌드: MSVC 리소스 컴파일러를 찾지 못함"); | |
| 60 | 추가: return; | |
| 61 | 추가: }; | |
| 62 | 추가: compiler | |
| 63 | 추가: } else { | |
| 64 | 추가: env::var_os("RC").unwrap_or_else(|| "x86_64-w64-mingw32-windres".into()) | |
| 65 | 추가: }; | |
| 66 | 추가: let output = PathBuf::from(env::var_os("OUT_DIR").unwrap()); | |
| 67 | 추가: let icon = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()) | |
| 68 | 추가: .join("src/assets/icons/zipelo.ico"); | |
| 69 | 추가: let resource = output.join("zipelo.rc"); | |
| 70 | 추가: std::fs::write( | |
| 71 | 추가: &resource, | |
| 72 | 추가: format!( | |
| 73 | 추가: "1 ICON \"{}\"\n", | |
| 74 | 추가: icon.display().to_string().replace('\\', "/") | |
| 75 | 추가: ), | |
| 76 | 추가: ) | |
| 77 | 추가: .unwrap(); | |
| 78 | 추가: let compiled = output.join(if msvc { "zipelo.res" } else { "zipelo.o" }); | |
| 79 | 추가: let mut command = Command::new(compiler); | |
| 80 | 추가: if msvc { | |
| 81 | 추가: command | |
| 82 | 추가: .arg("/nologo") | |
| 83 | 추가: .arg(format!("/fo{}", compiled.display())) | |
| 84 | 추가: .arg(&resource); | |
| 85 | 추가: } else { | |
| 86 | 추가: if let Ok(preprocessor) = env::var("CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER") { | |
| 87 | 추가: command.arg(format!("--preprocessor={preprocessor}")).args([ | |
| 88 | 추가: "--preprocessor-arg=-E", | |
| 89 | 추가: "--preprocessor-arg=-xc", | |
| 90 | 추가: "--preprocessor-arg=-DRC_INVOKED", | |
| 91 | 추가: ]); | |
| 92 | 추가: } | |
| 93 | 추가: command | |
| 94 | 추가: .arg("-i") | |
| 95 | 추가: .arg(&resource) | |
| 96 | 추가: .arg("-o") | |
| 97 | 추가: .arg(&compiled) | |
| 98 | 추가: .arg("-O") | |
| 99 | 추가: .arg("coff"); | |
| 100 | 추가: } | |
| 101 | 추가: let status = command.status(); | |
| 102 | 추가: if msvc && !status.as_ref().is_ok_and(|status| status.success()) { | |
| 103 | 추가: println!("cargo:warning=아이콘 없이 빌드: MSVC 리소스 컴파일러 실행 실패"); | |
| 104 | 추가: return; | |
| 105 | 추가: } | |
| 106 | 추가: assert!(status.expect("Windows 리소스 컴파일러가 필요함").success()); | |
| 107 | 추가: println!( | |
| 108 | 추가: "cargo:rustc-link-arg-bin=zipelo-ui-memory-app={}", | |
| 109 | 추가: compiled.display() | |
| 110 | 추가: ); | |
| 111 | 추가: } |
| @@ -0,0 +1,12 @@ | ||
| 1 | 추가: use std::sync::{Arc, OnceLock}; | |
| 2 | 추가: | |
| 3 | 추가: pub fn load() -> Arc<eframe::egui::IconData> { | |
| 4 | 추가: static ICON: OnceLock<Arc<eframe::egui::IconData>> = OnceLock::new(); | |
| 5 | 추가: ICON.get_or_init(|| { | |
| 6 | 추가: Arc::new( | |
| 7 | 추가: eframe::icon_data::from_png_bytes(include_bytes!("assets/icons/zipelo-256.png")) | |
| 8 | 추가: .expect("공통 앱 아이콘 PNG가 유효해야 함"), | |
| 9 | 추가: ) | |
| 10 | 추가: }) | |
| 11 | 추가: .clone() | |
| 12 | 추가: } |
| @@ -153,6 +153,7 @@ impl WorkWindow { | ||
| 153 | 153 | } |
| 154 | 154 | let mut builder = egui::ViewportBuilder::default() |
| 155 | 155 | .with_title(title) |
| 156 | 추가: .with_icon(crate::app_icon::load()) | |
| 156 | 157 | .with_decorations(decorations) |
| 157 | 158 | .with_inner_size(size) |
| 158 | 159 | .with_resizable(false) |
바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기바이너리 파일이라 Diff를 표시하지 않아요.
파일 내려받기| @@ -23,3 +23,6 @@ pub mod archive_theme; | ||
| 23 | 23 | pub mod window_frame; |
| 24 | 24 | |
| 25 | 25 | pub mod archive_path; |
| 26 | 추가: | |
| 27 | 추가: #[cfg(feature = "ui")] | |
| 28 | 추가: pub mod app_icon; |
| @@ -1,3 +1,6 @@ | ||
| 1 | 추가: #[path = "app_icon.rs"] | |
| 2 | 추가: mod app_icon; | |
| 3 | 추가: | |
| 1 | 4 | #[derive(Clone, Copy, Debug, PartialEq, Eq)] |
| 2 | 5 | pub enum Backend { |
| 3 | 6 | Dx12Hardware, |
| @@ -30,6 +33,10 @@ pub fn try_backends<E>( | ||
| 30 | 33 | } |
| 31 | 34 | |
| 32 | 35 | pub fn options(backend: Backend, mut options: eframe::NativeOptions) -> eframe::NativeOptions { |
| 36 | 추가: options.viewport = options | |
| 37 | 추가: .viewport | |
| 38 | 추가: .with_app_id("zipelo") | |
| 39 | 추가: .with_icon(app_icon::load()); | |
| 33 | 40 | options.renderer = eframe::Renderer::Glow; |
| 34 | 41 | options.run_and_return = true; |
| 35 | 42 | #[cfg(target_os = "windows")] |
| @@ -43,6 +43,9 @@ def build(args): | ||
| 43 | 43 | desktop = stage / "usr/share/applications" |
| 44 | 44 | desktop.mkdir(parents=True) |
| 45 | 45 | shutil.copyfile(Path(__file__).with_name("zipelo.desktop"), desktop / "zipelo.desktop") |
| 46 | 추가: icons = stage / "usr/share/icons/hicolor/256x256/apps" | |
| 47 | 추가: icons.mkdir(parents=True) | |
| 48 | 추가: shutil.copyfile(ROOT / "experiments/rust-ui-memory-app/src/assets/icons/zipelo-256.png", icons / "zipelo.png") | |
| 46 | 49 | subprocess.run(["desktop-file-validate", str(desktop / "zipelo.desktop")], check=True) |
| 47 | 50 | shutil.copyfile(ROOT / "LICENSE", docs / "copyright") |
| 48 | 51 | control = stage / "DEBIAN" |
| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | #!/bin/sh |
| 2 | 2 | set -eu |
| 3 | 추가: if command -v gtk-update-icon-cache >/dev/null 2>&1; then | |
| 4 | 추가: gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor | |
| 5 | 추가: fi | |
| 3 | 6 | if command -v update-desktop-database >/dev/null 2>&1; then |
| 4 | 7 | update-desktop-database /usr/share/applications |
| 5 | 8 | fi |
| @@ -1,5 +1,8 @@ | ||
| 1 | 1 | #!/bin/sh |
| 2 | 2 | set -eu |
| 3 | 추가: if command -v gtk-update-icon-cache >/dev/null 2>&1; then | |
| 4 | 추가: gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor | |
| 5 | 추가: fi | |
| 3 | 6 | if command -v update-desktop-database >/dev/null 2>&1; then |
| 4 | 7 | update-desktop-database /usr/share/applications |
| 5 | 8 | fi |
| @@ -3,7 +3,7 @@ Type=Application | ||
| 3 | 3 | Name=Zipelo |
| 4 | 4 | Exec=/usr/bin/zipelo %f |
| 5 | 5 | TryExec=/usr/bin/zipelo |
| 6 | 삭제: Icon=package-x-generic | |
| 6 | 추가: Icon=zipelo | |
| 7 | 7 | Terminal=false |
| 8 | 8 | Categories=Utility;Archiving; |
| 9 | 9 | MimeType=application/zip;application/x-7z-compressed;application/x-compressed-tar;application/gzip;application/x-tar; |
| @@ -88,6 +88,7 @@ def build(args): | ||
| 88 | 88 | "profile": args.profile, "target": TARGET, "files": records} |
| 89 | 89 | (payload / "BUILD-INFO.json").write_text(json.dumps(records, indent=4) + "\n", encoding="utf-8") |
| 90 | 90 | shutil.copyfile(Path(__file__).with_name("installer.nsi"), output / "installer.nsi") |
| 91 | 추가: shutil.copyfile(ROOT / "experiments/rust-ui-memory-app/src/assets/icons/zipelo.ico", output / "zipelo.ico") | |
| 91 | 92 | subprocess.run(["makensis", "-WX", "installer.nsi"], cwd=output, check=True) |
| 92 | 93 | installer = output / "Zipelo-0.1.0-dev-windows-x64-setup.exe" |
| 93 | 94 | if pe_machine(installer) not in (0x14C, 0x8664): |
| @@ -13,6 +13,8 @@ SetCompressor /SOLID lzma | ||
| 13 | 13 | SetOverwrite off |
| 14 | 14 | AllowSkipFiles off |
| 15 | 15 | ShowInstDetails show |
| 16 | 추가: !define MUI_ICON "zipelo.ico" | |
| 17 | 추가: !define MUI_UNICON "zipelo.ico" | |
| 16 | 18 | !define MUI_ABORTWARNING |
| 17 | 19 | !define MUI_CUSTOMFUNCTION_ABORT Rollback |
| 18 | 20 | !insertmacro MUI_PAGE_WELCOME |
| @@ -111,6 +113,7 @@ Section "Zipelo" | ||
| 111 | 113 | IfErrors failed |
| 112 | 114 | StrCpy $UninstallOwned 1 |
| 113 | 115 | WriteRegStr HKCU "${UNKEY}" "DisplayName" "Zipelo 개발판" |
| 116 | 추가: WriteRegStr HKCU "${UNKEY}" "DisplayIcon" '$\"$INSTDIR\Zipelo.exe$\",0' | |
| 114 | 117 | WriteRegStr HKCU "${UNKEY}" "DisplayVersion" "0.1.0-dev" |
| 115 | 118 | WriteRegStr HKCU "${UNKEY}" "UninstallString" '$\"$INSTDIR\Uninstall.exe$\"' |
| 116 | 119 | IfErrors failed |
| @@ -134,6 +137,7 @@ Function Rollback | ||
| 134 | 137 | Delete "$SMPROGRAMS\Zipelo 개발판.lnk" |
| 135 | 138 | ${EndIf} |
| 136 | 139 | ${If} $UninstallOwned == 1 |
| 140 | 추가: DeleteRegValue HKCU "${UNKEY}" "DisplayIcon" | |
| 137 | 141 | DeleteRegValue HKCU "${UNKEY}" "DisplayName" |
| 138 | 142 | DeleteRegValue HKCU "${UNKEY}" "DisplayVersion" |
| 139 | 143 | DeleteRegValue HKCU "${UNKEY}" "UninstallString" |
| @@ -179,6 +183,7 @@ Function ApplyAssociations | ||
| 179 | 183 | Pop $0 |
| 180 | 184 | ClearErrors |
| 181 | 185 | WriteRegStr HKCU "${PROGKEY}" "" "Zipelo 압축파일" |
| 186 | 추가: WriteRegStr HKCU "${PROGKEY}\DefaultIcon" "" '$\"$INSTDIR\Zipelo.exe$\",0' | |
| 182 | 187 | WriteRegStr HKCU "${PROGKEY}\shell\open\command" "" '$\"$INSTDIR\Zipelo.exe$\" $\"%1$\"' |
| 183 | 188 | WriteRegStr HKCU "${APPKEY}\Capabilities" "ApplicationName" "Zipelo 개발판" |
| 184 | 189 | WriteRegStr HKCU "${APPKEY}\Capabilities" "ApplicationDescription" "압축파일 열기와 풀기" |
| @@ -247,11 +252,14 @@ Section "Uninstall" | ||
| 247 | 252 | DeleteRegKey /ifempty HKCU "${APPKEY}\Capabilities" |
| 248 | 253 | DeleteRegKey /ifempty HKCU "${APPKEY}" |
| 249 | 254 | DeleteRegValue HKCU "${PROGKEY}\shell\open\command" "" |
| 255 | 추가: DeleteRegValue HKCU "${PROGKEY}\DefaultIcon" "" | |
| 256 | 추가: DeleteRegKey /ifempty HKCU "${PROGKEY}\DefaultIcon" | |
| 250 | 257 | DeleteRegValue HKCU "${PROGKEY}" "" |
| 251 | 258 | DeleteRegKey /ifempty HKCU "${PROGKEY}\shell\open\command" |
| 252 | 259 | DeleteRegKey /ifempty HKCU "${PROGKEY}\shell\open" |
| 253 | 260 | DeleteRegKey /ifempty HKCU "${PROGKEY}\shell" |
| 254 | 261 | DeleteRegKey /ifempty HKCU "${PROGKEY}" |
| 262 | 추가: DeleteRegValue HKCU "${UNKEY}" "DisplayIcon" | |
| 255 | 263 | DeleteRegValue HKCU "${UNKEY}" "DisplayName" |
| 256 | 264 | DeleteRegValue HKCU "${UNKEY}" "DisplayVersion" |
| 257 | 265 | DeleteRegValue HKCU "${UNKEY}" "UninstallString" |
| @@ -0,0 +1,104 @@ | ||
| 1 | 추가: import os | |
| 2 | 추가: from pathlib import Path | |
| 3 | 추가: import shutil | |
| 4 | 추가: import subprocess | |
| 5 | 추가: import tempfile | |
| 6 | 추가: import unittest | |
| 7 | 추가: | |
| 8 | 추가: ROOT = Path(__file__).resolve().parents[2] | |
| 9 | 추가: | |
| 10 | 추가: | |
| 11 | 추가: class IconBuildTests(unittest.TestCase): | |
| 12 | 추가: @classmethod | |
| 13 | 추가: def setUpClass(cls): | |
| 14 | 추가: (ROOT / "tests/work").mkdir(parents=True, exist_ok=True) | |
| 15 | 추가: cls.scratch = tempfile.TemporaryDirectory(dir=ROOT / "tests/work") | |
| 16 | 추가: cls.addClassCleanup(cls.scratch.cleanup) | |
| 17 | 추가: cls.root = Path(cls.scratch.name) | |
| 18 | 추가: cls.builder = cls.root / "build.exe" | |
| 19 | 추가: cls.compiler = cls.root / "fake-rc.exe" | |
| 20 | 추가: fake = cls.root / "fake.rs" | |
| 21 | 추가: fake.write_text('''fn main() { | |
| 22 | 추가: if std::env::var_os("FAKE_RC_FAIL").is_some() { | |
| 23 | 추가: std::process::exit(1); | |
| 24 | 추가: } | |
| 25 | 추가: let output = std::env::args().find_map(|arg| arg.strip_prefix("/fo").map(str::to_owned)).unwrap(); | |
| 26 | 추가: std::fs::write(output, std::env::current_exe().unwrap().to_string_lossy().as_bytes()).unwrap(); | |
| 27 | 추가: } | |
| 28 | 추가: ''') | |
| 29 | 추가: for source, output in ((ROOT / "experiments/rust-ui-memory-app/build.rs", cls.builder), | |
| 30 | 추가: (fake, cls.compiler)): | |
| 31 | 추가: subprocess.run(["rustc", "+1.99.1", "--edition=2024", str(source), "-o", str(output)], | |
| 32 | 추가: check=True, capture_output=True, text=True, encoding="utf-8") | |
| 33 | 추가: | |
| 34 | 추가: def setUp(self): | |
| 35 | 추가: self.directory = tempfile.TemporaryDirectory(dir=self.root) | |
| 36 | 추가: self.addCleanup(self.directory.cleanup) | |
| 37 | 추가: self.work = Path(self.directory.name) | |
| 38 | 추가: self.output = self.work / "out" | |
| 39 | 추가: self.output.mkdir() | |
| 40 | 추가: self.programs = self.work / "Program Files (x86)" | |
| 41 | 추가: | |
| 42 | 추가: def sdk(self, version): | |
| 43 | 추가: path = self.programs / "Windows Kits/10/bin" / version / "x64/rc.exe" | |
| 44 | 추가: path.parent.mkdir(parents=True) | |
| 45 | 추가: shutil.copy2(self.compiler, path) | |
| 46 | 추가: return path | |
| 47 | 추가: | |
| 48 | 추가: def run_build(self, target="msvc", **overrides): | |
| 49 | 추가: excluded = {key.casefold() for key in ("RC", "ProgramFiles", "ProgramFiles(x86)", "FAKE_RC_FAIL", "PATH")} | |
| 50 | 추가: environment = {key: value for key, value in os.environ.items() if key.casefold() not in excluded} | |
| 51 | 추가: environment.update({"CARGO_CFG_TARGET_OS": "windows", "CARGO_CFG_TARGET_ENV": target, | |
| 52 | 추가: "CARGO_FEATURE_UI": "1", "OUT_DIR": str(self.output), | |
| 53 | 추가: "CARGO_MANIFEST_DIR": str(ROOT / "experiments/rust-ui-memory-app"), | |
| 54 | 추가: "ProgramFiles(x86)": str(self.programs), "PATH": ""}) | |
| 55 | 추가: environment.update(overrides) | |
| 56 | 추가: return subprocess.run([str(self.builder)], env=environment, capture_output=True, text=True, encoding="utf-8") | |
| 57 | 추가: | |
| 58 | 추가: def test_sdk_uses_highest_numeric_version_with_x64_compiler(self): | |
| 59 | 추가: self.sdk("10.0.9.0") | |
| 60 | 추가: latest = self.sdk("10.0.10.0") | |
| 61 | 추가: (self.programs / "Windows Kits/10/bin/10.0.99.0/x64").mkdir(parents=True) | |
| 62 | 추가: result = self.run_build() | |
| 63 | 추가: self.assertEqual(result.returncode, 0, result.stderr) | |
| 64 | 추가: self.assertIn("cargo:rustc-link-arg-bin=", result.stdout) | |
| 65 | 추가: self.assertTrue(Path((self.output / "zipelo.res").read_text()).samefile(latest)) | |
| 66 | 추가: | |
| 67 | 추가: def test_explicit_rc_overrides_sdk(self): | |
| 68 | 추가: self.sdk("10.0.99.0") | |
| 69 | 추가: result = self.run_build(RC=str(self.compiler)) | |
| 70 | 추가: self.assertEqual(result.returncode, 0, result.stderr) | |
| 71 | 추가: self.assertTrue(Path((self.output / "zipelo.res").read_text()).samefile(self.compiler)) | |
| 72 | 추가: | |
| 73 | 추가: def test_path_compiler_remains_available_without_sdk(self): | |
| 74 | 추가: path = self.work / "bin/rc.exe" | |
| 75 | 추가: path.parent.mkdir() | |
| 76 | 추가: shutil.copy2(self.compiler, path) | |
| 77 | 추가: result = self.run_build(PATH=str(path.parent)) | |
| 78 | 추가: self.assertEqual(result.returncode, 0, result.stderr) | |
| 79 | 추가: self.assertTrue(Path((self.output / "zipelo.res").read_text()).samefile(path)) | |
| 80 | 추가: | |
| 81 | 추가: def test_missing_msvc_compiler_warns_without_linking(self): | |
| 82 | 추가: result = self.run_build() | |
| 83 | 추가: self.assertEqual(result.returncode, 0, result.stderr) | |
| 84 | 추가: self.assertIn("cargo:warning=아이콘 없이 빌드", result.stdout) | |
| 85 | 추가: self.assertNotIn("cargo:rustc-link-arg-bin=", result.stdout) | |
| 86 | 추가: self.assertFalse((self.output / "zipelo.res").exists()) | |
| 87 | 추가: | |
| 88 | 추가: def test_msvc_compiler_failure_warns_without_linking(self): | |
| 89 | 추가: result = self.run_build(RC=str(self.compiler), FAKE_RC_FAIL="1") | |
| 90 | 추가: self.assertEqual(result.returncode, 0, result.stderr) | |
| 91 | 추가: self.assertIn("cargo:warning=아이콘 없이 빌드", result.stdout) | |
| 92 | 추가: self.assertNotIn("cargo:rustc-link-arg-bin=", result.stdout) | |
| 93 | 추가: | |
| 94 | 추가: def test_invalid_explicit_rc_does_not_fall_back_to_sdk(self): | |
| 95 | 추가: self.sdk("10.0.99.0") | |
| 96 | 추가: result = self.run_build(RC=str(self.work / "missing.exe")) | |
| 97 | 추가: self.assertEqual(result.returncode, 0, result.stderr) | |
| 98 | 추가: self.assertIn("cargo:warning=아이콘 없이 빌드", result.stdout) | |
| 99 | 추가: self.assertNotIn("cargo:rustc-link-arg-bin=", result.stdout) | |
| 100 | 추가: | |
| 101 | 추가: def test_missing_gnu_compiler_remains_a_build_failure(self): | |
| 102 | 추가: result = self.run_build(target="gnu", RC=str(self.work / "missing.exe")) | |
| 103 | 추가: self.assertNotEqual(result.returncode, 0) | |
| 104 | 추가: self.assertNotIn("cargo:warning=아이콘 없이 빌드", result.stdout) |
| @@ -60,6 +60,7 @@ class InstallerInputTests(unittest.TestCase): | ||
| 60 | 60 | for name in ("Zipelo.exe", "zipelo-archive-worker.exe", "LICENSE", "BUILD-INFO.json", "THIRD-PARTY-LICENSES.txt"): |
| 61 | 61 | (payload / name).write_bytes(b"compile-only test fixture") |
| 62 | 62 | shutil.copyfile(ROOT / "packaging/windows/rust/installer.nsi", self.root / "installer.nsi") |
| 63 | 추가: shutil.copyfile(ROOT / "experiments/rust-ui-memory-app/src/assets/icons/zipelo.ico", self.root / "zipelo.ico") | |
| 63 | 64 | completed = subprocess.run(["makensis", "-WX", "installer.nsi"], cwd=self.root, |
| 64 | 65 | stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) |
| 65 | 66 | self.assertEqual(completed.returncode, 0, completed.stdout) |
| @@ -79,3 +79,14 @@ fn options_keep_event_loop_available_for_retry() { | ||
| 79 | 79 | assert!(options.run_and_return); |
| 80 | 80 | assert!(matches!(options.renderer, eframe::Renderer::Glow)); |
| 81 | 81 | } |
| 82 | 추가: | |
| 83 | 추가: #[test] | |
| 84 | 추가: fn application_windows_use_the_shared_transparent_icon() { | |
| 85 | 추가: let icon = zipelo_ui_memory_app::app_icon::load(); | |
| 86 | 추가: assert_eq!((icon.width, icon.height), (256, 256)); | |
| 87 | 추가: assert_eq!(icon.rgba[3], 0); | |
| 88 | 추가: assert!(icon.rgba.chunks_exact(4).any(|pixel| pixel[3] == 255)); | |
| 89 | 추가: let options = renderer::options(Backend::Glow, eframe::NativeOptions::default()); | |
| 90 | 추가: assert_eq!(options.viewport.app_id.as_deref(), Some("zipelo")); | |
| 91 | 추가: assert_eq!(options.viewport.icon.unwrap().rgba, icon.rgba); | |
| 92 | 추가: } |