diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/kbtest.go | 6 | ||||
| -rw-r--r-- | test/main.go | 49 | ||||
| -rw-r--r-- | test/spacing.go | 4 |
3 files changed, 11 insertions, 48 deletions
diff --git a/test/kbtest.go b/test/kbtest.go index 9945772..d8bcb3b 100644 --- a/test/kbtest.go +++ b/test/kbtest.go @@ -73,15 +73,11 @@ func (a *keyboardArea) Key(e KeyEvent) (repaint bool) { return true } -type kbhandler struct{} -func (kbhandler) Event(e Event, d interface{}) { -} - var doKeyboard = flag.Bool("kb", false, "run keyboard test (overrides -areabounds)") func kbTest() { wid, ht, ah := mkkbArea() a := NewArea(wid, ht, ah) - w := NewWindow("Hi", wid, ht, kbhandler{}) + w := NewWindow("Hi", wid, ht) w.Closing = func() bool { return true } w.Open(a) } diff --git a/test/main.go b/test/main.go index c241eb2..3787d0c 100644 --- a/test/main.go +++ b/test/main.go @@ -15,9 +15,6 @@ import ( . "github.com/andlabs/ui" ) -type nullwinhandler struct{} -func (nullwinhandler) Event(Event, interface{}) {} - func die() bool { // TODO we want the bool return to happen before the Stop... Stop <- struct{}{} @@ -28,14 +25,14 @@ var prefsizetest = flag.Bool("prefsize", false, "") func listboxPreferredSizeTest() *Window { lb := NewListbox("xxxxx", "y", "zzz") g := NewGrid(1, lb) - w := NewWindow("Listbox Preferred Size Test", 300, 300, nullwinhandler{}) + w := NewWindow("Listbox Preferred Size Test", 300, 300) w.Open(g) return w } var gridtest = flag.Bool("grid", false, "") func gridWindow() *Window { - w := NewWindow("Grid Test", 400, 400, nullwinhandler{}) + w := NewWindow("Grid Test", 400, 400) b00 := NewButton("0,0") b01 := NewButton("0,1") b02 := NewButton("0,2") @@ -250,16 +247,7 @@ func areaTest() { timedisp, sizeStack) layout.SetStretchy(0) - w := NewWindow("Area Test", 100, 100, &areatestwinhandler{ - areahandler: areahandler, - a: a, - timedisp: timedisp, - widthbox: widthbox, - heightbox: heightbox, - resize: resize, - modaltest: modaltest, - repainttest: repainttest, - }) + w := NewWindow("Area Test", 100, 100) w.Closing = die w.Open(layout) go func() { @@ -271,19 +259,6 @@ func areaTest() { }() } -type areatestwinhandler struct { - areahandler *areaHandler - a *Area - timedisp *Label - widthbox *LineEdit - heightbox *LineEdit - resize *Button - modaltest *Button - repainttest *Button -} -func (a *areatestwinhandler) Event(e Event, d interface{}) { -} - var areabounds = flag.Bool("areabounds", false, "run area bounds test instead") func areaboundsTest() { img := image.NewRGBA(image.Rect(0, 0, 320, 240)) @@ -308,9 +283,7 @@ func areaboundsTest() { // middle purple r.Min.Y++ draw.Draw(img, r, u(128, 0, 128), image.ZP, draw.Over) - w := NewWindow("Area Bounds Test", 320, 240, &areatestwinhandler{ - a: a, - }) + w := NewWindow("Area Bounds Test", 320, 240) w.Closing = die w.Open(a) } @@ -367,7 +340,7 @@ type testwinhandler struct { func runMainTest() { handler := new(testwinhandler) - handler.w = NewWindow("Main Window", 320, 240, handler) + handler.w = NewWindow("Main Window", 320, 240) handler.w.Closing = func() bool { println("window closed event received") return die() @@ -441,7 +414,7 @@ func runMainTest() { bCenter: centerButton, // send: w.Send, } - dh.w = NewWindow("Dialogs", 200, 200, dh) + dh.w = NewWindow("Dialogs", 200, 200) dh.setUpEvents() if *dialogTest { s := NewVerticalStack( @@ -482,13 +455,10 @@ func runMainTest() { NewButton("Button"), s) s.SetStretchy(4) - NewWindow("Label Align Test", 500, 300, nullwinhandler{}).Open(s) + NewWindow("Label Align Test", 500, 300).Open(s) } } -// TODO -func (handler *testwinhandler) Event(Event,interface{}){} - func (handler *testwinhandler) setUpEvents() { handler.b.Clicked = func() { handler.w.SetTitle(fmt.Sprintf("%v | %s | %s | %s | %s", @@ -563,12 +533,9 @@ type dialoghandler struct { bMsgBoxError *Button w *Window bCenter *Button - send func(Event, interface{}) +// send func(Event, interface{}) } -// == TODO == -func (handler *dialoghandler) Event(e Event, d interface{}) {} - func (handler *dialoghandler) setUpEvents() { handler.bMsgBox.Clicked = func() { // handler.send(CustomEvent, "DIALOG") diff --git a/test/spacing.go b/test/spacing.go index 610115f..c96340f 100644 --- a/test/spacing.go +++ b/test/spacing.go @@ -41,10 +41,10 @@ func spaceTest() { a2 := NewArea(w, h, ah) a3 := NewArea(w, h, ah) a4 := NewArea(w, h, ah) - win := NewWindow("Stack", 250, 250, nullwinhandler{}) + win := NewWindow("Stack", 250, 250) win.SetSpaced(true) win.Open(f(a1, a2)) - win = NewWindow("Grid", 250, 250, nullwinhandler{}) + win = NewWindow("Grid", 250, 250) win.SetSpaced(true) g := NewGrid(ng, a3, a4) g.SetFilling(0, 0) |
