Skip to content

Commit

Permalink
Add a simple test to verify that we don't deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jan 6, 2024
1 parent e48c2f6 commit f395807
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions widget/entry_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,21 @@ func TestEntry_EraseSelection(t *testing.T) {
assert.Equal(t, -1, b)
}

func TestEntry_CallbackLocking(t *testing.T) {
e := &Entry{}
called := 0
e.OnChanged = func(_ string) {
e.propertyLock.Lock()
called++ // Just to not have an empty critical section.
e.propertyLock.Unlock()
}

test.Type(e, "abc123")
e.selectAll()
e.TypedKey(&fyne.KeyEvent{Name: fyne.KeyBackspace})
assert.Equal(t, 7, called)
}

func TestEntry_MouseClickAndDragOutsideText(t *testing.T) {
entry := NewEntry()
entry.SetText("A\nB\n")
Expand Down

0 comments on commit f395807

Please sign in to comment.