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())
def test_scroll_past_right(self): '''Test to scroll past right, should end up at right ''' 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()) self.assertFalse(scroll_win.at_right()) scroll_win.scroll(columns=10) self.assertFalse(scroll_win.at_left()) self.assertTrue(scroll_win.at_right())
def test_scroll_past_right(self): '''Test to scroll past right, should end up at right ''' 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()) self.assertFalse(scroll_win.at_right()) scroll_win.scroll(columns=10) self.assertFalse(scroll_win.at_left()) self.assertTrue(scroll_win.at_right())
def test_scroll_to_right(self): '''Test to scroll multiple columns to right of scrollarea''' cols = 70 extra_cols = 5 scroll_win = ScrollWindow(WindowArea(70, cols, 0, 0, scrollable_columns=cols+extra_cols), color_theme=ColorTheme(force_bw=True)) scroll_win.scroll(scroll_to_column=5) self.assertTrue(scroll_win.at_right())
def test_scroll_to_right(self): '''Test to scroll multiple columns to right of scrollarea''' cols = 70 extra_cols = 5 scroll_win = ScrollWindow(WindowArea(70, cols, 0, 0, scrollable_columns=cols + extra_cols), color_theme=ColorTheme(force_bw=True)) scroll_win.scroll(scroll_to_column=5) self.assertTrue(scroll_win.at_right())
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())