From 0180cf66845474ec07ff217123f5de1af4923346 Mon Sep 17 00:00:00 2001 From: Terry Jan Reedy Date: Mon, 7 Nov 2016 23:14:53 -0500 Subject: [PATCH] Issue #28572: Use system-specific values for configdialog font test --- Lib/idlelib/config-main.def | 2 ++ Lib/idlelib/idle_test/test_configdialog.py | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Lib/idlelib/config-main.def b/Lib/idlelib/config-main.def index 330c0154a7b..16f4b0959cf 100644 --- a/Lib/idlelib/config-main.def +++ b/Lib/idlelib/config-main.def @@ -60,6 +60,8 @@ delete-exitfunc= 1 width= 80 height= 40 font= TkFixedFont +# For TkFixedFont, the actual size and boldness are obtained from tk +# and override 10 and 0. See idlelib.config.IdleConf.GetFont font-size= 10 font-bold= 0 encoding= none diff --git a/Lib/idlelib/idle_test/test_configdialog.py b/Lib/idlelib/idle_test/test_configdialog.py index 81c57e863e5..3f94493733b 100644 --- a/Lib/idlelib/idle_test/test_configdialog.py +++ b/Lib/idlelib/idle_test/test_configdialog.py @@ -54,25 +54,29 @@ class FontTabTest(unittest.TestCase): changes.clear() def test_font(self): + # Set values guaranteed not to be defaults. + dfont = idleConf.GetFont(root, 'main', 'EditorWindow') + dsize = str(dfont[1]) + dbold = dfont[2] == 'bold' configure.fontName.set('Test Font') expected = [ ('main', 'EditorWindow', 'font', 'Test Font'), - ('main', 'EditorWindow', 'font-size', '10'), - ('main', 'EditorWindow', 'font-bold', False)] + ('main', 'EditorWindow', 'font-size', dsize), + ('main', 'EditorWindow', 'font-bold', dbold)] self.assertEqual(changes, expected) changes.clear() - configure.fontSize.set(12) + configure.fontSize.set(20) expected = [ ('main', 'EditorWindow', 'font', 'Test Font'), - ('main', 'EditorWindow', 'font-size', '12'), - ('main', 'EditorWindow', 'font-bold', False)] + ('main', 'EditorWindow', 'font-size', '20'), + ('main', 'EditorWindow', 'font-bold', dbold)] self.assertEqual(changes, expected) changes.clear() - configure.fontBold.set(True) + configure.fontBold.set(not dbold) expected = [ ('main', 'EditorWindow', 'font', 'Test Font'), - ('main', 'EditorWindow', 'font-size', '12'), - ('main', 'EditorWindow', 'font-bold', True)] + ('main', 'EditorWindow', 'font-size', '20'), + ('main', 'EditorWindow', 'font-bold', not dbold)] self.assertEqual(changes, expected) #def test_sample(self): pass # TODO