add more tests
This commit is contained in:
@@ -111,7 +111,7 @@ class TestLogFileModel(unittest.TestCase):
|
||||
|
||||
def test_scroll_with_float(self):
|
||||
"""
|
||||
If lines to lines to return is a float, then the value is rounded up.
|
||||
If lines to return is a float, then the value is rounded up.
|
||||
Floats mean that the text area is such that a line is partially visible.
|
||||
"""
|
||||
text = "0___\n1___\n2___\n3___\n4___\n5___"
|
||||
@@ -138,6 +138,52 @@ class TestLogFileModel(unittest.TestCase):
|
||||
line_str = [l.line() for l in lines]
|
||||
self.assertEqual(expected_lines, line_str)
|
||||
|
||||
def test_scroll_up_at_beginning_of_range(self):
|
||||
"""
|
||||
Scrolling up at beginning of a range.
|
||||
Current position is at the beginning of the range.
|
||||
:return:
|
||||
"""
|
||||
text = "0___\n1___\n2___\n3___\n4___\n5___"
|
||||
self.write_str(text)
|
||||
expected_lines = ["2___\n", "3___\n"]
|
||||
|
||||
lines = self.model.data(10, -2, 2, 10, -1)
|
||||
|
||||
line_str = [l.line() for l in lines]
|
||||
self.assertEqual(expected_lines, line_str)
|
||||
|
||||
def test_scroll_up_in_middle_of_range(self):
|
||||
"""
|
||||
Scrolling up at beginning of a range.
|
||||
Current position is one line after the beginning of the range
|
||||
:return:
|
||||
"""
|
||||
text = "0___\n1___\n2___\n3___\n4___\n5___"
|
||||
self.write_str(text)
|
||||
expected_lines = ["2___\n", "3___\n"]
|
||||
|
||||
lines = self.model.data(15, -2, 2, 10, -1)
|
||||
|
||||
line_str = [l.line() for l in lines]
|
||||
self.assertEqual(expected_lines, line_str)
|
||||
|
||||
def test_scroll_down_behind_end_of_range(self):
|
||||
"""
|
||||
Scrolling down_behind the end of the range.
|
||||
The last lines of the range are returned.
|
||||
In this example the range is lines 2 and 3.
|
||||
:return:
|
||||
"""
|
||||
text = "0___\n1___\n2___\n3___\n4___\n5___"
|
||||
self.write_str(text)
|
||||
expected_lines = ["2___\n", "3___\n"]
|
||||
|
||||
lines = self.model.data(15, -2, 2, 10, 20)
|
||||
|
||||
line_str = [l.line() for l in lines]
|
||||
self.assertEqual(expected_lines, line_str)
|
||||
|
||||
def test_read_word_at_middle_of_line(self):
|
||||
text = "0___\nlorem ipsum dolor sit amet\n2___"
|
||||
self.write_str(text)
|
||||
|
||||
Reference in New Issue
Block a user