testutil

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBoardTasks

func CreateBoardTasks(dir string) error

CreateBoardTasks creates sample tasks across all board panes

func CreateTestTask

func CreateTestTask(dir, id, title string, status task.Status, taskType task.Type) error

CreateTestTask creates a markdown task file with YAML frontmatter

Types

type TestApp

type TestApp struct {
	App           *tview.Application
	Screen        tcell.SimulationScreen
	RootLayout    *view.RootLayout
	TaskStore     store.Store
	NavController *controller.NavigationController
	InputRouter   *controller.InputRouter
	TaskDir       string

	PluginConfigs     map[string]*model.PluginConfig
	PluginControllers map[string]controller.PluginControllerInterface
	PluginDefs        []plugin.Plugin
	// contains filtered or unexported fields
}

TestApp wraps the full MVC stack for integration testing with SimulationScreen

func NewTestApp

func NewTestApp(t *testing.T) *TestApp

NewTestApp bootstraps the full MVC stack for integration testing. Mirrors the initialization pattern from main.go.

func (*TestApp) Cleanup

func (ta *TestApp) Cleanup()

Cleanup tears down the test app and releases resources

func (*TestApp) DraftTask

func (ta *TestApp) DraftTask() *taskpkg.Task

DraftTask returns the current draft task (if any).

func (*TestApp) Draw

func (ta *TestApp) Draw()

Draw forces a synchronous draw without running the app event loop

func (*TestApp) DumpScreen

func (ta *TestApp) DumpScreen()

DumpScreen prints the current screen content for debugging

func (*TestApp) EditingTask

func (ta *TestApp) EditingTask() *taskpkg.Task

EditingTask returns the current in-memory editing copy (if any).

func (*TestApp) FindText

func (ta *TestApp) FindText(needle string) (bool, int, int)

FindText searches for a text string anywhere on the screen. Returns (found, x, y) where x, y are the coordinates of the first match.

func (*TestApp) GetCell

func (ta *TestApp) GetCell(x, y int) (rune, tcell.Style)

GetCell extracts the rune and style at a specific screen position

func (*TestApp) GetPluginConfig

func (ta *TestApp) GetPluginConfig(pluginName string) *model.PluginConfig

GetPluginConfig retrieves the PluginConfig for a given plugin name. Returns nil if the plugin is not loaded.

func (*TestApp) GetTextAt

func (ta *TestApp) GetTextAt(x, y, width int) string

GetTextAt extracts text from a screen region starting at (x, y) with given width

func (*TestApp) LoadPlugins

func (ta *TestApp) LoadPlugins() error

LoadPlugins loads embedded plugins and wires them into the test app. This enables testing of plugin-related functionality.

func (*TestApp) SendKey

func (ta *TestApp) SendKey(key tcell.Key, ch rune, mod tcell.ModMask)

SendKey simulates a key press by directly calling the input capture handler. Input flows through app's InputCapture → InputRouter.HandleInput. If InputCapture doesn't consume the event, it's forwarded to the focused primitive.

func (*TestApp) SendKeyToFocused

func (ta *TestApp) SendKeyToFocused(key tcell.Key, ch rune, mod tcell.ModMask)

SendKeyToFocused sends a key event directly to the focused primitive's InputHandler. Use this for text input into InputField, TextArea, etc.

func (*TestApp) SendText

func (ta *TestApp) SendText(text string)

SendText types a string of characters into the focused primitive

Jump to

Keyboard shortcuts

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