1# Before "make install", this script should be runnable with "make test".
2# After "make install" it should work as "perl t/Jpeg2000.t".
3
4BEGIN {
5    $| = 1; print "1..5\n"; $Image::ExifTool::configFile = '';
6    require './t/TestLib.pm'; t::TestLib->import();
7}
8END {print "not ok 1\n" unless $loaded;}
9
10# test 1: Load the module(s)
11use Image::ExifTool 'ImageInfo';
12use Image::ExifTool::Jpeg2000;
13$loaded = 1;
14print "ok 1\n";
15
16my $testname = 'Jpeg2000';
17my $testnum = 1;
18
19# test 2: Extract information from Jpeg2000.jp2
20{
21    ++$testnum;
22    my $exifTool = new Image::ExifTool;
23    my $info = $exifTool->ImageInfo('t/images/Jpeg2000.jp2');
24    print 'not ' unless check($exifTool, $info, $testname, $testnum);
25    print "ok $testnum\n";
26}
27
28# test 3: Write some new information
29{
30    ++$testnum;
31    my @writeInfo = (
32        ['IPTC:Keywords' => 'test keyword'],
33        ['XMP:City' => 'a city'],
34        ['EXIF:ImageDescription' => 'a description'],
35        ['XML' => '<test>Yippee</test>', Protected => 1 ],
36    );
37    print 'not ' unless writeCheck(\@writeInfo, $testname, $testnum, 't/images/Jpeg2000.jp2');
38    print "ok $testnum\n";
39}
40
41# test 4: Extract information from Jpeg2000.j2c
42{
43    ++$testnum;
44    my $exifTool = new Image::ExifTool;
45    my $info = $exifTool->ImageInfo('t/images/Jpeg2000.j2c');
46    print 'not ' unless check($exifTool, $info, $testname, $testnum);
47    print "ok $testnum\n";
48}
49
50# test 5: Extract XML as a block from JP2 image
51{
52    ++$testnum;
53    my $exifTool = new Image::ExifTool;
54    my $info = $exifTool->ImageInfo('t/images/Jpeg2000.jp2','xml');
55    print 'not ' unless check($exifTool, $info, $testname, $testnum);
56    print "ok $testnum\n";
57}
58
59# end
60