mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Co-authored-by: Brandon Thomas <[email protected]>
This commit is contained in:
1 parent
e18e3c066f
commit
e0f6ce4302
2 files changed
+34
-1
No files matched your search
@@ -404,7 +404,9 @@ pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui) -> bool {
|
||||
style.tab_height = if t.pro { 28.0 } else { 40.0 };
|
||||
style.min_pane = 0.0;
|
||||
style.background = t.card;
|
||||
style.tab_background = t.tab_strip;
|
||||
// Studio themes leave the strip transparent over the dock's card; a floating group has no
|
||||
// card behind it, so the canvas showed through its titles (#4509).
|
||||
style.tab_background = if t.tab_strip.a() == 0 { t.card } else { t.tab_strip };
|
||||
style.active_background = t.card;
|
||||
style.text = t.text;
|
||||
style.inactive_text = t.text_dim;
|
||||
|
||||
@@ -162,6 +162,37 @@ fn capture_custom_panel_docking_visual_fixtures() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn floating_group_titles_are_opaque_in_studio_themes() {
|
||||
// Studio's tab strip is transparent over the dock's card; a floating group must not show the canvas (#4509).
|
||||
let mut app = app();
|
||||
app.run("window.panel.float", json!({"panel":"swatches","x":40,"y":60,"width":300,"height":300})).unwrap();
|
||||
let mut ready = false;
|
||||
let mut h = Harness::builder().with_size(vec2(1280.0, 800.0)).wgpu().build_ui_state(
|
||||
move |ui, app: &mut PhotocraftApp| {
|
||||
if !ready {
|
||||
PhotocraftApp::setup_context(ui.ctx(), crate::theme::ThemeKind::Studio);
|
||||
app.ui.theme = crate::theme::ThemeKind::Studio;
|
||||
ready = true;
|
||||
return;
|
||||
}
|
||||
crate::panels::right_dock(app, ui);
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE.fill(egui::Color32::from_rgb(255, 0, 255))).show(ui, |_| {});
|
||||
},
|
||||
app,
|
||||
);
|
||||
h.run_steps(5);
|
||||
let area = h.ctx.memory(|m| m.area_rect(egui::Id::new("photocraft-panel-docking").with(("floating", &"swatches".to_string())))).unwrap();
|
||||
let image = h.render().unwrap();
|
||||
let ppp = image.width() as f32 / 1280.0;
|
||||
let strip = egui::Rect::from_min_size(area.min, vec2(area.width(), 40.0)).shrink(2.0);
|
||||
let magenta = (strip.left() as u32..strip.right() as u32)
|
||||
.flat_map(|x| (strip.top() as u32..strip.bottom() as u32).map(move |y| (x, y)))
|
||||
.filter(|&(x, y)| image.get_pixel((x as f32 * ppp) as u32, (y as f32 * ppp) as u32).0[..3] == [255, 0, 255])
|
||||
.count();
|
||||
assert_eq!(magenta, 0, "canvas shows through the floating group's title strip {strip:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn escape_cancels_the_first_drag_without_replacing_the_legacy_workspace() {
|
||||
let mut h = harness(app(), vec2(1280.0, 800.0));
|
||||
|
||||
Reference in new issue
Block a user