script

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ScreenshotsFolder = "./docs/screenshots"

Variables

View Source
var ScreenshotsScript = &Script{
	sections: []*Section{
		{
			steps: []Step{
				SetTimebase("2023-06-28T19:00:00Z"),
				Wait(2 * time.Second),
			},
		},
		{
			enter: AskForScreenshot("about dialog", 1*time.Second),
			steps: []Step{
				func(_ context.Context, r *Runtime) time.Duration {
					r.UI(r.App.About)
					return 0
				},
				TriggerScreenshot("about"),
				Wait(5 * time.Second),
			},
		},
		{
			enter: AskForScreenshot("file menu, hightlight OPEN CONFIGURATION FILE", 10*time.Second),
			steps: []Step{
				TriggerScreenshot("menu_file_open_configuration"),
				Wait(5 * time.Second),
			},
		},
		{
			enter: AskForScreenshot("file menu, hightlight NEW", 10*time.Second),
			steps: []Step{
				TriggerScreenshot("menu_file_new"),
				Wait(5 * time.Second),
			},
		},
		{
			enter: AskForScreenshot("new CWT contest session", 1*time.Second),
			steps: []Step{
				func(_ context.Context, r *Runtime) time.Duration {
					r.UI(r.App.New)
					r.UI(func() {
						r.App.NewContestController.SelectContestIdentifier("CW-OPS")
						r.App.NewContestController.EnterContestName("CWT Screenshot Demo")
						r.App.NewContestController.RefreshView()
					})
					return 0
				},
				TriggerScreenshot("new_cwt"),
				Describe("close the dialog with 'NEW', save the contest with the proposed filename\nthe settings dialog will show up, just wait for the next set of instructions", 10*time.Second),
				func(_ context.Context, r *Runtime) time.Duration {
					r.UI(func() {
						r.App.Settings.EnterStationCallsign("DL0ABC")
						r.App.Settings.EnterStationOperator("DL1ABC")
						r.App.Settings.EnterStationLocator("AA00xx")
						r.App.Settings.SetContestStartTimeNow()
						r.App.Settings.EnterContestExchangeValue(core.EntryField("myExchange_1"), "Walter")
						r.App.Settings.EnterContestExchangeValue(core.EntryField("myExchange_2"), "DL")
						r.App.Settings.RefreshView()
					})
					return 0
				},
				Describe("select a current call history file", 20*time.Second),
				Describe("contest settings dialog, complete", 1*time.Second),
				TriggerScreenshot("contest_settings_complete"),
				Describe("contest settings dialog, section 'My Exchange'", 1*time.Second),
				TriggerScreenshot("contest_settings_myexchange_cwt"),
				Describe("close the contest settings dialog, screenshot of empty main window", 10*time.Second),
				TriggerScreenshot("main_window_empty"),
			},
		},
		{
			enter: AskForScreenshot("main window CW macros", 0),
			steps: []Step{
				Describe("only the CW area, mark (1) workmode, (2) ESM, (3) macro button, (4) macros... button, (5) speed setting", 3*time.Second),
				TriggerScreenshot("main_window_macros"),
				func(_ context.Context, r *Runtime) time.Duration {
					r.UI(func() {
						r.App.Keyer.OpenKeyerSettings()
					})
					return 0
				},
				Describe("the macros dialog complete, select a preset", 10*time.Second),
				TriggerScreenshot("macros_dialog"),
				Describe("close the macros dialog", 10*time.Second),
			},
		},
		{
			enter: AskForScreenshot("main window with QSO data", 0),
			steps: []Step{
				FillQSOList(0, 14),
				Describe("score window complete, mark (1) the score graph and (2) the score table", 1*time.Second),
				TriggerScreenshot("score_window_filled"),
				FillQSOList(14, -1),
				Describe("main window complete", 1*time.Second),
				TriggerScreenshot("main_window_filled"),
			},
		},
		{
			enter: AskForScreenshot("main window QSO data entry", 0),
			steps: []Step{
				func(_ context.Context, r *Runtime) time.Duration {
					r.UI(func() {
						r.App.Entry.Clear()
						r.App.Entry.Enter("AA3B")
						r.App.Entry.RefreshView()
					})
					return 0
				},
				Describe("only the entry area, mark (1) best matching callsign, (2) predicted exchange, (3) qso value, (4) callsign infos", 1*time.Second),
				TriggerScreenshot("main_window_entry"),
				Describe("only the supercheck area", 1*time.Second),
				TriggerScreenshot("main_window_supercheck"),
				Describe("only the vfo area", 1*time.Second),
				TriggerScreenshot("main_window_vfo"),
				Describe("only the status bar", 1*time.Second),
				TriggerScreenshot("main_window_status_bar"),
			},
		},
		{
			steps: []Step{
				Describe("all screenshots taken, closing the application", 0),
				func(_ context.Context, r *Runtime) time.Duration {
					r.UI(r.App.Quit)
					return 0
				},
			},
		},
	},
}

Functions

This section is empty.

Types

type Clock

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

func (*Clock) Add

func (c *Clock) Add(offset time.Duration)

func (*Clock) Now

func (c *Clock) Now() time.Time

func (*Clock) Reset

func (c *Clock) Reset()

func (*Clock) Set

func (c *Clock) Set(now time.Time)

func (*Clock) SetFromRFC3339

func (c *Clock) SetFromRFC3339(s string)

func (*Clock) SetMinute

func (c *Clock) SetMinute(minute int)

type Condition

type Condition func(ctx context.Context, r *Runtime) (bool, time.Duration)

func Ask

func Ask(description string, delay time.Duration) Condition

func AskForScreenshot

func AskForScreenshot(description string, delay time.Duration) Condition

type Runtime

type Runtime struct {
	Clock *Clock
	App   *app.Controller
	UI    func(func())
}

type Script

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

func (*Script) Now

func (s *Script) Now() time.Time

func (*Script) Step

func (s *Script) Step(ctx context.Context, app *app.Controller, ui func(func())) bool

type Section

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

func (*Section) Step

func (s *Section) Step(ctx context.Context, r *Runtime) bool

type Step

type Step func(ctx context.Context, r *Runtime) time.Duration

func AddTimebaseOffset

func AddTimebaseOffset(offset time.Duration) Step

func ClearScreenshotsFolder

func ClearScreenshotsFolder() Step

func DeleteScreenshot

func DeleteScreenshot(name string) Step

func Describe

func Describe(description string, delay time.Duration) Step

func DescribeScreenshot

func DescribeScreenshot(description string, delay time.Duration) Step

func FillQSOList

func FillQSOList(begin, end int) Step

func ResetTimebase

func ResetTimebase() Step

func SetTimebase

func SetTimebase(timebase string) Step

func TriggerScreenshot

func TriggerScreenshot(filename string) Step

func TriggerScreenshotWithDelay

func TriggerScreenshotWithDelay(name string, delay time.Duration) Step

func Wait

func Wait(duration time.Duration) Step

Jump to

Keyboard shortcuts

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