def test_scroll_past_left(self): '''Test to scroll past left, should end up at left ''' cols = 70 extra_cols = 5 scroll_win = ScrollWindow(WindowArea(70, cols, 0, 0, scrollable_columns=cols + extra_cols), color_theme=ColorTheme(force_bw=True)) self.assertTrue(scroll_win.at_left()) scroll_win.scroll(columns=-3) self.assertTrue(scroll_win.at_left())
def test_scroll_right_left_arrow(self): '''Test to scroll right and left with arrow key ''' cols = 3 extra_cols = 5 scroll_win = ScrollWindow(WindowArea(10, cols, 0, 0, scrollable_columns=cols + extra_cols), color_theme=ColorTheme(force_bw=True)) scroll_win.active_object = None self.assertTrue(scroll_win.at_left()) key = scroll_win.on_arrow_key(curses.KEY_RIGHT) self.assertEqual(key, None) self.assertFalse(scroll_win.at_left()) key = scroll_win.on_arrow_key(curses.KEY_LEFT) self.assertEqual(key, None) self.assertTrue(scroll_win.at_left()) key = scroll_win.on_arrow_key(curses.KEY_LEFT) self.assertEqual(key, curses.KEY_LEFT) self.assertTrue(scroll_win.at_left()) scroll_win.scroll(columns=extra_cols - 2) self.assertFalse(scroll_win.at_left()) self.assertFalse(scroll_win.at_right()) scroll_win.on_arrow_key(curses.KEY_RIGHT) self.assertTrue(scroll_win.at_right()) scroll_win.scroll(columns=-(extra_cols - 2)) self.assertFalse(scroll_win.at_left()) self.assertFalse(scroll_win.at_right()) scroll_win.on_arrow_key(curses.KEY_LEFT) self.assertTrue(scroll_win.at_left())