mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-03 15:21:17 -05:00
Tests: the panel harness finds a control by its label alone again: Fixture::by_label passes over a caption link to the field it captions (craft-libs b72fc4200)
This commit is contained in:
@@ -88,16 +88,9 @@ impl Panel {
|
||||
tree.keys().into_iter().filter_map(|key| tree.name_of(key)).map(str::to_owned).collect()
|
||||
}
|
||||
|
||||
/// The control named `name` in the latest frame. A caption link takes the name of the number field it captions
|
||||
/// (the Control bar's X, Y, W and H): the field is the control.
|
||||
/// The control named `name` in the latest frame.
|
||||
fn look(&self, name: &str) -> Target {
|
||||
use craft::ui::contract::Role;
|
||||
let found = self.fixture.by_label(name).unwrap_or_else(|| panic!("no {name:?} in {:?}", self.names()));
|
||||
let tree = self.fixture.tree();
|
||||
if tree.role_of(found.node) != Some(Role::LINK) {
|
||||
return found;
|
||||
}
|
||||
self.fixture.by_role(Role::SPIN_BUTTON).into_iter().find(|t| tree.name_of(t.node) == Some(name)).unwrap_or(found)
|
||||
self.fixture.by_label(name).unwrap_or_else(|| panic!("no {name:?} in {:?}", self.names()))
|
||||
}
|
||||
|
||||
/// A fresh frame, then the control named `name`.
|
||||
|
||||
Reference in New Issue
Block a user