diff options
| author | Pietro Gagliardi <[email protected]> | 2014-08-20 01:35:05 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-08-20 01:35:05 -0400 |
| commit | ac1b8e3cca971c38c8091f60fedfe093e6fe78df (patch) | |
| tree | 746ec1b161084b775b7e1260335f02eae9731210 /redo/zz_test.go | |
| parent | 5f830deec8374336d1d268a27e41f5ec492c866c (diff) | |
Added a test for TextField.Invalid() and implemented it on the GTK+ backend.
Diffstat (limited to 'redo/zz_test.go')
| -rw-r--r-- | redo/zz_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/redo/zz_test.go b/redo/zz_test.go index 2477de0..e1eb8fc 100644 --- a/redo/zz_test.go +++ b/redo/zz_test.go @@ -13,6 +13,7 @@ import ( "image/color" "image/draw" "time" + "strings" ) var closeOnClick = flag.Bool("close", false, "close on click") @@ -38,6 +39,7 @@ type testwin struct { festart Button felabel Label festop Button + vedit TextField openbtn Button fnlabel Label icons []icon @@ -91,6 +93,14 @@ func (tw *testwin) addfe() { tw.fe = nil } }) + tw.vedit = NewTextField() + tw.vedit.OnChanged(func() { + if strings.Contains(tw.vedit.Text(), "bad") { + tw.vedit.Invalid("bad entered") + } else { + tw.vedit.Invalid("") + } + }) tw.openbtn = NewButton("Open") tw.openbtn.OnClicked(func() { fn := OpenFile() @@ -102,8 +112,11 @@ func (tw *testwin) addfe() { tw.fnlabel = NewStandaloneLabel("<no file selected>") tw.festack = NewVerticalStack(tw.festart, tw.felabel, tw.festop, Space(), + tw.vedit, + Space(), tw.openbtn, tw.fnlabel) tw.festack.SetStretchy(3) + tw.festack.SetStretchy(5) tw.t.Append("Foreign Events", tw.festack) } |
