2015-12-11 21:58:21 -06:00
|
|
|
// 11 december 2015
|
|
|
|
|
|
|
|
package ui
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestIt(t *testing.T) {
|
|
|
|
err := Main(func() {
|
2015-12-12 12:37:36 -06:00
|
|
|
w := NewWindow("Hello", 320, 240, false)
|
|
|
|
w.OnClosing(func(w *Window) bool {
|
|
|
|
Quit()
|
|
|
|
return true
|
|
|
|
})
|
2015-12-12 19:15:14 -06:00
|
|
|
b := NewVerticalBox()
|
|
|
|
w.SetChild(b)
|
2015-12-12 17:48:43 -06:00
|
|
|
w.SetMargined(true)
|
2015-12-12 19:15:14 -06:00
|
|
|
button := NewButton("Click Me")
|
|
|
|
button.OnClicked(func(*Button) {
|
|
|
|
b.SetPadded(!b.Padded())
|
|
|
|
})
|
|
|
|
b.Append(button, true)
|
|
|
|
b.Append(NewButton("Button 2"), false)
|
|
|
|
b.Append(NewButton("Button 3"), true)
|
2015-12-12 12:37:36 -06:00
|
|
|
w.Show()
|
2015-12-11 21:58:21 -06:00
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|