Skip to content

Commit

Permalink
Fix copy/paste test
Browse files Browse the repository at this point in the history
  • Loading branch information
ppizarror committed Oct 21, 2024
1 parent a393000 commit b66b112
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions pygame_menu/widgets/widget/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,6 +1295,7 @@ def _copy(self) -> bool:
except PyperclipException as e:
if self._verbose:
clipboard_warn(e, 'Copying')
return False

self._block_copy_paste = True
return True
Expand Down
4 changes: 2 additions & 2 deletions test/test_widget_textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,8 @@ def test_copy_paste(self) -> None:
textinput_copy.set_value('this value should be cropped as this is longer than the max char')
self.assertFalse(textinput_copy._block_copy_paste)
textinput_copy._copy()
self.assertTrue(textinput_copy._block_copy_paste)
textinput_copy._block_copy_paste = False
if textinput_copy._block_copy_paste: # Otherwise, an exception happened
textinput_copy._block_copy_paste = False
textinput_copy._select_all()
textinput_copy._cut()
self.assertEqual(textinput_copy.get_value(), '')
Expand Down

0 comments on commit b66b112

Please sign in to comment.