Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
7adb9ad
initial working shell sidebar
taleinat Aug 5, 2019
26bbaec
fix recall and handling of prompt and input lines
taleinat Aug 23, 2019
9076da5
update only as needed during editing, accounting for line wrapping
taleinat Aug 23, 2019
cad2cd1
properly insert delegators into their proper place in the percolator
taleinat Aug 24, 2019
4040e26
move non-syntax tag highlighting out of ColorDelegator
taleinat Aug 24, 2019
9b31031
replace shell sidebar prompt and input line recognition method
taleinat Aug 24, 2019
37a0db3
minor code cleanup
taleinat Aug 24, 2019
c766822
remove unnecessary .replace() delegator method
taleinat Aug 24, 2019
50bd082
fix inverted condition in deciding whether to update sidebar (oops!)
taleinat Aug 24, 2019
6f186f0
fix "stdin" tag removed when undo-ing a deletion
taleinat Aug 24, 2019
f7f3de9
fix sidebar update on new prompt
taleinat Aug 24, 2019
e929ea7
add a NEWS entry
taleinat Aug 24, 2019
d04bfa3
fix recall handling with multiple successive statements
taleinat Aug 24, 2019
81f4852
remove a dead line
taleinat Aug 24, 2019
46be85e
remove commented out initial attempt
taleinat Aug 24, 2019
1fc4bcb
update shell sidebar font upon font config changes
taleinat Aug 25, 2019
6f1c975
update sidebar text colors upon highlight config changes
taleinat Sep 17, 2020
083fede
use the prompt ("console") foreground color for the shell sidebar text
taleinat Sep 17, 2020
4ad72a1
show continuation prompts ("...") for multi-line history recall
taleinat Sep 17, 2020
009e08d
show continuation prompts ("...") after multi-line replace in the shell
taleinat Sep 17, 2020
e524cce
show continuation prompts ("...") after multi-line undo/redo in the s…
taleinat Sep 17, 2020
3ea2986
don't show continuation prompts ("...") for print() outputs
taleinat Sep 17, 2020
7f9182f
allow deleting ">>> " at the beginning of a line in shell windows
taleinat Sep 17, 2020
10aaf1d
update shell sidebar on shell output squeeze/unsqueeze
taleinat Sep 17, 2020
7c91901
remove failing editor window test that is no longer relevant
taleinat Sep 17, 2020
50ca9c6
add several tests for the shell sidebar
taleinat Sep 18, 2020
23c218f
reduce shell sidebar test run time by reusing the PyShell
taleinat Sep 18, 2020
6cef0a9
revert removal of the "hit" tag from Colorizer.tag_defs
taleinat Oct 11, 2020
a018135
hide unnecessary extra "root" Tk window in tests
taleinat Oct 11, 2020
525fe44
fix test method names
taleinat Oct 11, 2020
7b8913d
fix test comments according to pep-8 style
taleinat Oct 11, 2020
8c8d0c0
rename sidebar test class according to convention
taleinat Oct 11, 2020
7ecc843
re-word doc-strings for BaseSideBar and EndLineDelegator
taleinat Oct 12, 2020
bedb1cb
re-word doc-strings for get_lineno and get_end_linenumber
taleinat Oct 12, 2020
eee0453
optimize tests and make them more robust
taleinat Oct 12, 2020
7afcb57
handle mouse buttons except for button 1 (left-click)
taleinat Oct 12, 2020
8a7dd60
add tests for text font and color configs
taleinat Oct 12, 2020
6efb968
remove show/hide_sidebar from the shell sidebar
taleinat Oct 12, 2020
cc37924
add more test cases
taleinat Oct 12, 2020
97576da
update coverage percentage
taleinat Oct 12, 2020
2aa4e1a
re-word squeeze_current_text() doc-string
taleinat Oct 12, 2020
71f343e
update coverage percentage
taleinat Oct 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add more test cases
  • Loading branch information
taleinat committed Oct 12, 2020
commit cc3792415760a72e2759a8913028ad3e7aee93b1
76 changes: 74 additions & 2 deletions Lib/idlelib/idle_test/test_sidebar.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Test sidebar, coverage 93%"""
Comment thread
taleinat marked this conversation as resolved.
from textwrap import dedent
from time import sleep
import sys

from itertools import chain
import unittest
Expand All @@ -16,7 +16,7 @@
from idlelib.pyshell import fix_x11_paste, PyShell, PyShellFileList
from idlelib.run import fix_scaling
import idlelib.sidebar
from idlelib.sidebar import get_lineno
from idlelib.sidebar import get_end_linenumber, get_lineno


class Dummy_editwin:
Expand Down Expand Up @@ -571,6 +571,53 @@ def test_squeeze_single_line_command(self):
self.assert_sidebar_lines_end_with(['>>>', ' ', '>>>'])
self.assert_sidebar_lines_synced()

@test_coroutine
def test_interrupt_recall_undo_redo(self):
event_generate = self.shell.text.event_generate
# Block statements are not indented because IDLE auto-indents.
initial_sidebar_lines = self.get_sidebar_lines()

self.do_input(dedent('''\
if True:
print(1)
'''))
yield 0
self.assert_sidebar_lines_end_with(['>>>', '...', '...'])
with_block_sidebar_lines = self.get_sidebar_lines()
self.assertNotEqual(with_block_sidebar_lines, initial_sidebar_lines)

# Control-C
event_generate('<<interrupt-execution>>')
yield 0
self.assert_sidebar_lines_end_with(['>>>', '...', '...', ' ', '>>>'])

# Recall previous via history
event_generate('<<history-previous>>')
event_generate('<<interrupt-execution>>')
yield 0
self.assert_sidebar_lines_end_with(['>>>', '...', ' ', '>>>'])

# Recall previous via recall
event_generate('<Key-Up>')
event_generate('<Key-Up>')
event_generate('<Key-Return>')
yield 0

event_generate('<<undo>>')
yield 0
self.assert_sidebar_lines_end_with(['>>>'])

event_generate('<<redo>>')
yield 0
self.assert_sidebar_lines_end_with(['>>>', '...'])

event_generate('<Key-Return>')
event_generate('<Key-Return>')
yield 2
self.assert_sidebar_lines_end_with(
['>>>', '...', '...', '...', ' ', '>>>']
)

def test_font(self):
sidebar = self.shell.shell_sidebar

Expand Down Expand Up @@ -629,6 +676,31 @@ def get_sidebar_colors():
sidebar.update_colors()
self.assertEqual(get_sidebar_colors(), test_colors)

@test_coroutine
def test_mousewheel(self):
sidebar = self.shell.shell_sidebar
text = self.shell.text

# Press Return 50 times to get the shell screen to scroll down.
for _i in range(50):
self.do_input('\n')
yield 0
self.assertGreater(get_lineno(text, '@0,0'), 1)

last_lineno = get_end_linenumber(text)
self.assertIsNotNone(text.dlineinfo(text.index(f'{last_lineno}.0')))

# Scroll up using the <MouseWheel> event with a positive delta.
delta = -1 if sys.platform == 'darwin' else 120
sidebar.canvas.event_generate('<MouseWheel>', x=0, y=0, delta=delta)
yield 0
self.assertIsNone(text.dlineinfo(text.index(f'{last_lineno}.0')))

# Scroll back down using the <Button-5> event.
sidebar.canvas.event_generate('<Button-5>', x=0, y=0)
yield 0
self.assertIsNotNone(text.dlineinfo(text.index(f'{last_lineno}.0')))


if __name__ == '__main__':
unittest.main(verbosity=2)