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
|
@ -153,6 +153,14 @@ class ConfigDialog(Toplevel):
|
|||
def create_page_font_tab(self):
|
||||
"""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:
|
||||
font_name: Font face.
|
||||
font_size: Font size.
|
||||
|
@ -161,7 +169,7 @@ class ConfigDialog(Toplevel):
|
|||
space_num: Indentation width.
|
||||
|
||||
Data Attribute:
|
||||
edit_font: Font widget with default font name, size, and weight.
|
||||
edit_font: Font with default font name, size, and weight.
|
||||
|
||||
Methods:
|
||||
load_font_cfg: Set vars and fontlist.
|
||||
|
|
|
@ -45,14 +45,17 @@ def tearDownModule():
|
|||
del root
|
||||
|
||||
|
||||
@unittest.skip("skip failing tests until fixed")
|
||||
class FontTabTest(unittest.TestCase):
|
||||
"Test that font widget enable users to make font changes."
|
||||
|
||||
|
||||
def setUp(self):
|
||||
changes.clear()
|
||||
|
||||
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_size = str(default_font[1])
|
||||
default_bold = default_font[2] == 'bold'
|
||||
|
@ -74,22 +77,29 @@ class FontTabTest(unittest.TestCase):
|
|||
'font-bold': str(not default_bold)}}
|
||||
self.assertEqual(mainpage, expected)
|
||||
|
||||
def test_bold_toggle(self):
|
||||
def test_set_samples_bold_toggle(self):
|
||||
# Set up.
|
||||
d = dialog
|
||||
d.set_samples = Func()
|
||||
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_sample, d.highlight_sample = {}, {} # Must undo this.
|
||||
d.font_name.set('test')
|
||||
d.font_size.set('5')
|
||||
d.font_bold.set(1)
|
||||
expected0 = {'font': ('test', '5', 'normal')}
|
||||
expected1 = {'font': ('test', '5', 'bold')}
|
||||
|
||||
# Test set_samples.
|
||||
d.set_samples()
|
||||
expected = {'font': ('test', '5', 'bold')}
|
||||
self.assertTrue(d.font_sample == d.highlight_sample == expected)
|
||||
self.assertTrue(d.font_sample == d.highlight_sample == expected1)
|
||||
|
||||
# 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
|
||||
|
||||
def test_tabspace(self):
|
||||
|
|
Loading…
Reference in New Issue