mocks

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownView = ActiveView(iota)
	ClientView
	ChannelView
)

Variables

View Source
var Events = data.NewEvents([]data.Event{
	data.Event{EventID: data.EventID{Epoch: 1, Seq: 1}, Contents: "TOPIC Act I, Scene 1"},
	data.Event{EventID: data.EventID{Epoch: 1, Seq: 2}, Contents: "JOIN barnardo"},
	data.Event{EventID: data.EventID{Epoch: 1, Seq: 3}, Contents: "JOIN francisco"},
	data.Event{EventID: data.EventID{Epoch: 1, Seq: 4}, Contents: "<barnardo> Who's there?"},
	data.Event{EventID: data.EventID{Epoch: 1, Seq: 5}, Contents: "<francisco> Nay answer me: Stand & vnfold your selfe"},
	data.Event{EventID: data.EventID{Epoch: 1, Seq: 6}, Contents: "<barnardo> Long liue the King"},
	data.Event{EventID: data.EventID{Epoch: 2, Seq: 1}, Contents: "<claudius> Welcome, dear Rosencrantz and Guildenstern!"},
	data.Event{EventID: data.EventID{Epoch: 2, Seq: 2}, Contents: "<gertrude> Good gentlemen, he hath much talk'd of you;"},
	data.Event{EventID: data.EventID{Epoch: 2, Seq: 3}, Contents: "<rosencrantz> Both your majesties"},
})

Functions

This section is empty.

Types

type ActiveView

type ActiveView int

ActiveView indicates which view is active.

type Backend

type Backend struct {
	Receiver backend.StateReceiver

	Sent []string
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend() *Backend

func (*Backend) EventsBefore

func (b *Backend) EventsBefore(network, tgt string, n int, last data.EventID) []data.Event

func (*Backend) Send

func (b *Backend) Send(_, _ string, message string)

func (*Backend) Subscribe

func (b *Backend) Subscribe(r backend.StateReceiver)

func (*Backend) SubscribeFiltered

func (b *Backend) SubscribeFiltered(r backend.FilteredStateReceiver)

type Controller

type Controller struct {
	*UI

	V       ActiveView
	Network string
	Channel string
}

Controller is mock global-level controller. Its methods should only be called within the .Update thread.

func NewController

func NewController() *Controller

TODO: - Unify on a single Controller, rather than having Controller, UI, UpdateCounter - Add Context to constructor to clean up old threads when test is done

func (*Controller) ActivateChannel

func (c *Controller) ActivateChannel(network, channel string)

func (*Controller) ActivateClient

func (c *Controller) ActivateClient()

type UI

type UI struct {
	Root tui.Widget

	Painter *tui.Painter

	HasQuit bool
}

UI implements a subset of the tui.UI functionality for use in tests.

func NewUI

func NewUI() *UI

func (*UI) Quit

func (ui *UI) Quit()

func (*UI) Repaint

func (ui *UI) Repaint()

Repaint re-renders if the painter and root are not nil.

func (*UI) SetWidget

func (ui *UI) SetWidget(w tui.Widget)

func (*UI) Type

func (ui *UI) Type(s string)

Type produces an approprate keypress against its root for each character in the input. Each is a separate event in the UI thread.

func (*UI) Update

func (ui *UI) Update(f func())

Jump to

Keyboard shortcuts

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