示例#1
0
文件: tests.py 项目: sanyabas/bmp
    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)
示例#2
0
文件: tests.py 项目: sanyabas/bmp
 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)
示例#3
0
文件: tests.py 项目: sanyabas/bmp
 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)
示例#4
0
文件: tests.py 项目: sanyabas/bmp
 def setUp(self):
     self.file_name = 'images/qwe.bmp'
     self.file = parser.open_file(self.file_name)
示例#5
0
文件: tests.py 项目: sanyabas/bmp
 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'))