summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/idle_test
diff options
context:
space:
mode:
authorTal Einat <taleinat@gmail.com>2019-07-18 20:03:18 (GMT)
committerTerry Jan Reedy <tjreedy@udel.edu>2019-07-18 20:03:18 (GMT)
commite0a1f8fb5c60886dbddf1a3ccb5d47576bdd43e2 (patch)
tree6c5572560cdc1c0c9941edf11f08886a4d05243b /Lib/idlelib/idle_test
parent323842c2792a81e87917790506ec3457832c84b3 (diff)
downloadcpython-e0a1f8fb5c60886dbddf1a3ccb5d47576bdd43e2.zip
cpython-e0a1f8fb5c60886dbddf1a3ccb5d47576bdd43e2.tar.gz
cpython-e0a1f8fb5c60886dbddf1a3ccb5d47576bdd43e2.tar.bz2
bpo-33610: IDLE's code-context always shows current context immediately (GH-14821)
Eliminate delay of up to 100ms and accompanying visual artifact. Fix bug of never showing context when hide and show.
Diffstat (limited to 'Lib/idlelib/idle_test')
-rw-r--r--Lib/idlelib/idle_test/test_codecontext.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/Lib/idlelib/idle_test/test_codecontext.py b/Lib/idlelib/idle_test/test_codecontext.py
index 05d3209..c6c8e8e 100644
--- a/Lib/idlelib/idle_test/test_codecontext.py
+++ b/Lib/idlelib/idle_test/test_codecontext.py
@@ -135,7 +135,7 @@ class CodeContextTest(unittest.TestCase):
toggle()
# Toggle on.
- eq(toggle(), 'break')
+ toggle()
self.assertIsNotNone(cc.context)
eq(cc.context['font'], self.text['font'])
eq(cc.context['fg'], self.highlight_cfg['foreground'])
@@ -145,11 +145,22 @@ class CodeContextTest(unittest.TestCase):
eq(self.root.tk.call('after', 'info', self.cc.t1)[1], 'timer')
# Toggle off.
- eq(toggle(), 'break')
+ toggle()
self.assertIsNone(cc.context)
eq(cc.editwin.label, 'Show Code Context')
self.assertIsNone(self.cc.t1)
+ # Scroll down and toggle back on.
+ line11_context = '\n'.join(x[2] for x in cc.get_context(11)[0])
+ cc.text.yview(11)
+ toggle()
+ eq(cc.context.get('1.0', 'end-1c'), line11_context)
+
+ # Toggle off and on again.
+ toggle()
+ toggle()
+ eq(cc.context.get('1.0', 'end-1c'), line11_context)
+
def test_get_context(self):
eq = self.assertEqual
gc = self.cc.get_context
@@ -329,7 +340,7 @@ class CodeContextTest(unittest.TestCase):
eq = self.assertEqual
cc = self.cc
save_font = cc.text['font']
- test_font = 'TkFixedFont'
+ test_font = 'TkTextFont'
# Ensure code context is not active.
if cc.context is not None: