Example #1
0
 def test_RGBFloatColor_equality(self):
     self.assertTrue(
         rgbf(1, 1, 1) == rgb(255, 255, 255), "RGB Color object")
     self.assertTrue(
         rgbf(0.5, 0.5, 0.5) == rgb(128, 128, 128),
         "RGB Color object; docs example")
     self.assertTrue(
         rgbf(0.5, 0.5, 0.5).rgb == rgb(128, 128, 128),
         "RGB Color object; docs example #2")
Example #2
0
 def test_rgbf(self):
     colors = rgbf(1, 0, 1).float
     self.assertTrue(
         colors.red == 1.0 and colors.green == 0.0 and colors.blue == 1.0,
         "Testing float")
Example #3
0
 def test_RGBFloatColor_value_error(self):
     with self.assertRaises(ValueError):
         rgbf(300.0, 300.0, 300.0)
Example #4
0
 def test_HSVColor_float(self):
     self.assertTrue(
         rgbf(1, 0, 0) == hsv(0, 1, 1).float, "HSV.float equals RGBFloat")
Example #5
0
 def test_RGBColor_float(self):
     self.assertTrue(
         rgbf(1, 1, 1) == rgb(255, 255, 255).float,
         "RGB.float equals RGBFloat")
Example #6
0
 def test_HexColor_float(self):
     self.assertTrue(
         rgbf(1, 0, 0) == hex("FF0000").float, "hex.float equals RGBFloat")
Example #7
0
 def test_rgb_float_color_object(self):
     colors = rgbf(1, 1, 1)
     self.assertTrue(
         colors.red == 1 and colors.green == 1 and colors.blue == 1,
         "RGB Color object")