75faf3efaa
Appearance: acrylic material with popup and modal backing, corner radius, UI font (bundled DM Sans, Figtree, Fredoka, Geist, Nunito, Quicksand, Varela Round), accent colour. Icons on buttons, code targets and agent logos; redesigned fill/gradient and auto-layout rows; compact topbar. Chat: agent logo in the header, history popup with search and recency groups, new-chat button, issue outcomes saved with the chat and issue bodies shown as fields, question cards with one-click answers, number keys, an inline other-answer field and an answered state. Layers: right-click context menu. Performance: virtualised layer reveal, pruned hit-testing, glyph cache. Settings > Performance: FPS, frame time, RAM, CPU and GPU overlay with a slow-frame warning. MCP: compact spec writes bound strokes as variables (#23), lint contrast averages gradient and translucent backgrounds (#24), lint flags light/dark theme copies (#25). Closes #23, closes #24, closes #25 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
73 lines
2.8 KiB
Rust
73 lines
2.8 KiB
Rust
//! The acrylic material: the backdrop around the panels glows, the canvas is left alone.
|
|
//! Own test binary, as the theme and material are process-wide.
|
|
mod common;
|
|
|
|
use common::*;
|
|
use papercraft::demo;
|
|
use papercraft::render::frame;
|
|
use papercraft::theme::{self, Choice, Material};
|
|
use papercraft::ui::UiState;
|
|
|
|
#[test]
|
|
fn acrylic_lights_the_backdrop_and_leaves_the_canvas() {
|
|
let Some(g) = gpu() else { return };
|
|
let mocha = Choice::Catppuccin(craft_ui::theme::catppuccin::Flavor::Mocha);
|
|
theme::apply_choice(&egui::Context::default(), mocha);
|
|
let render = |m: Material, chat: bool| {
|
|
theme::set_material(m);
|
|
let mut e = demo::showcase();
|
|
let mut st = UiState {
|
|
chat_mode: chat,
|
|
..UiState::default()
|
|
};
|
|
frame::capture(g, &mut e, &mut st, [1440.0, 900.0], 1.0, |e| {
|
|
e.zoom_to_fit();
|
|
// A frame selected, so the inspector shows its fields, selects and buttons.
|
|
let first = e.doc.root[0];
|
|
e.select(vec![first]);
|
|
})
|
|
};
|
|
let solid = render(Material::Solid, false);
|
|
let acrylic = render(Material::Acrylic, false);
|
|
render(Material::Acrylic, true)
|
|
.save(shot("app_acrylic_mocha_chat.png"))
|
|
.unwrap();
|
|
{
|
|
theme::set_material(Material::Acrylic);
|
|
let mut e = demo::showcase();
|
|
let mut st = UiState::default();
|
|
st.settings.open = true;
|
|
frame::capture(g, &mut e, &mut st, [1440.0, 900.0], 2.0, |_| {})
|
|
.save(shot("app_acrylic_mocha_settings.png"))
|
|
.unwrap();
|
|
// Rounder corners and a rounded font, restyled through `apply`.
|
|
theme::set_roundness(theme::Roundness(1.5));
|
|
theme::set_ui_font(5);
|
|
theme::apply_choice(&egui::Context::default(), mocha);
|
|
let mut e = demo::showcase();
|
|
frame::capture(g, &mut e, &mut st, [1440.0, 900.0], 2.0, |_| {})
|
|
.save(shot("app_acrylic_round_settings.png"))
|
|
.unwrap();
|
|
theme::set_roundness(theme::Roundness(1.0));
|
|
theme::set_ui_font(0);
|
|
}
|
|
render(Material::Solid, true)
|
|
.save(shot("app_solid_mocha_chat.png"))
|
|
.unwrap();
|
|
solid.save(shot("app_solid_mocha.png")).unwrap();
|
|
acrylic.save(shot("app_acrylic_mocha.png")).unwrap();
|
|
// The top gap a third of the way across sits under the glow: flat crust when solid,
|
|
// brighter when acrylic.
|
|
let (x, y) = (430, 4);
|
|
let lum = |p: [u8; 4]| p[0] as u32 + p[1] as u32 + p[2] as u32;
|
|
assert!(
|
|
lum(acrylic.get_pixel(x, y).0) > lum(solid.get_pixel(x, y).0) + 6,
|
|
"glow in the gap: {:?} vs {:?}",
|
|
acrylic.get_pixel(x, y).0,
|
|
solid.get_pixel(x, y).0
|
|
);
|
|
// The middle of the canvas is the renderer's, untouched by the backdrop.
|
|
assert_eq!(acrylic.get_pixel(720, 450), solid.get_pixel(720, 450));
|
|
theme::set_material(Material::Solid);
|
|
}
|