imetest

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0 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 imetest has test doubles for the input method of the Linux backends: an input method that records its calls, and a poster that lets the test run what the bridge hands to the UI thread.

Flutter: no counterpart

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IM

type IM struct {

	// Handled decides whether ProcessKey consumes a key; nil consumes none.
	Handled func(dbus.IMEKey) bool
	// Fail makes the calls whose name is a key fail with the error.
	Fail map[string]error
	// Events is the function the bridge gave to open; call it to send the
	// bridge a change of the input method.
	Events func(dbus.IMEEvent)
	// Block, when set, makes ProcessKey wait for it to be closed (or for its
	// context to end).
	Block chan struct{}
	// contains filtered or unexported fields
}

IM is a dbus.InputMethod that records the calls as text such as "SetCursorRect(1,2,3,4)" and answers ProcessKey with Handled.

Flutter: no counterpart

func (*IM) Close

func (f *IM) Close() error

Close records the call.

func (*IM) FocusIn

func (f *IM) FocusIn(context.Context) error

FocusIn records the call.

func (*IM) FocusOut

func (f *IM) FocusOut(context.Context) error

FocusOut records the call.

func (*IM) Log

func (f *IM) Log() []string

Log returns the calls so far.

Flutter: no counterpart

func (*IM) Name

func (f *IM) Name() string

Name is "fake".

func (*IM) Open

func (f *IM) Open(_ context.Context, events func(dbus.IMEEvent)) (dbus.InputMethod, error)

Open is an ime.Opener that returns f, and keeps the events function.

Flutter: no counterpart

func (*IM) ProcessKey

func (f *IM) ProcessKey(ctx context.Context, k dbus.IMEKey) (bool, error)

ProcessKey records the call as "ProcessKey(<char>,<keycode>,<state>,<release>)".

func (*IM) Reset

func (f *IM) Reset(context.Context) error

Reset records the call.

func (*IM) SetContent

func (f *IM) SetContent(_ context.Context, c dbus.IMEContent) error

SetContent records the call.

func (*IM) SetCursorRect

func (f *IM) SetCursorRect(_ context.Context, x, y, w, h int) error

SetCursorRect records the call.

func (*IM) SetSurroundingText

func (f *IM) SetSurroundingText(_ context.Context, text string, cursor, anchor int) error

SetSurroundingText records the call.

func (*IM) WaitCalls

func (f *IM) WaitCalls(t *testing.T, n int) []string

WaitCalls waits until the input method has had n calls, and returns them.

Flutter: no counterpart

type Poster

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

Poster is an ime.Poster that keeps the posted functions until the test runs them on its own goroutine.

Flutter: no counterpart

func NewPoster

func NewPoster() *Poster

NewPoster makes a Poster.

Flutter: no counterpart

func (*Poster) Idle

func (p *Poster) Idle(t *testing.T)

Idle fails the test if something is posted within a short time.

Flutter: no counterpart

func (*Poster) Post

func (p *Poster) Post(fn func())

Post keeps fn.

func (*Poster) Run

func (p *Poster) Run(t *testing.T)

Run runs the next posted function, waiting up to two seconds for it.

Flutter: no counterpart

Jump to

Keyboard shortcuts

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