1# Before "make install", this script should be runnable with "make test".
2# After "make install" it should work as "perl t/Olympus.t".
3
4BEGIN {
5    $| = 1; print "1..8\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::Olympus;
13$loaded = 1;
14print "ok 1\n";
15
16my $testname = 'Olympus';
17my $testnum = 1;
18
19# test 2: Extract information from Olympus.jpg
20{
21    ++$testnum;
22    my $exifTool = new Image::ExifTool;
23    my $info = $exifTool->ImageInfo('t/images/Olympus.jpg');
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        [Software => 'ExifTool', Group => 'XMP'],
33        [Macro => 'On'],
34    );
35    print 'not ' unless writeCheck(\@writeInfo, $testname, $testnum);
36    print "ok $testnum\n";
37}
38
39# test 4: Extract information from OlympusE1.jpg
40{
41    ++$testnum;
42    my $exifTool = new Image::ExifTool;
43    my $info = $exifTool->ImageInfo('t/images/OlympusE1.jpg');
44    print 'not ' unless check($exifTool, $info, $testname, $testnum);
45    print "ok $testnum\n";
46}
47
48# test 5: Rewrite Olympus E1 image
49{
50    ++$testnum;
51    my @writeInfo = (
52        [LensSerialNumber => '012345678'],
53        [CoringFilter => 0],
54    );
55    print 'not ' unless writeCheck(\@writeInfo, $testname, $testnum, 't/images/OlympusE1.jpg');
56    print "ok $testnum\n";
57}
58
59# test 6: Test reading Olympus type 2 maker notes
60{
61    ++$testnum;
62    my $exifTool = new Image::ExifTool;
63    my $info = $exifTool->ImageInfo('t/images/Olympus2.jpg');
64    print 'not ' unless check($exifTool, $info, $testname, $testnum);
65    print "ok $testnum\n";
66}
67
68# test 7: Rewrite type 2 maker notes
69{
70    ++$testnum;
71    my $exifTool = new Image::ExifTool;
72    my $testfile = "t/${testname}_${testnum}_failed.jpg";
73    unlink $testfile;
74    $exifTool->SetNewValue(FocusDistance => 100);
75    $exifTool->SetNewValue(Macro => 'On');
76    $exifTool->WriteInfo('t/images/Olympus2.jpg', $testfile);
77    if (testVerbose($testname, $testnum, $testfile, 2)) {
78        unlink $testfile;
79    } else {
80        print 'not ';
81    }
82    print "ok $testnum\n";
83}
84
85# test 8: Extract information from Olympus.dss
86{
87    ++$testnum;
88    my $exifTool = new Image::ExifTool;
89    my $info = $exifTool->ImageInfo('t/images/Olympus.dss');
90    print 'not ' unless check($exifTool, $info, $testname, $testnum);
91    print "ok $testnum\n";
92}
93
94
95# end
96