Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-35730: IDLE - test squeezer reload() by checking load_font() #11585

Merged
Merged
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
10 changes: 3 additions & 7 deletions Lib/idlelib/idle_test/test_squeezer.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,25 +293,21 @@ def test_squeeze_text_before_existing_squeezed_text(self):
def test_reload(self):
"""Test the reload() class-method."""
editwin = self.make_mock_editor_window(with_text_widget=True)
text_widget = editwin.text
squeezer = self.make_squeezer_instance(editwin)
squeezer.load_font = Mock()

orig_zero_char_width = squeezer.zero_char_width
orig_auto_squeeze_min_lines = squeezer.auto_squeeze_min_lines

# Increase both font size and auto-squeeze-min-lines.
text_widget["font"] = ('Courier', 20)
# Increase auto-squeeze-min-lines.
new_auto_squeeze_min_lines = orig_auto_squeeze_min_lines + 10
self.set_idleconf_option_with_cleanup(
'main', 'PyShell', 'auto-squeeze-min-lines',
str(new_auto_squeeze_min_lines))

Squeezer.reload()
# The following failed on Gentoo buildbots. Issue title will be
# IDLE: Fix squeezer test_reload.
#self.assertGreater(squeezer.zero_char_width, orig_zero_char_width)
self.assertEqual(squeezer.auto_squeeze_min_lines,
new_auto_squeeze_min_lines)
squeezer.load_font.assert_called()

def test_reload_no_squeezer_instances(self):
"""Test that Squeezer.reload() runs without any instances existing."""
Expand Down