mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
layout: fix dimensions of empty list
When the Min constraints are set but the list has no item to display, use those as the list returned dimensions. Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
This commit is contained in:
@@ -13,6 +13,18 @@ import (
|
||||
"gioui.org/op"
|
||||
)
|
||||
|
||||
func TestEmptyList(t *testing.T) {
|
||||
var l List
|
||||
gtx := Context{
|
||||
Ops: new(op.Ops),
|
||||
Constraints: Exact(image.Pt(20, 10)),
|
||||
}
|
||||
dims := l.Layout(gtx, 0, nil)
|
||||
if got, want := dims.Size, gtx.Constraints.Min; got != want {
|
||||
t.Errorf("got %v; want %v", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestListPosition(t *testing.T) {
|
||||
_s := func(e ...event.Event) []event.Event { return e }
|
||||
r := new(router.Router)
|
||||
|
||||
Reference in New Issue
Block a user