94384849bd
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
35 lines
1.4 KiB
Rust
35 lines
1.4 KiB
Rust
//! Renders the title bar offscreen for visual inspection.
|
|
|
|
use notescraft_engine::CommandInfo;
|
|
use notescraft_ui_egui::theme::Tokens;
|
|
use notescraft_ui_egui::titlebar::{MenuInfo, TitleBarInfo, show_titlebar};
|
|
|
|
fn main() {
|
|
let Some(theme) = notescraft_themes::builtin("catppuccin-mocha") else {
|
|
eprintln!("built-in theme catppuccin-mocha is unavailable");
|
|
std::process::exit(1);
|
|
};
|
|
let tokens = Tokens::new(theme);
|
|
let info = TitleBarInfo {
|
|
title: String::from("Daily note · NotesCraft vault"),
|
|
menus: ["File", "Edit", "View", "Help"].into_iter().map(|label| MenuInfo { label: String::from(label), commands: Vec::<CommandInfo>::new() }).collect(),
|
|
};
|
|
let mut harness = egui_kittest::Harness::builder().with_size(egui::vec2(1440.0, 900.0)).with_max_steps(4).wgpu().build_ui(|ui| {
|
|
let _ = show_titlebar(ui.ctx(), &tokens, &info);
|
|
});
|
|
harness.run();
|
|
match harness.render() {
|
|
Ok(image) => {
|
|
if let Err(error) = image.save("/tmp/notescraft-titlebar.png") {
|
|
eprintln!("could not save title bar snapshot: {error}");
|
|
std::process::exit(1);
|
|
}
|
|
println!("wrote /tmp/notescraft-titlebar.png");
|
|
}
|
|
Err(error) => {
|
|
eprintln!("could not render title bar snapshot: {error}");
|
|
std::process::exit(1);
|
|
}
|
|
}
|
|
}
|