io/router: don't panic if AppendSemantics is called without a frame

Fixes: https://todo.sr.ht/~eliasnaur/gio/328
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-12-30 10:23:23 +01:00
parent 6913c856a2
commit cce0a121e1
3 changed files with 22 additions and 5 deletions
+8
View File
@@ -15,6 +15,14 @@ import (
"gioui.org/op/clip"
)
func TestEmptySemantics(t *testing.T) {
var r Router
tree := r.AppendSemantics(nil)
if len(tree) != 1 {
t.Errorf("expected 1 semantic node for empty tree, got %d", len(tree))
}
}
func TestSemanticTree(t *testing.T) {
var (
ops op.Ops