From 799c87767684880469c12d75053fb860f4a0d3c9 Mon Sep 17 00:00:00 2001 From: Pedro Worcel Date: Thu, 26 Dec 2013 22:18:34 +1300 Subject: now really fix it + test --- test/test_console_contentview.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'test/test_console_contentview.py') diff --git a/test/test_console_contentview.py b/test/test_console_contentview.py index d013d10d..f581424b 100644 --- a/test/test_console_contentview.py +++ b/test/test_console_contentview.py @@ -295,7 +295,6 @@ def test_search_highlights_multi_line(): # should highlight second line, first appearance of string. f.search("string") text_object = tutils.get_body_line(f.last_displayed_body, 1) - print text_object.get_text() assert text_object.get_text() == ('string is string', [(None, 0), (f.highlight_color, 6)]) # should highlight third line, second appearance of string. @@ -328,4 +327,24 @@ def test_search_focuses(): text_object = tutils.get_body_line(f.last_displayed_body, 1) assert f.last_displayed_body.focus == text_object +def test_search_does_not_crash_on_bad(): + """ + this used to crash, kept for reference. + """ + + f = tutils.tflowview(request_contents="this is string\nstring is string\n"+("A" * cv.VIEW_CUTOFF)+"AFTERCUTOFF") + f.search("AFTERCUTOFF") + + # pretend F + f.state.add_flow_setting( + f.flow, + (f.state.view_flow_mode, "fullcontents"), + True + ) + f.master.refresh_flow(f.flow) + + # text changed, now this string will exist. can happen when user presses F + # for full text view + f.search("AFTERCUTOFF") + -- cgit v1.2.3