qa

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: EPL-2.0 Imports: 2 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package qa is the QA hook of a gowt app. A build with -tags gowtqa and GOWT_QA_SOCKET in the environment makes gowt.Run listen on that socket; package qa/qatest drives the app from go test. Without the tag the app has no server and no network code: Handle does nothing.

Index

Constants

View Source
const (
	EnvSocket = "GOWT_QA_SOCKET" // unix socket path; a QA build listens only when it is set
	EnvData   = "GOWT_QA_DATA"   // a private data directory for the app to use instead of the user's
)

Environment of a QA run, set by qatest.

Variables

This section is empty.

Functions

func Handle

func Handle(name string, fn func(args Args) error)

Handle registers fn under name for qatest's State; fn runs on the UI thread. The name "reset" is the one qatest calls before each test. Without -tags gowtqa it does nothing.

func HandleValue

func HandleValue(name string, fn func(args Args) (any, error))

HandleValue is Handle for a handler that returns a value to the test, JSON encoded.

Types

type Args

type Args struct {
	// contains filtered or unexported fields
}

Args are the key-value arguments a test passes to a handler.

func NewArgs

func NewArgs(raw json.RawMessage) (Args, error)

NewArgs wraps the raw JSON object a request carried; an empty or null raw is no arguments.

func (Args) Bool

func (a Args) Bool(key string) bool

func (Args) Decode

func (a Args) Decode(key string, v any) error

Decode reads the value of key into v; an absent key leaves v alone and is no error.

func (Args) Has

func (a Args) Has(key string) bool

Has reports whether the test passed key.

func (Args) Int

func (a Args) Int(key string) int

func (Args) String

func (a Args) String(key string) string

String, Int and Bool give the zero value when key is absent or of another type.

type Job

type Job struct {
	Name       string `json:"name"`
	Background bool   `json:"background,omitempty"`
	Track      bool   `json:"track,omitempty"`
	ElapsedMS  int64  `json:"elapsed_ms"`
	Done       int    `json:"done,omitempty"`
	Total      int    `json:"total,omitempty"`
	Text       string `json:"text,omitempty"`
}

Job is one running Job or Track of the app, as the "jobs" command reports it; it mirrors gowt.JobInfo.

type Node

type Node struct {
	ID       string `json:"id,omitempty"`
	Class    string `json:"class"`
	Text     string `json:"text,omitempty"`
	Enabled  bool   `json:"enabled"`
	Visible  bool   `json:"visible"`
	Focused  bool   `json:"focused,omitempty"`
	Bounds   [4]int `json:"bounds"` // x, y, width, height in the coordinates of its window
	Checked  *bool  `json:"checked,omitempty"`
	Selected []int  `json:"selected,omitempty"`
	Value    string `json:"value,omitempty"`
	Path     string `json:"path"`
	Children []Node `json:"children,omitempty"`
}

Node is one control or item in a dump; it mirrors internal/qatree.Node.

type Selector

type Selector struct {
	ID     string    `json:"id,omitempty"`
	Class  string    `json:"class,omitempty"`
	Text   string    `json:"text,omitempty"`
	Within *Selector `json:"within,omitempty"`
}

Selector picks controls; it mirrors internal/qatree.Selector, which the client cannot import without linking the toolkit. An empty field matches anything.

func Class

func Class(class string) Selector

Class picks controls of an swt class: "Button", "Table", "TableItem", ...

func ID

func ID(id string) Selector

ID picks the control created with gowt.ID(id).

func Text

func Text(text string) Selector

Text picks controls showing text.

func (Selector) In

func (s Selector) In(parent Selector) Selector

In narrows s to the subtree of the one control parent picks.

Directories

Path Synopsis
Package qatest drives a QA build of a gowt app (go build -tags gowtqa) from go test.
Package qatest drives a QA build of a gowt app (go build -tags gowtqa) from go test.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL