]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39388: IDLE: Fix bug when cancelling out of configdialog (GH-18068)
authorCheryl Sabella <cheryl.sabella@gmail.com>
Sat, 25 Jan 2020 09:00:54 +0000 (04:00 -0500)
committerTerry Jan Reedy <tjreedy@udel.edu>
Sat, 25 Jan 2020 09:00:54 +0000 (04:00 -0500)
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
Lib/idlelib/NEWS.txt
Lib/idlelib/configdialog.py
Lib/idlelib/idle_test/test_configdialog.py
Misc/NEWS.d/next/IDLE/2020-01-25-02-26-45.bpo-39388.x4TQNh.rst [new file with mode: 0644]

index 708292ebee9f1c6f5372b29851014ff0bca7e1ce..eda7c2788764d35128f4a9efa0f61f65fc820b96 100644 (file)
@@ -3,7 +3,9 @@ Released on 2020-10-05?
 ======================================
 
 
-bpo-39050: Make Settings dialog Help button work again.
+bpo-39388: Settings dialog Cancel button cancels pending changes.
+
+bpo-39050: Settings dialog Help button again displays help text.
 
 bpo-32989: Add tests for editor newline_and_indent_event method.
 Remove unneeded arguments and dead code from pyparse
index 0e007b516ea5e14086766352636f58a12f4fffdc..2f95c9ccaa0c57c39e41d2db9729909c322e5a0e 100644 (file)
@@ -191,6 +191,7 @@ class ConfigDialog(Toplevel):
         Methods:
             destroy: inherited
         """
+        changes.clear()
         self.destroy()
 
     def destroy(self):
index 7c575d0e5992c2c93e4673db99a61d2a9d17152b..817a35217bf3cdee725eec10cf2c492a6c0e4369 100644 (file)
@@ -47,17 +47,24 @@ def tearDownModule():
     root.destroy()
     root = dialog = None
 
-class ConfigDialogTest(unittest.TestCase):
 
-    def test_help(self):
+class DialogTest(unittest.TestCase):
+
+    @mock.patch(__name__+'.dialog.destroy', new_callable=Func)
+    def test_cancel(self, destroy):
+        changes['main']['something'] = 1
+        dialog.cancel()
+        self.assertEqual(changes['main'], {})
+        self.assertEqual(destroy.called, 1)
+
+    @mock.patch('idlelib.configdialog.view_text', new_callable=Func)
+    def test_help(self, view):
         dialog.note.select(dialog.keyspage)
-        saved = configdialog.view_text
-        view = configdialog.view_text = Func()
         dialog.help()
         s = view.kwds['contents']
-        self.assertTrue(s.startswith('When you click'))
-        self.assertTrue(s.endswith('a different name.\n'))
-        configdialog.view_text = saved
+        self.assertTrue(s.startswith('When you click') and
+                        s.endswith('a different name.\n'))
+
 
 class FontPageTest(unittest.TestCase):
     """Test that font widgets enable users to make font changes.
diff --git a/Misc/NEWS.d/next/IDLE/2020-01-25-02-26-45.bpo-39388.x4TQNh.rst b/Misc/NEWS.d/next/IDLE/2020-01-25-02-26-45.bpo-39388.x4TQNh.rst
new file mode 100644 (file)
index 0000000..42bbfb1
--- /dev/null
@@ -0,0 +1 @@
+IDLE Settings Cancel button now cancels pending changes