Skip to content

testudos.api.objects

testudos.api.objects

Object tree utilities.

These helpers expose parent/child navigation and scoped lookup in the AUT object tree.

descriptor_qml_id

def descriptor_qml_id(descriptor: dict[str, Any]) -> str

Return QML id / object name from an agent object descriptor.

same_object

def same_object(left: QtObjectProxy, right: QtObjectProxy) -> bool

Return True when both proxies refer to the same backend object.

get_children

def get_children(obj: str | QtObjectProxy) -> list[QtObjectProxy]

Return direct children of obj (no recursion).

Uses backend RPC action getChildren.

get_parent

def get_parent(obj: str | QtObjectProxy) -> QtObjectProxy | None

Return direct parent of obj, or None for top-level objects.

Uses descriptor metadata field parent.

is_descendant_of

def is_descendant_of(candidate: QtObjectProxy,
ancestor: QtObjectProxy) -> bool

Return True when candidate is ancestor or lives under it in the object tree.

is_object_visible

def is_object_visible(obj: QtObjectProxy) -> bool

Return True when the backend reports obj.visible as true.

Objects without a readable visible property are treated as visible.

is_effectively_visible

def is_effectively_visible(obj: QtObjectProxy) -> bool

Return True when the object and enclosing windows are visible.

Item visible alone is not enough for controls inside a hidden Window dialog: the parent window must also be visible.

get_descendant

def get_descendant(parent: str | QtObjectProxy,
qml_id: str,
*,
require_visible: bool = True) -> QtObjectProxy | None

Find the first descendant of parent with the given QML id (depth-first).

Use this when the same QML id appears in multiple component instances (for example dialogYesButton on every PCRMessageDialog) and a global findObject would return the wrong one. Prefer :func:wait_for_object with parent= in tests.

Arguments:

  • parent - Container object or its QML id / address.
  • qml_id - QML id to search for under parent.
  • require_visible - When True (default), skip matches that are not effectively visible.

get_top_level_objects

def get_top_level_objects() -> list[QtObjectProxy]

Return all top-level objects currently known by backend.