FRE-606: Add icon generation and tests for Tauri desktop
- Add generate-icons.sh script for cross-platform icon generation - Generate all required icon sizes (32x32, 128x128, 256x256, 512x512) - Create Windows .ico and macOS .icns icons - Add Rust unit tests for core functionality - Add tauri:test and tauri:icons npm scripts New files: - src-tauri/generate-icons.sh - src-tauri/icons/32x32.png - src-tauri/icons/128x128.png - src-tauri/icons/128x128@2x.png - src-tauri/icons/512x512.png - src-tauri/icons/icon.ico - src-tauri/icons/icon.icns - src-tauri/icons/src/app-icon.svg - src-tauri/icons/tray-icon.png - src-tauri/src/tests.rs Modified: - src-tauri/src/lib.rs (added tests module)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
pub mod menu;
|
||||
pub mod tray;
|
||||
pub mod updater;
|
||||
#[cfg(test)]
|
||||
pub mod tests;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
||||
52
src-tauri/src/tests.rs
Normal file
52
src-tauri/src/tests.rs
Normal file
@@ -0,0 +1,52 @@
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_greet_command() {
|
||||
let result = greet("World");
|
||||
assert_eq!(result, "Hello, World! You've been greeted from Rust!");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_app_state_default() {
|
||||
let state = AppState::default();
|
||||
assert!(!state.app_version.is_empty());
|
||||
assert_eq!(state.is_dev_mode, cfg!(debug_assertions));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_window_state_serialization() {
|
||||
let state = WindowState {
|
||||
width: 1280.0,
|
||||
height: 800.0,
|
||||
x: 100,
|
||||
y: 100,
|
||||
is_maximized: false,
|
||||
};
|
||||
|
||||
let serialized = serde_json::to_string(&state).unwrap();
|
||||
let deserialized: WindowState = serde_json::from_str(&serialized).unwrap();
|
||||
|
||||
assert_eq!(state.width, deserialized.width);
|
||||
assert_eq!(state.height, deserialized.height);
|
||||
assert_eq!(state.x, deserialized.x);
|
||||
assert_eq!(state.y, deserialized.y);
|
||||
assert_eq!(state.is_maximized, deserialized.is_maximized);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_update_info_serialization() {
|
||||
let update_info = UpdateInfo {
|
||||
current_version: "0.1.0".to_string(),
|
||||
latest_version: "0.2.0".to_string(),
|
||||
release_notes: "Bug fixes".to_string(),
|
||||
download_url: "https://example.com/update".to_string(),
|
||||
is_update_available: true,
|
||||
};
|
||||
|
||||
let serialized = serde_json::to_string(&update_info).unwrap();
|
||||
assert!(serialized.contains("0.2.0"));
|
||||
assert!(serialized.contains("Bug fixes"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user