Skip to content

Commit 152d463

Browse files
committed
Add test
1 parent e601025 commit 152d463

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

lldb/test/API/functionalities/statusline/TestStatusline.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ def do_setup(self):
2727
self.expect("run", substrs=["stop reason"])
2828
self.resize()
2929

30-
def resize(self):
30+
def resize(self, height=None, width=None):
31+
height = self.TERMINAL_HEIGHT if not height else height
32+
width = self.TERMINAL_WIDTH if not width else width
3133
# Change the terminal dimensions. When we launch the tests, we reset
3234
# all the settings, leaving the terminal dimensions unset.
33-
self.child.setwinsize(self.TERMINAL_HEIGHT, self.TERMINAL_WIDTH)
35+
self.child.setwinsize(height, width)
3436

3537
def test(self):
3638
"""Basic test for the statusline."""
@@ -104,3 +106,17 @@ def test_no_target(self):
104106
self.resize()
105107

106108
self.expect("set set show-statusline true", ["no target"])
109+
110+
def test_resize(self):
111+
"""Test that move the cursor when resizing."""
112+
self.launch(timeout=self.TIMEOUT)
113+
self.resize()
114+
self.expect("set set show-statusline true", ["no target"])
115+
self.resize(20, 60)
116+
# Check for the newline followed by the escape code to move the cursor
117+
# up one line.
118+
self.child.expect(re.escape("\n\x1b[1A"))
119+
# Check for the escape code to move the cursor back to column 8.
120+
self.child.expect(re.escape("\x1b[8G"))
121+
122+

0 commit comments

Comments
 (0)