コード例 #1
0
 def it_knows_the_image_px_dimensions(self, dimensions_fixture):
     image_header_, px_width, px_height = dimensions_fixture
     image = Image(None, None, image_header_)
     assert image.px_width == px_width
     assert image.px_height == px_height
コード例 #2
0
 def it_knows_the_horz_and_vert_dpi_of_the_image(self, dpi_fixture):
     image_header_, horz_dpi, vert_dpi = dpi_fixture
     image = Image(None, None, image_header_)
     assert image.horz_dpi == horz_dpi
     assert image.vert_dpi == vert_dpi
コード例 #3
0
 def it_provides_access_to_the_image_blob(self):
     blob = b'foobar'
     image = Image(blob, None, None)
     assert image.blob == blob
コード例 #4
0
 def it_knows_the_image_content_type(self, content_type_fixture):
     image_header_, content_type = content_type_fixture
     image = Image(None, None, image_header_)
     assert image.content_type == content_type
コード例 #5
0
 def size_fixture(self, image_header_):
     image_header_.px_width, image_header_.px_height = 150, 75
     image_header_.horz_dpi, image_header_.vert_dpi = 72, 200
     image = Image(None, None, image_header_)
     return image, 1905000, 342900
コード例 #6
0
 def scale_fixture(self, request, width_prop_, height_prop_):
     width, height, scaled_width, scaled_height = request.param
     width_prop_.return_value = Emu(1000)
     height_prop_.return_value = Emu(2000)
     image = Image(None, None, None)
     return image, width, height, (scaled_width, scaled_height)
コード例 #7
0
 def it_knows_the_sha1_of_its_image(self):
     blob = b'fO0Bar'
     image = Image(blob, None, None)
     assert image.sha1 == '4921e7002ddfba690a937d54bda226a7b8bdeb68'
コード例 #8
0
 def it_knows_the_image_filename_extension(self):
     image = Image(None, 'foobar.png', None)
     assert image.ext == 'png'
コード例 #9
0
 def it_knows_the_image_filename(self):
     filename = 'foobar.png'
     image = Image(None, filename, None)
     assert image.filename == filename