Added preferred size tests to zz_test.go; these will help for what we're about to do (implement Control.preferredSize() on all other platforms).

This commit is contained in:
Pietro Gagliardi 2014-07-30 22:42:32 -04:00
parent c5917de29c
commit bdc8aac4d6
1 changed files with 18 additions and 0 deletions

View File

@ -28,6 +28,8 @@ var ddata = []dtype{
type testwin struct { type testwin struct {
t Tab t Tab
w Window w Window
spw *Stack
sph *Stack
s *Stack // TODO make Stack s *Stack // TODO make Stack
l Label l Label
table Table table Table
@ -49,6 +51,22 @@ func (tw *testwin) make(done chan struct{}) {
done <- struct{}{} done <- struct{}{}
return true return true
}) })
tw.spw = NewHorizontalStack(
NewButton("hello"),
NewCheckbox("hello"),
NewTextField(),
NewPasswordField(),
NewTable(reflect.TypeOf(struct{A,B,C int}{})),
NewStandaloneLabel("hello"))
tw.t.Append("Pref Width", tw.spw)
tw.sph = NewVerticalStack(
NewButton("hello"),
NewCheckbox("hello"),
NewTextField(),
NewPasswordField(),
NewTable(reflect.TypeOf(struct{A,B,C int}{})),
NewStandaloneLabel("hello"))
tw.t.Append("Pref Height", tw.sph)
stack1 := NewHorizontalStack(NewLabel("Test"), NewTextField()) stack1 := NewHorizontalStack(NewLabel("Test"), NewTextField())
stack1.SetStretchy(1) stack1.SetStretchy(1)
stack2 := NewHorizontalStack(NewLabel("Test 2"), stack2 := NewHorizontalStack(NewLabel("Test 2"),