Esempio n. 1
0
    def test_v5_parser(self):
        expected = parser.BitmapInfoVersion5()
        expected.version = 5
        expected.bit_count = 32
        expected.height = 3
        expected.width = 4
        expected.planes_count = 1
        expected.bit_count = 32
        expected.compression = 3
        expected.image_size = 48
        expected.x_pixels_per_meter = 2835
        expected.y_pixels_per_meter = 2835
        expected.color_table_size = 0
        expected.important_colors = 0
        expected.red_mask = 4278190080
        expected.green_mask = 16711680
        expected.blue_mask = 65280
        expected.alpha_mask = 255
        expected.cs_type = 'BGRs'
        expected.intent = 2
        expected.profile_data = 0
        expected.profile_size = 0

        file_name = 'images/32-3.bmp'
        file = parser.open_file(file_name)
        result = parser.fill_v5_info(file)
        self.assertEqual(expected, result)
Esempio n. 2
0
 def setUp(self):
     self.file_name = 'images/aa.bmp'
     self.file = parser.open_file(self.file_name)
     self.header = parser.read_file_header(self.file, self.file_name)
     self.info = parser.get_bitmap_info(self.file, self.header)
     self.palette = parser.extract_palette(self.file, self.info)
Esempio n. 3
0
 def test_header_parsing(self):
     expected = parser.FileHeader(self.file_name, 768122, 122, 4)
     result = parser.read_file_header(parser.open_file(self.file_name),
                                      self.file_name)
     self.assertEqual(result, expected)
Esempio n. 4
0
 def setUp(self):
     self.file_name = 'images/qwe.bmp'
     self.file = parser.open_file(self.file_name)
Esempio n. 5
0
 def test_bmp_check(self):
     self.assert_file(parser.open_file('images/aa.bmp'))
     with self.assertRaises(TypeError):
         self.assert_file(parser.open_file('images/bb.png'))