Test the context menu.
(self)
| 446 | self.assertEqual(mock_view_text.call_args[0][2], 'TEXT') |
| 447 | |
| 448 | def test_rmenu(self): |
| 449 | """Test the context menu.""" |
| 450 | squeezer = self.make_mock_squeezer() |
| 451 | expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer) |
| 452 | with patch('tkinter.Menu') as mock_Menu: |
| 453 | mock_menu = Mock() |
| 454 | mock_Menu.return_value = mock_menu |
| 455 | mock_event = Mock() |
| 456 | mock_event.x = 10 |
| 457 | mock_event.y = 10 |
| 458 | expandingbutton.context_menu_event(event=mock_event) |
| 459 | self.assertEqual(mock_menu.add_command.call_count, |
| 460 | len(expandingbutton.rmenu_specs)) |
| 461 | for label, *data in expandingbutton.rmenu_specs: |
| 462 | mock_menu.add_command.assert_any_call(label=label, command=ANY) |
| 463 | |
| 464 | |
| 465 | if __name__ == '__main__': |
nothing calls this directly
no test coverage detected