//go:build !mygo_noinspector package automation import ( "fmt" "runtime" "strconv" "strings" "github.com/egoist/mygo/internal/accelerator" "github.com/egoist/mygo/internal/platform" ) // roleNames are the names of platform.AccessRole's roles, in their order. var roleNames = [...]string{ "group", "text", "button", "link", "checkBox", "radio", "switch", "slider", "progress", "textField", "image", "list", "scroll", "dialog", "popup", "tooltip", "popUpButton", "tabList", "tab", "splitter", "status", "table", "row", "cell", "columnHeader", "tree", "treeItem", "listItem", "menuButton", "toolbar", "radioGroup", "toggleButton", "comboBox", "disclosure", "meter", "stepper", "colorWell", "alertDialog", "menu", "menuBar", "menuItem", "menuItemCheckBox", "menuItemRadio", "heading", "region", "log", "timer", "alert", "separator", "rowHeader", "search", "article", "navigation", "grid", "treeGrid", "deletion", "insertion", "tabPanel", "main", "banner", "contentInfo", "complementary", } func roleName(r platform.AccessRole) string { if int(r) < len(roleNames) { return roleNames[r] } return "role" + strconv.Itoa(int(r)) } // stateNames are the names of platform.AccessStates' bits, from the // lowest. var stateNames = [...]string{ "focusable", "disabled", "checked", "mixed", "selected", "expanded", "multiline", "password", "readOnly", "selectable", "offscreen", "multiselectable", "segment", "search", "invalid", "sortAscending", "sortDescending", "expandable", "vertical", "busy", "sortOther", "horizontal", } // actionNames are the names of platform.AccessActions' bits, from the // lowest. var actionNames = [...]string{ "press", "focus", "increment", "decrement", "setValue", "scrollIntoView", "expand", } // names returns the names of the bits set in bits. func names(bits uint64, of []string) []string { var out []string for i, name := range of { if bits&(1<= 1 && n <= 12 { k = platform.KeyF1 + platform.Key(n-1) } if k == platform.KeyUnknown { return 0, 0, fmt.Errorf("native UI has no key %q", a.Key) } return k, mods, nil }