mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 05:37:04 +00:00
F-2 trial: the separator is a row of the open list, asserted as a wider step between rows (lead)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
7ee6bb9793
commit
12f97ea2db
@@ -235,16 +235,6 @@ fn a_blend_row_steps_and_picks_by_its_keys_inside_the_dialog() {
|
||||
}
|
||||
|
||||
/// The y of each thin horizontal line in `shapes`.
|
||||
fn rule_ys(shapes: &[egui::Shape]) -> Vec<f32> {
|
||||
shapes
|
||||
.iter()
|
||||
.filter_map(|shape| match shape {
|
||||
egui::Shape::LineSegment { points, .. } if points[0].y == points[1].y => Some(points[0].y),
|
||||
egui::Shape::Rect(rect) if rect.rect.height() <= 2.0 && rect.rect.width() > 20.0 => Some(rect.rect.center().y),
|
||||
_ => None,
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// `separated_at(index)` draws the framework's list separator before that option of a choice row's open list and
|
||||
/// between no other two: a separator placed by the wrong index, or one drawn on every option, would split the standard
|
||||
@@ -271,10 +261,12 @@ fn a_choice_row_draws_its_separator_before_the_named_option() {
|
||||
let run = fixture.texts().iter().rev().find(|run| run.text == text).unwrap_or_else(|| panic!("the list shows {text}"));
|
||||
run.rect
|
||||
};
|
||||
let (legal, a4, custom) = (line_of(&fixture, "Legal"), line_of(&fixture, "A4"), line_of(&fixture, "Custom"));
|
||||
let ys = rule_ys(&fixture.frame_shapes());
|
||||
assert!(ys.iter().any(|y| *y > a4.bottom() && *y < custom.top()), "a line between A4 and Custom: {ys:?}, A4 {a4:?}, Custom {custom:?}");
|
||||
assert!(!ys.iter().any(|y| *y > legal.bottom() && *y < a4.top()), "no line between Legal and A4: {ys:?}");
|
||||
let (letter, legal, a4, custom) = (line_of(&fixture, "Letter"), line_of(&fixture, "Legal"), line_of(&fixture, "A4"), line_of(&fixture, "Custom"));
|
||||
// The separator is a row of its own in the open list: the step from A4 to Custom is wider than the step between two
|
||||
// options with none between them, and those two steps are equal.
|
||||
let plain = legal.top() - letter.top();
|
||||
assert!((a4.top() - legal.top() - plain).abs() < 0.5, "no separator between Legal and A4: {letter:?} {legal:?} {a4:?}");
|
||||
assert!(custom.top() - a4.top() > plain + 1.0, "a separator between A4 and Custom: A4 {a4:?}, Custom {custom:?}, plain step {plain}");
|
||||
}
|
||||
|
||||
/// A pattern row shows the first pattern for a stored id the rows lack without writing it, a pick writes the pattern's
|
||||
|
||||
Reference in New Issue
Block a user