Skip to content

Commit

Permalink
Ensure segments are up to date on first draw
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Nov 17, 2023
1 parent 31ef3ed commit 802f92b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions widget/entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ func (e *Entry) CreateRenderer() fyne.WidgetRenderer {
objects = append(objects, e.ActionItem)
}

e.syncSegments()
return &entryRenderer{box, border, e.scroll, objects, e}
}

Expand Down
25 changes: 25 additions & 0 deletions widget/entry_password_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package widget_test

import (
"testing"

"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/test"
"fyne.io/fyne/v2/widget"
"github.com/stretchr/testify/assert"
)

func TestNewPasswordEntry(t *testing.T) {
p := widget.NewPasswordEntry()
p.Text = "visible"
r := test.WidgetRenderer(p)

cont := r.Objects()[2].(*container.Scroll).Content.(fyne.Widget)
r = test.WidgetRenderer(cont)
rich := r.Objects()[1].(*widget.RichText)
r = test.WidgetRenderer(rich)

assert.Equal(t, "•••••••", r.Objects()[0].(*canvas.Text).Text)
}

0 comments on commit 802f92b

Please sign in to comment.