mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
4484674ab1
The race runtime allocates where the non-race runtime doesn't. Signed-off-by: Elias Naur <mail@eliasnaur.com>
32 lines
619 B
Go
32 lines
619 B
Go
// SPDX-License-Identifier: Unlicense OR MIT
|
|
|
|
package layout
|
|
|
|
import (
|
|
"image"
|
|
"testing"
|
|
|
|
"gioui.org/op"
|
|
)
|
|
|
|
func TestStack(t *testing.T) {
|
|
gtx := Context{
|
|
Ops: new(op.Ops),
|
|
Constraints: Constraints{
|
|
Max: image.Pt(100, 100),
|
|
},
|
|
}
|
|
exp := image.Point{X: 60, Y: 70}
|
|
dims := Stack{Alignment: Center}.Layout(gtx,
|
|
Expanded(func(gtx Context) Dimensions {
|
|
return Dimensions{Size: exp}
|
|
}),
|
|
Stacked(func(gtx Context) Dimensions {
|
|
return Dimensions{Size: image.Point{X: 50, Y: 50}}
|
|
}),
|
|
)
|
|
if got := dims.Size; got != exp {
|
|
t.Errorf("Stack ignored Expanded size, got %v expected %v", got, exp)
|
|
}
|
|
}
|