eistest

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 12 Imported by: ? modules, 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 eistest drives an EIS server with libei, the reference C client, loaded through purego: the oracle an EIS server, and a portal serving one, are held to in tests.

Index

Constants

View Source
const (
	CapPointer  = 1 << 0
	CapAbsolute = 1 << 1
	CapKeyboard = 1 << 2
	CapTouch    = 1 << 3
	CapScroll   = 1 << 4
	CapButton   = 1 << 5
	CapText     = 1 << 6
)

The device capabilities a client binds (libei.h's EI_DEVICE_CAP_*).

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Log     []string
	Keymaps map[string]string
	// contains filtered or unexported fields
}

Client is a libei context connected to an EIS server that writes what it receives to Log, one line per event: "connect", "disconnect", "seat <name>", "resumed <device>", "removed <device>", "start <device> <sequence>", "stop <device>", "frame <device>", "motion <dx> <dy>", "button <code> <pressed>", "scroll <dx> <dy>", "scroll-stop <x> <y>", "discrete <dx> <dy>", "key <code> <pressed>" and "modifiers <depressed> <latched> <locked> <group>". Devices are named without the seat's prefix.

func Receive

func Receive(t testing.TB, fd int, name string, caps ...uintptr) *Client

Receive connects a libei receiver called name to fd (which it takes over) and binds caps on every seat once Until has dispatched it.

func Send

func Send(t testing.TB, fd int, name string, caps ...uintptr) *Client

Send connects a libei sender instead, for a test that a receiver's server turns it away.

func (*Client) Saw

func (c *Client) Saw(entries ...string) func() bool

Saw holds once the log has every entry.

func (*Client) Since

func (c *Client) Since(mark string) []string

Since is the log from the first mark on, nil without one.

func (*Client) Until

func (c *Client) Until(what string, done func() bool)

Until dispatches libei until done holds, failing the test with the log after five seconds.

type Device

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

Device is a resumed device, for the emulate callback of Drive.

func (Device) Button

func (d Device) Button(code uint32, press bool)

Button presses or releases a button.

func (Device) Frame

func (d Device) Frame()

Frame ends a frame of events.

func (Device) Has

func (d Device) Has(c uint32) bool

Has reports whether the device has capability c.

func (Device) Key

func (d Device) Key(code uint32, press bool)

Key presses or releases a key.

func (Device) Keysym

func (d Device) Keysym(sym uint32, press bool)

Keysym presses or releases a keysym.

func (Device) Motion

func (d Device) Motion(x, y float64)

Motion moves the pointer relatively.

func (Device) MotionAbsolute

func (d Device) MotionAbsolute(x, y float64)

MotionAbsolute moves the pointer to a point of the regions.

func (Device) Name

func (d Device) Name() string

Name is the device's name.

func (Device) ScrollDelta

func (d Device) ScrollDelta(x, y float64)

ScrollDelta scrolls smoothly.

func (Device) ScrollDiscrete

func (d Device) ScrollDiscrete(x, y int32)

ScrollDiscrete scrolls in 120ths of a detent.

func (Device) ScrollStop

func (d Device) ScrollStop(x, y bool)

ScrollStop ends a smooth scroll on the axes set.

func (Device) Start

func (d Device) Start()

Start begins an emulation sequence.

func (Device) Stop

func (d Device) Stop()

Stop ends the emulation sequence.

func (Device) Touch

func (d Device) Touch(x, y, mx, my float64)

Touch puts a touch point down at (x, y), moves it to (mx, my) in the next frame, and lifts it in the frame after.

type Lib

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

Lib is libei's sender API.

func Load

func Load(t testing.TB) *Lib

Load binds libei once per process; a missing library fails the test.

func (*Lib) Drive

func (l *Lib) Drive(t testing.TB, fd int, name string, caps []uintptr, want int, timeout time.Duration, emulate func(Device)) Session

Drive connects a libei sender called name to fd (which it takes over), binds caps on every seat, and runs emulate on every device the server resumes, until resumed devices reach want or the timeout passes.

type Region

type Region struct {
	X, Y, Width, Height uint32
	MappingID           string
}

Region is a device region as the client sees it.

type Session

type Session struct {
	Connected bool
	// Seats and Devices are the names of the seats added and the
	// devices resumed, in order.
	Seats, Devices []string
	// Regions are each resumed device's regions, by device name.
	Regions map[string][]Region
}

Session is what a libei sender saw of the server.

Jump to

Keyboard shortcuts

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