Skip to content

Commit

Permalink
Add testing code for backspace + ctrl in entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jul 22, 2023
1 parent a3b5349 commit 161cdd6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions widget/entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,21 @@ func TestEntry_Control_Word(t *testing.T) {
// unselect when no shift press
entry.TypedShortcut(nextWord)
assert.Equal(t, "", entry.SelectedText())

// delete word when pressing backspace
deleteWord := &desktop.CustomShortcut{KeyName: fyne.KeyBackspace, Modifier: fyne.KeyModifierShortcutDefault}
entry.SetText("word1 word2 word3")
entry.TypedShortcut(deleteWord)
assert.Equal(t, "word1 word2 ", entry.Text)
entry.TypedShortcut(deleteWord)
assert.Equal(t, "word1 ", entry.Text)
entry.TypedShortcut(deleteWord)
assert.Equal(t, "", entry.Text)

// Deleting with nothing to delete does nothing
entry.TypedShortcut(deleteWord)
assert.Equal(t, "", entry.Text)

}

func TestEntry_CursorColumn_Wrap(t *testing.T) {
Expand Down

0 comments on commit 161cdd6

Please sign in to comment.