Dialog side buttons trial: the body's top from its check box

The label of a check box is centred on the box, below its row's top; the check box's cell starts at the row's top.
This commit is contained in:
aiongg
2026-11-12 14:32:41 +00:00
parent 4737161b83
commit 0bc16a954d
+8 -2
View File
@@ -2,7 +2,7 @@
use super::{BlockingOverlay, Dialog};
use crate::choice::Checkbox;
use crate::contract::{Bind, Props as _, Show as _, ShowContainer as _};
use crate::contract::{Bind, Props as _, Role, Show as _, ShowContainer as _};
use crate::runtime::overlay::CloseReason;
use crate::sections::{DialogRole, FooterButton};
use crate::testing::input::key_press;
@@ -126,8 +126,14 @@ fn side_buttons_stand_in_one_column_beside_the_body() {
let key = tree.keys().into_iter().find(|key| tree.name_of(*key) == Some(name));
key.and_then(|key| tree.bounds_of(key))
};
// The body's top is its check box's cell; its label is centred on the box, below the row's top.
let body = tree
.keys()
.into_iter()
.find(|key| tree.role_of(*key) == Some(Role::CHECK_BOX) && tree.name_of(*key) == Some("Snap to the grid"))
.and_then(|key| tree.bounds_of(key));
let [Some(ok), Some(cancel), Some(other), Some(preview), Some(body)] =
["OK", "Cancel", "Add to Swatches", "Preview", "Snap to the grid"].map(rect)
[rect("OK"), rect("Cancel"), rect("Add to Swatches"), rect("Preview"), body]
else {
panic!("every part is shown");
};