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:
Terry Jan Reedy 2017-07-22 00:36:13 -04:00 committed by GitHub
parent ff92ff5366
commit 616ecf18f3
2 changed files with 32 additions and 14 deletions

View file

@ -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):