io/input: test Router.TextInputHint

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2023-11-27 19:38:48 -06:00
parent f5aa745038
commit 77ff21605c
+18
View File
@@ -14,6 +14,24 @@ import (
"gioui.org/op/clip" "gioui.org/op/clip"
) )
func TestInputHint(t *testing.T) {
r := new(Router)
if hint, changed := r.TextInputHint(); hint != key.HintAny || changed {
t.Fatal("unexpected hint")
}
ops := new(op.Ops)
h := new(int)
key.InputHintOp{Tag: h, Hint: key.HintEmail}.Add(ops)
r.Frame(ops)
if hint, changed := r.TextInputHint(); hint != key.HintAny || changed {
t.Fatal("unexpected hint")
}
r.Source().Execute(key.FocusCmd{Tag: h})
if hint, changed := r.TextInputHint(); hint != key.HintEmail || !changed {
t.Fatal("unexpected hint")
}
}
func TestDeferred(t *testing.T) { func TestDeferred(t *testing.T) {
r := new(Router) r := new(Router)
h := new(int) h := new(int)