Added FileTypeBox default constructor defaults.

This commit is contained in:
John Evans 2013-06-21 06:34:33 -04:00
commit c8b0e26971
2 changed files with 14 additions and 1 deletions

View file

@ -596,8 +596,14 @@ class FileTypeBox(Jp2kBox):
List of file conformance profiles.
"""
def __init__(self, **kwargs):
Jp2kBox.__init__(self, id='', longname='File Type')
Jp2kBox.__init__(self, id='ftyp', longname='File Type')
self.__dict__.update(**kwargs)
if 'brand' not in kwargs.keys():
self.brand = 'jp2 '
if 'minor_version' not in kwargs.keys():
self.minor_version = 0
if 'compatibility_box' not in kwargs.keys():
self.compatibility_box = ['jp2 ']
def __str__(self):
lst = [Jp2kBox.__str__(self),

View file

@ -21,6 +21,13 @@ class TestJp2Boxes(unittest.TestCase):
b = glymur.jp2box.JPEG2000SignatureBox()
self.assertEqual(b.signature, (13, 10, 135, 10))
def test_default_FileTypeBox(self):
# Should be able to instantiate a FileTypeBox
b = glymur.jp2box.FileTypeBox()
self.assertEqual(b.brand, 'jp2 ')
self.assertEqual(b.minor_version, 0)
self.assertEqual(b.compatibility_box, ['jp2 '])
if __name__ == "__main__":
unittest.main()