def test_scroll_down_up_arrow(self):
        '''Test to scroll down and up with arrow key '''
        lines = 4
        extra_lines = 9
        scroll_win = ScrollWindow(WindowArea(lines,
                                             70,
                                             0,
                                             0,
                                             scrollable_lines=lines +
                                             extra_lines),
                                  color_theme=ColorTheme(force_bw=True))
        scroll_win.active_object = None

        self.assertTrue(scroll_win.at_top())
        key = scroll_win.on_arrow_key(curses.KEY_DOWN)
        self.assertEqual(key, None)
        self.assertFalse(scroll_win.at_top())

        key = scroll_win.on_arrow_key(curses.KEY_UP)
        self.assertEqual(key, None)
        self.assertTrue(scroll_win.at_top())

        key = scroll_win.on_arrow_key(curses.KEY_UP)
        self.assertEqual(key, curses.KEY_UP)
        self.assertTrue(scroll_win.at_top())

        scroll_win.scroll(extra_lines - 2)
        self.assertFalse(scroll_win.at_bottom())
        scroll_win.on_arrow_key(curses.KEY_DOWN)
        self.assertTrue(scroll_win.at_bottom())

        scroll_win.scroll(-(extra_lines - 2))
        self.assertFalse(scroll_win.at_top())
        scroll_win.on_arrow_key(curses.KEY_UP)
        self.assertTrue(scroll_win.at_top())
    def test_scroll_down_up_arrow(self):
        '''Test to scroll down and up with arrow key '''
        lines = 4
        extra_lines = 9
        scroll_win = ScrollWindow(WindowArea(lines, 70, 0, 0, 
                                  scrollable_lines=lines + extra_lines),
                                  color_theme=ColorTheme(force_bw=True))
        scroll_win.active_object = None

        self.assertTrue(scroll_win.at_top())
        key = scroll_win.on_arrow_key(curses.KEY_DOWN)
        self.assertEqual(key, None)
        self.assertFalse(scroll_win.at_top())

        key = scroll_win.on_arrow_key(curses.KEY_UP)
        self.assertEqual(key, None)
        self.assertTrue(scroll_win.at_top())

        key = scroll_win.on_arrow_key(curses.KEY_UP)
        self.assertEqual(key, curses.KEY_UP)
        self.assertTrue(scroll_win.at_top())

        scroll_win.scroll(extra_lines-2)
        self.assertFalse(scroll_win.at_bottom())
        scroll_win.on_arrow_key(curses.KEY_DOWN)
        self.assertTrue(scroll_win.at_bottom())
            
        scroll_win.scroll(-(extra_lines-2))
        self.assertFalse(scroll_win.at_top())
        scroll_win.on_arrow_key(curses.KEY_UP)
        self.assertTrue(scroll_win.at_top())
 def test_scroll_past_bottom(self):
     '''Test to scroll past bottom, should end up at bottom '''
     lines = 70
     extra_lines = 5
     scroll_win = ScrollWindow(WindowArea(lines, 70, 0, 0, 
                               scrollable_lines=lines + extra_lines),
                               color_theme=ColorTheme(force_bw=True))
     self.assertTrue(scroll_win.at_top())
     self.assertFalse(scroll_win.at_bottom())
     scroll_win.scroll(lines=10)
     self.assertFalse(scroll_win.at_top())
     self.assertTrue(scroll_win.at_bottom())
 def test_scroll_past_bottom(self):
     '''Test to scroll past bottom, should end up at bottom '''
     lines = 70
     extra_lines = 5
     scroll_win = ScrollWindow(WindowArea(lines,
                                          70,
                                          0,
                                          0,
                                          scrollable_lines=lines +
                                          extra_lines),
                               color_theme=ColorTheme(force_bw=True))
     self.assertTrue(scroll_win.at_top())
     self.assertFalse(scroll_win.at_bottom())
     scroll_win.scroll(lines=10)
     self.assertFalse(scroll_win.at_top())
     self.assertTrue(scroll_win.at_bottom())
 def test_scroll_to_bottom(self):
     '''Test to scroll multiple lines to bottom of scrollarea'''
     lines = 70
     extra_lines = 5
     scroll_win = ScrollWindow(WindowArea(lines, 70, 0, 0, 
                               scrollable_lines=lines + extra_lines),
                               color_theme=ColorTheme(force_bw=True))
     scroll_win.scroll(scroll_to_line=5)
     self.assertTrue(scroll_win.at_bottom())
 def test_scroll_to_bottom(self):
     '''Test to scroll multiple lines to bottom of scrollarea'''
     lines = 70
     extra_lines = 5
     scroll_win = ScrollWindow(WindowArea(lines,
                                          70,
                                          0,
                                          0,
                                          scrollable_lines=lines +
                                          extra_lines),
                               color_theme=ColorTheme(force_bw=True))
     scroll_win.scroll(scroll_to_line=5)
     self.assertTrue(scroll_win.at_bottom())