summaryrefslogtreecommitdiff
path: root/zz_test.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2015-12-12 18:44:35 -0500
committerPietro Gagliardi <[email protected]>2015-12-12 18:44:35 -0500
commitae710db0e9ed08ff7ae1c90d440af3ee3efe721f (patch)
tree2d0cddbe840e3fee1a34db8e07cc6fa50ea75f7f /zz_test.go
parent7b5f1e13c36248fc91de07d409318bce887f3b94 (diff)
Added ProgressBar.
Diffstat (limited to 'zz_test.go')
-rw-r--r--zz_test.go25
1 files changed, 23 insertions, 2 deletions
diff --git a/zz_test.go b/zz_test.go
index 0b24300..657f5dc 100644
--- a/zz_test.go
+++ b/zz_test.go
@@ -2,17 +2,38 @@
package ui
+import "time"
import "testing"
func TestIt(t *testing.T) {
err := Main(func() {
w := NewWindow("Hello", 320, 240, false)
+ stop := make(chan struct{})
w.OnClosing(func(w *Window) bool {
+ stop <- struct{}{}
Quit()
return true
})
- l := NewLabel("A Label")
- w.SetChild(l)
+ p := NewProgressBar()
+ w.SetChild(p)
+ go func() {
+ value := 0
+ ticker := time.NewTicker(time.Second / 2)
+ for {
+ select {
+ case <-ticker.C:
+ QueueMain(func() {
+ value++
+ if value > 100 {
+ value = 0
+ }
+ p.SetValue(value)
+ })
+ case <-stop:
+ return
+ }
+ }
+ }()
w.Show()
})
if err != nil {