mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-27 16:59:43 +01:00
The Paragraph Style Options Tabs buttons, the Script File Access list, Split Into Grid's fields and the 3D Bevel heading are framework components, as the rest of their dialogs are. - Paragraph Style Options › Tabs: Add, Delete Tab and Clear All Tabs are framework buttons in a row. - Script File Access: the list of picked files is a scrolled stack named "Picked files", up to 120 pt high before it scrolls. New test `tests::script_run::a_scripts_file_dialog_lists_several_picked_files_in_a_named_group`. - Split Into Grid: the fields are a framework grid of two columns, rows on the left and columns on the right; before, the egui grid inside the form drew the Columns fields over the Rows fields. New test `dialogs::tests_accessibility::split_into_grid_lays_out_its_fields_above_add_guides`. - 3D Bevel: the heading is a section named Bevel with Reset as its control. New test `dialogs::revolve::tests::the_bevel_heading_is_a_section_between_cap_and_bevel_shape`. Zig Zag's Ridges per segment, the bevel's Repeat and Revolve's Segments are counts and show no unit after the number, as production's did; before, Ridges showed a percent sign and Repeat and Segments showed px. Roughen's Detail no longer shows a percent sign either. Production showed "/in" after it, and craft-libs has no per-inch count unit for that yet, so it shows no unit. New tests `dialogs::effect::tests::zig_zag_ridges_and_roughen_detail_show_no_percent_sign` and `dialogs::revolve::tests::the_bevel_repeat_and_the_revolve_segments_show_no_unit`.
52 lines
2.7 KiB
Rust
52 lines
2.7 KiB
Rust
//! The Split Into Grid dialog names its row and column fields with their axis and lays them out in two columns, read
|
|
//! from the access tree of the window.
|
|
|
|
use egui::accesskit::Role;
|
|
use serde_json::json;
|
|
|
|
use super::tests::{app, frame, settle};
|
|
|
|
/// Split Into Grid keeps its visible labels while naming the row and column gutter and total inputs by axis and context
|
|
/// (`FieldLabelRole::Describes`): the labels describe, the names carry the axis.
|
|
#[test]
|
|
fn split_into_grid_names_row_and_column_fields_with_context() {
|
|
let mut app = app();
|
|
app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 120, "height": 80})).unwrap();
|
|
app.run("select.all", json!({})).unwrap();
|
|
assert!(super::object_dialogs::open_from_menu(&mut app, "object.path.splitIntoGrid"));
|
|
settle(&mut app);
|
|
let out = frame(&mut app, vec![]);
|
|
let update = out.platform_output.accesskit_update.expect("an accessibility tree");
|
|
// The fields are number fields, which the framework exposes as spin buttons.
|
|
let names: Vec<&str> = update
|
|
.nodes
|
|
.iter()
|
|
.filter(|(_, node)| matches!(node.role(), Role::TextInput | Role::SpinButton))
|
|
.filter_map(|(_, node)| node.label())
|
|
.collect();
|
|
for name in ["Rows: Gutter:", "Columns: Gutter:", "Rows: Total:", "Columns: Total:"] {
|
|
assert!(names.contains(&name), "{name} among the text inputs: {names:?}");
|
|
}
|
|
}
|
|
|
|
/// Split Into Grid lays its fields out as a grid: the columns' fields stand right of the rows' fields on the same
|
|
/// lines, and Add Guides stands below the last of them.
|
|
#[test]
|
|
fn split_into_grid_lays_out_its_fields_above_add_guides() {
|
|
let mut app = app();
|
|
app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 120, "height": 80})).unwrap();
|
|
app.run("select.all", json!({})).unwrap();
|
|
assert!(super::object_dialogs::open_from_menu(&mut app, "object.path.splitIntoGrid"));
|
|
settle(&mut app);
|
|
let out = frame(&mut app, vec![]);
|
|
let update = out.platform_output.accesskit_update.expect("an accessibility tree");
|
|
let rect = |name: &str| {
|
|
let node = update.nodes.iter().map(|(_, node)| node).find(|node| node.label() == Some(name));
|
|
node.and_then(|node| node.bounds()).unwrap_or_else(|| panic!("{name} has a rect"))
|
|
};
|
|
let (rows, columns, guides) = (rect("Rows: Total:"), rect("Columns: Total:"), rect("Add Guides"));
|
|
assert!(columns.x0 > rows.x1, "the columns' fields stand right of the rows' fields: {rows:?} {columns:?}");
|
|
assert!(columns.y0 < rows.y1 && rows.y0 < columns.y1, "the two Total fields share a line: {rows:?} {columns:?}");
|
|
assert!(guides.y0 >= rows.y1.max(columns.y1), "Add Guides stands below the grid: {guides:?} {rows:?} {columns:?}");
|
|
}
|