def test_covert_rgb_and_back(self): expected_green_color = 256 * 256 * 256 - 1 rgb_green = tools._covert_integer_to_rgb_color(expected_green_color) actual_color = tools._convert_rgb_color_to_integer(rgb_green) self.assertEqual(expected_green_color, actual_color) expected_black_color = 256 * 256 * 256 - 1 rgb_black = tools._covert_integer_to_rgb_color(expected_black_color) actual_color = tools._convert_rgb_color_to_integer(rgb_black) self.assertEqual(expected_black_color, actual_color)
def test_rgb_tuple_to_integer(self): white_color = (0, 0, 0) self.assertEqual(0, tools._convert_rgb_color_to_integer(white_color)) light_red_color = (100, 0, 0) self.assertEqual(100, tools._convert_rgb_color_to_integer(light_red_color)) light_green_color = (0, 100, 0) self.assertEqual(256 * 100, tools._convert_rgb_color_to_integer(light_green_color)) light_blue_color = (0, 0, 100) self.assertEqual(256 * 256 * 100, tools._convert_rgb_color_to_integer(light_blue_color)) black_color = (255, 255, 255) self.assertEqual(256 * 256 * 256 - 1, tools._convert_rgb_color_to_integer(black_color))