mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
bpo-30981: IDLE: Augment one configdialog font page test (#2810)
Remove broken test of bold_toggle and test it along with its command, set_samples. This has been incorporated into 3.6 backport PR-2796.
This commit is contained in:
parent
ff92ff5366
commit
616ecf18f3
2 changed files with 32 additions and 14 deletions
|
@ -153,6 +153,14 @@ class ConfigDialog(Toplevel):
|
||||||
def create_page_font_tab(self):
|
def create_page_font_tab(self):
|
||||||
"""Return frame of widgets for Font/Tabs tab.
|
"""Return frame of widgets for Font/Tabs tab.
|
||||||
|
|
||||||
|
Enable users to provisionally change font face, size, or
|
||||||
|
boldness and to see the consequence of proposed choices. Each
|
||||||
|
action set 3 options in changes structuree and changes the
|
||||||
|
corresponding aspect of the font sample on this page and
|
||||||
|
highlight sample on highlight page.
|
||||||
|
|
||||||
|
Enable users to change spaces entered for indent tabs.
|
||||||
|
|
||||||
Tk Variables:
|
Tk Variables:
|
||||||
font_name: Font face.
|
font_name: Font face.
|
||||||
font_size: Font size.
|
font_size: Font size.
|
||||||
|
@ -161,7 +169,7 @@ class ConfigDialog(Toplevel):
|
||||||
space_num: Indentation width.
|
space_num: Indentation width.
|
||||||
|
|
||||||
Data Attribute:
|
Data Attribute:
|
||||||
edit_font: Font widget with default font name, size, and weight.
|
edit_font: Font with default font name, size, and weight.
|
||||||
|
|
||||||
Methods:
|
Methods:
|
||||||
load_font_cfg: Set vars and fontlist.
|
load_font_cfg: Set vars and fontlist.
|
||||||
|
|
|
@ -45,14 +45,17 @@ def tearDownModule():
|
||||||
del root
|
del root
|
||||||
|
|
||||||
|
|
||||||
@unittest.skip("skip failing tests until fixed")
|
|
||||||
class FontTabTest(unittest.TestCase):
|
class FontTabTest(unittest.TestCase):
|
||||||
|
"Test that font widget enable users to make font changes."
|
||||||
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
changes.clear()
|
changes.clear()
|
||||||
|
|
||||||
def test_font_set(self):
|
def test_font_set(self):
|
||||||
# Set values guaranteed not to be defaults.
|
# Test that setting a font Variable results in 3 provisional
|
||||||
|
# change entries. Use values sure to not be defaults.
|
||||||
|
# Other font tests verify that user actions set Variables.
|
||||||
default_font = idleConf.GetFont(root, 'main', 'EditorWindow')
|
default_font = idleConf.GetFont(root, 'main', 'EditorWindow')
|
||||||
default_size = str(default_font[1])
|
default_size = str(default_font[1])
|
||||||
default_bold = default_font[2] == 'bold'
|
default_bold = default_font[2] == 'bold'
|
||||||
|
@ -74,22 +77,29 @@ class FontTabTest(unittest.TestCase):
|
||||||
'font-bold': str(not default_bold)}}
|
'font-bold': str(not default_bold)}}
|
||||||
self.assertEqual(mainpage, expected)
|
self.assertEqual(mainpage, expected)
|
||||||
|
|
||||||
def test_bold_toggle(self):
|
def test_set_samples_bold_toggle(self):
|
||||||
|
# Set up.
|
||||||
d = dialog
|
d = dialog
|
||||||
d.set_samples = Func()
|
d.font_sample, d.highlight_sample = {}, {} # Must undo this.
|
||||||
d.bold_toggle.toggle()
|
|
||||||
self.assertEqual(d.set_samples.called, 1)
|
|
||||||
del d.set_samples
|
|
||||||
|
|
||||||
def test_set_samples(self):
|
|
||||||
d = dialog
|
|
||||||
d.font_sample, d.highlight_sample = {}, {}
|
|
||||||
d.font_name.set('test')
|
d.font_name.set('test')
|
||||||
d.font_size.set('5')
|
d.font_size.set('5')
|
||||||
d.font_bold.set(1)
|
d.font_bold.set(1)
|
||||||
|
expected0 = {'font': ('test', '5', 'normal')}
|
||||||
|
expected1 = {'font': ('test', '5', 'bold')}
|
||||||
|
|
||||||
|
# Test set_samples.
|
||||||
d.set_samples()
|
d.set_samples()
|
||||||
expected = {'font': ('test', '5', 'bold')}
|
self.assertTrue(d.font_sample == d.highlight_sample == expected1)
|
||||||
self.assertTrue(d.font_sample == d.highlight_sample == expected)
|
|
||||||
|
# Test bold_toggle.
|
||||||
|
d.bold_toggle.invoke()
|
||||||
|
self.assertFalse(d.font_bold.get())
|
||||||
|
self.assertTrue(d.font_sample == d.highlight_sample == expected0)
|
||||||
|
d.bold_toggle.invoke()
|
||||||
|
self.assertTrue(d.font_bold.get())
|
||||||
|
self.assertTrue(d.font_sample == d.highlight_sample == expected1)
|
||||||
|
|
||||||
|
# Clean up.
|
||||||
del d.font_sample, d.highlight_sample
|
del d.font_sample, d.highlight_sample
|
||||||
|
|
||||||
def test_tabspace(self):
|
def test_tabspace(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue