summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2017-07-22 04:36:13 (GMT)
committerGitHub <noreply@github.com>2017-07-22 04:36:13 (GMT)
commit616ecf18f3aacbd8d172e01673877b22fe946e54 (patch)
tree13d4435f21a2ae954bdaa859d354a37399e81c9e
parentff92ff53665b1606a17231972b48ad894459f761 (diff)
downloadcpython-616ecf18f3aacbd8d172e01673877b22fe946e54.zip
cpython-616ecf18f3aacbd8d172e01673877b22fe946e54.tar.gz
cpython-616ecf18f3aacbd8d172e01673877b22fe946e54.tar.bz2
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.
-rw-r--r--Lib/idlelib/configdialog.py10
-rw-r--r--Lib/idlelib/idle_test/test_configdialog.py36
2 files changed, 32 insertions, 14 deletions
diff --git a/Lib/idlelib/configdialog.py b/Lib/idlelib/configdialog.py
index 59822fc..c1db768 100644
--- a/Lib/idlelib/configdialog.py
+++ b/Lib/idlelib/configdialog.py
@@ -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.
diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py
index d3002a9..171fa3d 100644
--- a/Lib/idlelib/idle_test/test_configdialog.py
+++ b/Lib/idlelib/idle_test/test_configdialog.py
@@ -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):
- 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):
+ def test_set_samples_bold_toggle(self):
+ # Set up.
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):