From f3eaf0c5a0a7ad01ed1af4d93f4215dd1db6d102 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 22 May 2019 18:36:23 -0700 Subject: [PATCH] add a test where literally every GUI thing is isolated in a seperate goroutine Signed-off-by: Jeff Carr --- .gitignore | 1 + test4/Makefile | 6 ++++++ test4/main.go | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 test4/Makefile create mode 100644 test4/main.go diff --git a/.gitignore b/.gitignore index ed290f1..079a882 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ example-table/example-table test1/test1 test2/test2 test3/test3 +test4/test4 diff --git a/test4/Makefile b/test4/Makefile new file mode 100644 index 0000000..d81691a --- /dev/null +++ b/test4/Makefile @@ -0,0 +1,6 @@ +build: + go build + ./test2 + +run: + go run *.go diff --git a/test4/main.go b/test4/main.go new file mode 100644 index 0000000..3e17723 --- /dev/null +++ b/test4/main.go @@ -0,0 +1,49 @@ +package main + +import "log" +import "time" + +import "git.wit.com/wit/gui" + +var guiDS *gui.GuiDS + +func main() { + guiDS = gui.GetDataStructures() + + guiDS.ButtonClick = buttonClick + + gui.GoMainWindow() + // go gui.GoMainWindow() + + watchGUI() +} + +func buttonClick(i int, s string) { + log.Println("test2 buttonClick() i, s =", i, s) + gui.ShowAccountTab() +} + +func watchGUI() { + log.Println("Sleep(2000)") + time.Sleep(2000 * time.Millisecond) + + for { + log.Println("Sleep()") + time.Sleep(200 * time.Millisecond) + + if (guiDS.State == "splash") { + log.Println("Display the splash box") + guiDS.State = "done" + } + if (guiDS.State == "kill") { + log.Println("gui.State = kill") + log.Println("gui.State = kill") + log.Println("gui.State = kill") + guiDS.State = "account1" + } + if (guiDS.State == "account1") { + log.Println("Display the splash box") + guiDS.State = "done" + } + } +}