mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-28 06:30:32 +00:00
feat(automation): resolve_unique + wait-state evaluation
This commit is contained in:
@@ -45,6 +45,12 @@ std::vector<const UiNode*> find_matches(const UiNode& root, const Target& target
|
||||
return out;
|
||||
}
|
||||
|
||||
const UiNode* resolve_unique(const UiNode& root, const Target& target, int& match_count) {
|
||||
const auto m = find_matches(root, target);
|
||||
match_count = static_cast<int>(m.size());
|
||||
return m.size() == 1 ? m.front() : nullptr;
|
||||
}
|
||||
|
||||
bool evaluate_state(const UiNode* node, WaitState state,
|
||||
const std::optional<std::string>& expected_value) {
|
||||
if (node == nullptr)
|
||||
|
||||
@@ -27,6 +27,10 @@ std::vector<const UiNode*> flatten(const UiNode& root);
|
||||
// All nodes matching the target spec (resolution-order aware).
|
||||
std::vector<const UiNode*> find_matches(const UiNode& root, const Target& target);
|
||||
|
||||
// Resolve to exactly one node for actions. Returns the node on a unique match;
|
||||
// returns nullptr otherwise and sets match_count (0 = not found, >1 = ambiguous).
|
||||
const UiNode* resolve_unique(const UiNode& root, const Target& target, int& match_count);
|
||||
|
||||
enum class WaitState { Exists, Visible, Enabled, Value };
|
||||
|
||||
// True if `node` satisfies the wait condition. A null node only satisfies a
|
||||
|
||||
Reference in New Issue
Block a user