def test_minimum_vertical(self): bounds = [30.0, 600.0] position = [0.0, 0.0] range = [700, 100.0, 375.0, 20.454545454545453] scrollbar = NativeScrollBar( orientation='vertical', bounds=bounds, position=position, range=range, ) self.container.add(scrollbar) with self.setup_window(self.window): with self.setup_scrollbar(scrollbar, self.window): # control should be at top self.assertEqual(scrollbar._control.value(), 700 - 375) self.assertEqual(scrollbar.scroll_position, 100) # move the scrollbar to the bottom scrollbar._control.setValue(100) self.assertEqual(scrollbar.scroll_position, 700 - 375) # set the scroll & redraw scrollbar.scroll_position = 200 scrollbar._draw_mainlayer(self, self.window._gc) self.assertEqual(scrollbar._control.value(), 700 - 375 - (200 - 100))
def test_minimum_vertical(self): bounds = [30.0, 600.0] position = [0.0, 0.0] range = [700, 100.0, 375.0, 20.454545454545453] scrollbar = NativeScrollBar( orientation='vertical', bounds=bounds, position=position, range=range, ) self.container.add(scrollbar) with self.setup_window(self.window): with self.setup_scrollbar(scrollbar, self.window): # control should be at top self.assertEqual(scrollbar._control.value(), 700-375) self.assertEqual(scrollbar.scroll_position, 100) # move the scrollbar to the bottom scrollbar._control.setValue(100) self.assertEqual(scrollbar.scroll_position, 700-375) # set the scroll & redraw scrollbar.scroll_position = 200 scrollbar._draw_mainlayer(self, self.window._gc) self.assertEqual(scrollbar._control.value(), 700-375-(200-100))
def test_minumum_horizontal(self): bounds = [600.0, 30.0] position = [0.0, 0.0] range = [700, 100.0, 375.0, 20.454545454545453] scrollbar = NativeScrollBar(orientation="horizontal", bounds=bounds, position=position, range=range) self.container.add(scrollbar) with self.setup_window(self.window): with self.setup_scrollbar(scrollbar, self.window): self.assertEqual(scrollbar._control.value(), 100) self.assertEqual(scrollbar.scroll_position, 100) # move the scrollbar scrollbar._control.setValue(200) self.assertEqual(scrollbar.scroll_position, 200) # set the scroll & redraw scrollbar.scroll_position = 300 scrollbar._draw_mainlayer(self, self.window._gc) self.assertEqual(scrollbar._control.value(), 300)
def test_scroll_position_vertical(self): bounds = [30.0, 600.0] position = [0.0, 0.0] range = [600, 0.0, 375.0, 20.454545454545453] scrollbar = NativeScrollBar(orientation="vertical", bounds=bounds, position=position, range=range) self.container.add(scrollbar) with self.setup_window(self.window): with self.setup_scrollbar(scrollbar, self.window): self.assertEqual(scrollbar._control.value(), 600 - 375) self.assertEqual(scrollbar.scroll_position, 0) # move the scrollbar scrollbar._control.setValue(100) self.assertEqual(scrollbar.scroll_position, 600 - 375 - 100) # set the scroll & redraw scrollbar.scroll_position = 200 scrollbar._draw_mainlayer(self, self.window._gc) self.assertEqual(scrollbar._control.value(), 600 - 375 - 200)
def test_scroll_position_vertical(self): bounds = [30.0, 600.0] position = [0.0, 0.0] range = [600, 0.0, 375.0, 20.454545454545453] scrollbar = NativeScrollBar( orientation='vertical', bounds=bounds, position=position, range=range, ) self.container.add(scrollbar) with self.setup_window(self.window): with self.setup_scrollbar(scrollbar, self.window): self.assertEqual(scrollbar._control.value(), 600 - 375) self.assertEqual(scrollbar.scroll_position, 0) # move the scrollbar scrollbar._control.setValue(100) self.assertEqual(scrollbar.scroll_position, 600 - 375 - 100) # set the scroll & redraw scrollbar.scroll_position = 200 scrollbar._draw_mainlayer(self, self.window._gc) self.assertEqual(scrollbar._control.value(), 600 - 375 - 200)
def test_minumum_horizontal(self): bounds = [600.0, 30.0] position = [0.0, 0.0] range = [700, 100.0, 375.0, 20.454545454545453] scrollbar = NativeScrollBar( orientation='horizontal', bounds=bounds, position=position, range=range, ) self.container.add(scrollbar) with self.setup_window(self.window): with self.setup_scrollbar(scrollbar, self.window): self.assertEqual(scrollbar._control.value(), 100) self.assertEqual(scrollbar.scroll_position, 100) # move the scrollbar scrollbar._control.setValue(200) self.assertEqual(scrollbar.scroll_position, 200) # set the scroll & redraw scrollbar.scroll_position = 300 scrollbar._draw_mainlayer(self, self.window._gc) self.assertEqual(scrollbar._control.value(), 300)