Example #1
0
 def test_rgb_bgr_roundtrip(self):
     """RGB-to-BGR-to-RGB roundtrip conversion works correctly.
     """
     rgb_tuples = [
         (0, 0, 0),
         (64, 64, 64),
         (128, 128, 128),
         (255, 255, 255),
         (255, 0, 0),
         (0, 255, 0),
         (0, 0, 255),
         (255, 128, 0),
         (0, 255, 128),
         (128, 0, 255),
     ]
     for rgb in rgb_tuples:
         bgr_int = util.rgb_to_bgr_int(rgb)
         got_rgb = util.bgr_int_to_rgb(bgr_int)
         self.assertEqual(rgb, got_rgb)
Example #2
0
 def test_rgb_to_bgr_int(self):
     """RGB tuples are correctly converted to BGR integers.
     """
     self.assertEqual(util.rgb_to_bgr_int((255, 128, 64)), 4227327)