54 lines
1.3 KiB
Rust
54 lines
1.3 KiB
Rust
//! Media Viewer Library - Windows 11 Style Native Application
|
|||
|
|
|
||
|
|
// Re-export the modules for easy access
|
||
|
|
pub mod media_handler;
|
||
|
|
pub mod ui;
|
||
|
|
|
||
|
|
// Main application structure
|
||
|
|
pub struct MediaViewer {
|
||
|
|
// Application state
|
||
|
|
current_file: Option<String>,
|
||
|
|
is_fullscreen: bool,
|
||
|
|
}
|
||
|
|
|
||
|
|
impl MediaViewer {
|
||
|
|
/// Create a new media viewer instance
|
||
|
|
pub fn new() -> Self {
|
||
|
|
Self {
|
||
|
|
current_file: None,
|
||
|
|
is_fullscreen: false,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/// Load a media file
|
||
|
|
pub fn load_file(&mut self, path: &str) -> Result<(), String> {
|
||
|
|
// In a real implementation, this would validate and load the file
|
||
|
|
self.current_file = Some(path.to_string());
|
||
|
|
Ok(())
|
||
|
|
}
|
||
|
|
|
||
|
|
/// Display the loaded media
|
||
|
|
pub fn display(&self) {
|
||
|
|
println!("Displaying media from: {:?}", self.current_file);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
#[cfg(test)]
|
||
|
|
mod tests {
|
||
|
|
use super::*;
|
||
|
|
|
||
|
|
#[test]
|
||
|
|
fn test_media_viewer_creation() {
|
||
|
|
let viewer = MediaViewer::new();
|
||
|
|
assert!(viewer.current_file.is_none());
|
||
|
|
assert_eq!(viewer.is_fullscreen, false);
|
||
|
|
}
|
||
|
|
|
||
|
|
#[test]
|
||
|
|
fn test_load_file() {
|
||
|
|
let mut viewer = MediaViewer::new();
|
||
|
|
let result = viewer.load_file("test.png");
|
||
|
|
assert!(result.is_ok());
|
||
|
|
assert_eq!(viewer.current_file, Some("test.png".to_string()));
|
||
|
|
}
|
||
|
|
}
|