Exemple #1
0
 def test_gradientbar_init(self):
     gb = color.GradientBar(self.window, hue=800, height=12, width=200)
     gb.pack()
     self.window.update()
     gb.destroy()
     self.window.update()
     gb = color.GradientBar(self.window, hue=-20, height=12, width=200)
     gb.pack()
     self.window.update()
     gb.destroy()
     self.window.update()
     gb = color.GradientBar(self.window, hue=20, height=12, width=200)
     gb.pack()
     self.window.update()
     gb.destroy()
     self.window.update()
     var = tk.IntVar(self.window)
     gb = color.GradientBar(self.window, hue=20, height=12, width=200,
                          variable=var)
     gb.pack()
     self.window.update()
     gb.destroy()
     self.window.update()
     var = tk.StringVar(self.window, 'b')
     gb = color.GradientBar(self.window, hue=20, height=12, width=200,
                          variable=var)
     gb.pack()
     self.window.update()
Exemple #2
0
 def test_gradientbar_bindings(self):
     gb = color.GradientBar(self.window, hue=20, height=12, width=200)
     gb.pack()
     self.window.update()
     event = TestEvent(x=0, y=1)
     gb._on_click(event)
     self.window.update()
     self.assertEqual(gb.get(), 0)
     event.x = gb.winfo_width()
     gb._on_move(event)
     self.window.update()
     self.assertEqual(gb.get(), 360)
Exemple #3
0
 def test_gradientbar_functions(self):
     gb = color.GradientBar(self.window, hue=20, height=12, width=200)
     gb.pack()
     self.window.update()
     gb._draw_gradient(60)
     self.window.update()
     self.assertEqual(gb.get(), 60)
     self.window.update()
     gb.set(40)
     self.window.update()
     self.assertEqual(gb.get(), 40)
     gb._update_hue()
     self.window.update()
     gb._variable.set(455)
     self.window.update()
     self.assertEqual(gb.get(), 360)
     gb._variable.set(-55)
     self.window.update()
     self.assertEqual(gb.get(), 0)