mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 13:32:45 -05:00
Merge pull request #10537 from dotCooCoo/fix/artboard-seam-zero-spacing
Artboards: touching artboards cast no shadow on each other
This commit is contained in:
1 file changed
+27
@@ -7039,6 +7039,33 @@ fn a_wheel_pan_under_a_resting_pointer_keeps_the_tool_cursor() {
|
||||
assert!(asks() > before, "once the view is still, the tool gives the cursor again");
|
||||
}
|
||||
|
||||
/// Artboards made with no spacing touch, and the canvas paints every artboard's drop shadow before any artboard's
|
||||
/// paper, so the lower artboard's shadow does not darken the upper one along the shared edge.
|
||||
#[test]
|
||||
fn touching_artboards_cast_no_shadow_on_each_other() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 200, "height": 200, "artboards": 2, "artboardLayout": {"layout": "column", "spacing": 0}})).unwrap();
|
||||
let boards: Vec<_> = app.session.active().unwrap().doc.artboards.iter().map(|ab| ab.rect).collect();
|
||||
assert_eq!(boards[0].y1, boards[1].y0, "the artboards touch");
|
||||
app.ui.task_bar = false;
|
||||
app.ui.view.rulers = false;
|
||||
app.canvas.worker_started = true;
|
||||
let ctx = crate::testing::ui_context();
|
||||
let _ = shapes(&mut app, &ctx);
|
||||
let view = app.view_mut().unwrap();
|
||||
(view.zoom, view.center) = (1.0, Point::new(100.0, 200.0));
|
||||
let all = shapes(&mut app, &ctx);
|
||||
let papers: Vec<usize> = all
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, s)| matches!(s, Shape::Mesh(m) if m.texture_id == egui::TextureId::default() && m.vertices.first().is_some_and(|v| v.color == Color32::WHITE)))
|
||||
.map(|(at, _)| at)
|
||||
.collect();
|
||||
let shadows: Vec<usize> = all.iter().enumerate().filter(|(_, s)| matches!(s, Shape::Rect(r) if r.blur_width > 0.0)).map(|(at, _)| at).collect();
|
||||
assert_eq!((papers.len(), shadows.len()), (2, 2), "each artboard paints its paper and casts a shadow");
|
||||
assert!(shadows.iter().all(|s| papers.iter().all(|p| s < p)), "every shadow lies under both papers: shadows {shadows:?}, papers {papers:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_worker_s_frame_reaches_its_texture_image_in_the_buffer_it_was_rendered_into() {
|
||||
let (doc, key) = pan_doc();
|
||||
|
||||
Reference in new issue
Block a user