def test_IL_DefaultParam(self): """Should insert a single line below the cursor.""" self.prepare_wide() esccmd.IL() AssertScreenCharsInRectEqual( Rect(1, 1, 5, 4), ["abcde", "fghij", empty() * 5, "klmno"])
def test_IL_ExplicitParam(self): """Should insert two lines below the cursor.""" self.prepare_wide() esccmd.IL(2) AssertScreenCharsInRectEqual( Rect(1, 1, 5, 5), ["abcde", "fghij", empty() * 5, empty() * 5, "klmno"])
def test_IL_AboveScrollRegion(self): """IL is a no-op outside the scroll region.""" self.prepare_region() esccmd.CUP(Point(1, 1)) esccmd.IL() esccmd.DECRESET(esccmd.DECLRMM) esccmd.DECSTBM() AssertScreenCharsInRectEqual(Rect( 1, 1, 5, 5), ["abcde", "fGHIj", "kLMNo", "pQRSt", "uvwxy"])
def test_IL_RespectsScrollRegion_Over(self): """Scroll by more than the available space in a region.""" self.prepare_region() esccmd.IL(99) esccmd.DECRESET(esccmd.DECLRMM) esccmd.DECSTBM() AssertScreenCharsInRectEqual(Rect(1, 1, 5, 5), [ "abcde", "f" + NUL * 3 + "j", "k" + NUL * 3 + "o", "p" + NUL * 3 + "t", "uvwxy" ])
def test_IL_RespectsScrollRegion(self): """When IL is invoked while the cursor is within the scroll region, lines within the scroll regions hould be scrolled down; lines within should remain unaffected.""" self.prepare_region() esccmd.IL() esccmd.DECRESET(esccmd.DECLRMM) esccmd.DECSTBM() AssertScreenCharsInRectEqual( Rect(1, 1, 5, 5), ["abcde", "f" + NUL * 3 + "j", "kGHIo", "pLMNt", "uvwxy"])
def test_IL_ScrollsOffBottom(self): """Lines should be scrolled off the bottom of the screen.""" height = GetScreenSize().height() for i in xrange(height): esccmd.CUP(Point(1, i + 1)) escio.Write("%04d" % (i + 1)) esccmd.CUP(Point(1, 2)) esccmd.IL() expected = 1 for i in xrange(height): y = i + 1 if y == 2: AssertScreenCharsInRectEqual(Rect(1, y, 4, y), [NUL * 4]) else: AssertScreenCharsInRectEqual(Rect(1, y, 4, y), ["%04d" % expected]) expected += 1