Files
gio/layout/stack_test.go
T
Elias Naur 289fe02b90 layout: replace NewContext with a Queue argument to Context.Reset
We're about to reduce the scope of the Window.Queue by moving it
to FrameEvent. As a consequence, Context can no longer rely on a
Queue constant over its lifetime.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-03 21:03:40 +02:00

28 lines
584 B
Go

// SPDX-License-Identifier: Unlicense OR MIT
package layout
import (
"image"
"testing"
)
func TestStack(t *testing.T) {
var gtx Context
gtx.Reset(nil, nil, image.Point{X: 100, Y: 100})
gtx.Constraints.Width.Min = 0
gtx.Constraints.Height.Min = 0
exp := image.Point{X: 60, Y: 70}
Stack{Alignment: Center}.Layout(&gtx,
Expanded(func() {
gtx.Dimensions.Size = exp
}),
Stacked(func() {
gtx.Dimensions.Size = image.Point{X: 50, Y: 50}
}),
)
if got := gtx.Dimensions.Size; got != exp {
t.Errorf("Stack ignored Expanded size, got %v expected %v", got, exp)
}
}