Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Lib/idlelib/idle_test/test_codecontext.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def setUpClass(cls):
frame = cls.frame = Frame(root)
text = cls.text = Text(frame)
text.insert('1.0', code_sample)
# Make the text longer than the visible height, so that it can scroll.
text.insert('end', '\n' * (int(text['height']) + 2))
# Need to pack for creation of code context text widget.
frame.pack(side='left', fill='both', expand=1)
text.grid(row=1, column=1, sticky=NSEW)
Expand Down
4 changes: 4 additions & 0 deletions Lib/idlelib/idle_test/test_sidebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ def test_drag_selection_up(self):
self.assertEqual(self.get_selection(), ('2.0', '5.0'))

def test_scroll(self):
# Synchronized scrolling needs the geometry of mapped widgets.
self.root.deiconify()
self.addCleanup(self.root.withdraw)

self.linenumber.show_sidebar()
self.text.insert('1.0', 'line\n' * 100)
self.root.update()
Expand Down
14 changes: 10 additions & 4 deletions Lib/test/test_tkinter/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,10 +774,16 @@ def test_count(self):
self.assertRaises(TclError, text.count, '1.0', 'end', 'spam')
self.assertRaises(TclError, text.count, '1.0', 'end', '-lines')

self.assertIsInstance(text.count('1.3', '1.5', 'ypixels', return_ints=True), int)
self.assertIsInstance(text.count('1.3', '1.5', 'ypixels'), tuple)
self.assertIsInstance(text.count('1.3', '1.5', 'update', 'ypixels', return_ints=True), int)
self.assertIsInstance(text.count('1.3', '1.5', 'update', 'ypixels'), int)
# The ypixels counts depend on the widget geometry.
text.update()

# Indices on the same display line have zero vertical distance.
self.assertEqual(text.count('1.3', '1.5', 'ypixels', return_ints=True), 0)
self.assertIsNone(text.count('1.3', '1.5', 'ypixels'))
self.assertIsInstance(text.count('1.3', '2.5', 'ypixels', return_ints=True), int)
self.assertIsInstance(text.count('1.3', '2.5', 'ypixels'), tuple)
self.assertIsInstance(text.count('1.3', '2.5', 'update', 'ypixels', return_ints=True), int)
self.assertIsInstance(text.count('1.3', '2.5', 'update', 'ypixels'), int)
self.assertEqual(text.count('1.3', '1.3', 'update', 'ypixels', return_ints=True), 0)
self.assertEqual(text.count('1.3', '1.3', 'update', 'ypixels'), None)
self.assertEqual(text.count('1.3', '1.5', 'update', 'indices', return_ints=True), 2)
Expand Down
Loading