@@ -523,3 +523,30 @@ def from_offset_fixture(self):
523523 stream_rdr = StreamReader (BytesIO (bytes_ ), BIG_ENDIAN )
524524 offset , px_width , px_height = 0 , 42 , 24
525525 return stream_rdr , offset , px_width , px_height
526+
527+
528+ class Describe_pHYsChunk (object ):
529+
530+ def it_can_construct_from_a_stream_and_offset (self , from_offset_fixture ):
531+ stream_rdr , offset = from_offset_fixture [:2 ]
532+ horz_px_per_unit , vert_px_per_unit = from_offset_fixture [2 :4 ]
533+ units_specifier = from_offset_fixture [4 ]
534+ pHYs_chunk = _pHYsChunk .from_offset (None , stream_rdr , offset )
535+ assert isinstance (pHYs_chunk , _pHYsChunk )
536+ assert pHYs_chunk .horz_px_per_unit == horz_px_per_unit
537+ assert pHYs_chunk .vert_px_per_unit == vert_px_per_unit
538+ assert pHYs_chunk .units_specifier == units_specifier
539+
540+ # fixtures -------------------------------------------------------
541+
542+ @pytest .fixture
543+ def from_offset_fixture (self ):
544+ bytes_ = b'\x00 \x00 \x00 \x2A \x00 \x00 \x00 \x18 \x01 '
545+ stream_rdr = StreamReader (BytesIO (bytes_ ), BIG_ENDIAN )
546+ offset , horz_px_per_unit , vert_px_per_unit , units_specifier = (
547+ 0 , 42 , 24 , 1
548+ )
549+ return (
550+ stream_rdr , offset , horz_px_per_unit , vert_px_per_unit ,
551+ units_specifier
552+ )
0 commit comments