Skip to content

Commit

Permalink
add unit test for pasp box
Browse files Browse the repository at this point in the history
  • Loading branch information
asrashley committed Jun 12, 2023
1 parent 12eccf9 commit 90a3035
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/mp4_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,18 @@ def test_trun_with_negative_sample_composition_time_offset(self):
self.assertEqual(len(atoms), 1)
self.assertObjectEqual(traf.toJSON(), atoms[0].toJSON())

def test_parsing_pasp_box(self):
data = binascii.a2b_hex('000000107061737000000663000006b2')
src = BufferedReader(None, data=data)
atoms = mp4.Mp4Atom.load(src)
self.assertEqual(len(atoms), 1)
self.assertEqual(atoms[0].atom_type, 'pasp')
self.assertEqual(atoms[0].h_spacing, 0x663)
self.assertEqual(atoms[0].v_spacing, 0x6B2)
dest = io.BytesIO()
atoms[0].encode(dest)
self.assertBuffersEqual(dest.getvalue(), data, name="pasp")


if os.environ.get("TESTS"):
def load_tests(loader, tests, pattern):
Expand Down

0 comments on commit 90a3035

Please sign in to comment.