#pragma once #include "IUiBackend.hpp" #include #include #include namespace Slic3r { namespace GUI { namespace Automation { // A target specification. Resolution order: id -> path -> predicate // (name OR class OR label OR value, all provided fields must match). struct Target { std::optional id; std::optional path; std::optional name; // matches id OR label std::optional klass; std::optional label; std::optional value; std::optional backend; bool empty() const { return !id && !path && !name && !klass && !label && !value; } }; // Depth-first flatten of a tree into stable-ordered pointers (parents before children). std::vector flatten(const UiNode& root); // All nodes matching the target spec (resolution-order aware). std::vector 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 // negative... here we keep it simple: null => false for all states. bool evaluate_state(const UiNode* node, WaitState state, const std::optional& expected_value); }}} // namespace