Test the simplest creation of an ExpandingButton.
(self, MockHovertip)
| 319 | |
| 320 | @patch('idlelib.squeezer.Hovertip', autospec=Hovertip) |
| 321 | def test_init(self, MockHovertip): |
| 322 | """Test the simplest creation of an ExpandingButton.""" |
| 323 | squeezer = self.make_mock_squeezer() |
| 324 | text_widget = squeezer.editwin.text |
| 325 | |
| 326 | expandingbutton = ExpandingButton('TEXT', 'TAGS', 50, squeezer) |
| 327 | self.assertEqual(expandingbutton.s, 'TEXT') |
| 328 | |
| 329 | # Check that the underlying tkinter.Button is properly configured. |
| 330 | self.assertEqual(expandingbutton.master, text_widget) |
| 331 | self.assertTrue('50 lines' in expandingbutton.cget('text')) |
| 332 | |
| 333 | # Check that the text widget still contains no text. |
| 334 | self.assertEqual(text_widget.get('1.0', 'end'), '\n') |
| 335 | |
| 336 | # Check that the mouse events are bound. |
| 337 | self.assertIn('<Double-Button-1>', expandingbutton.bind()) |
| 338 | right_button_code = '<Button-%s>' % ('2' if macosx.isAquaTk() else '3') |
| 339 | self.assertIn(right_button_code, expandingbutton.bind()) |
| 340 | |
| 341 | # Check that ToolTip was called once, with appropriate values. |
| 342 | self.assertEqual(MockHovertip.call_count, 1) |
| 343 | MockHovertip.assert_called_with(expandingbutton, ANY, hover_delay=ANY) |
| 344 | |
| 345 | # Check that 'right-click' appears in the tooltip text. |
| 346 | tooltip_text = MockHovertip.call_args[0][1] |
| 347 | self.assertIn('right-click', tooltip_text.lower()) |
| 348 | |
| 349 | def test_expand(self): |
| 350 | """Test the expand event.""" |
nothing calls this directly
no test coverage detected