mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 08:55:35 +00:00
widget: [API] re-implement Editor.Focus in terms of commands
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -115,7 +115,7 @@ func TestEditorReadOnly(t *testing.T) {
|
||||
if cStart != cEnd {
|
||||
t.Errorf("unexpected initial caret positions")
|
||||
}
|
||||
e.Focus()
|
||||
e.Focus(gtx)
|
||||
layoutEditor := func() layout.Dimensions {
|
||||
return e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
||||
}
|
||||
@@ -511,7 +511,7 @@ func TestEditorDimensions(t *testing.T) {
|
||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||
fontSize := unit.Sp(10)
|
||||
font := font.Font{}
|
||||
e.Focus()
|
||||
e.Focus(gtx)
|
||||
e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
||||
r.Frame(gtx.Ops)
|
||||
r.Queue(key.EditEvent{Text: "A"})
|
||||
@@ -904,7 +904,7 @@ g 2 4 6 8 g
|
||||
e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
||||
e.Events() // throw away any events from this layout
|
||||
|
||||
e.Focus()
|
||||
e.Focus(gtx)
|
||||
r.Frame(gtx.Ops)
|
||||
gtx.Source = r.Source()
|
||||
// Build the selection events
|
||||
@@ -998,7 +998,7 @@ func TestSelectMove(t *testing.T) {
|
||||
fontSize := unit.Sp(10)
|
||||
|
||||
// Layout once to populate e.lines and get focus.
|
||||
e.Focus()
|
||||
e.Focus(gtx)
|
||||
e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
||||
r.Frame(gtx.Ops)
|
||||
// Set up selecton so the Editor key handler filters for all 4 directional keys.
|
||||
@@ -1085,7 +1085,7 @@ func TestEditor_MaxLen(t *testing.T) {
|
||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||
fontSize := unit.Sp(10)
|
||||
font := font.Font{}
|
||||
e.Focus()
|
||||
e.Focus(gtx)
|
||||
e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
||||
r.Frame(gtx.Ops)
|
||||
r.Queue(
|
||||
@@ -1121,7 +1121,7 @@ func TestEditor_Filter(t *testing.T) {
|
||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||
fontSize := unit.Sp(10)
|
||||
font := font.Font{}
|
||||
e.Focus()
|
||||
e.Focus(gtx)
|
||||
e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
||||
r.Frame(gtx.Ops)
|
||||
r.Queue(
|
||||
@@ -1151,7 +1151,7 @@ func TestEditor_Submit(t *testing.T) {
|
||||
cache := text.NewShaper(text.NoSystemFonts(), text.WithCollection(gofont.Collection()))
|
||||
fontSize := unit.Sp(10)
|
||||
font := font.Font{}
|
||||
e.Focus()
|
||||
e.Focus(gtx)
|
||||
e.Layout(gtx, cache, font, fontSize, op.CallOp{}, op.CallOp{})
|
||||
r.Frame(gtx.Ops)
|
||||
r.Queue(
|
||||
|
||||
Reference in New Issue
Block a user