~ubuntu-branches/ubuntu/karmic/libimage-exiftool-perl/karmic

« back to all changes in this revision

Viewing changes to t/CanonVRD.t

  • Committer: Bazaar Package Importer
  • Author(s): Mari Wang
  • Date: 2008-02-04 20:32:53 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080204203253-mpbal8trlfe1fz5d
Tags: 7.00-1
* Upload of new production release (Closes: #456430)
* Added Recommends: libcompress-zlib-perl (Closes: #435589)
* Package now includes iptc2xmp.args and xmp2iptc.args, they are put
  into /usr/share/libimage-exiftool/ (Closes: #436100)
* Updated standards-version (3.7.2 -> 3.7.3). No changes needed.
* Lots of updates and bugfixes compared to last debian version
  (6.90).  See the Changes file for details
* Upload sponsored by Petter Reinholdtsen

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
# Change "1..N" below to so that N matches last test number
7
7
 
8
 
BEGIN {$Image::ExifTool::noConfig = 1; $| = 1; print "1..3\n";}
 
8
BEGIN {$Image::ExifTool::noConfig = 1; $| = 1; print "1..10\n";}
9
9
END {print "not ok 1\n" unless $loaded;}
10
10
 
11
11
# test 1: Load ExifTool
21
21
my $testname = 'CanonVRD';
22
22
my $testnum = 1;
23
23
 
 
24
# short list of tags to check in tests
 
25
my @checkTags = qw(FileSize Warning VRDVersion VRDOffset);
 
26
 
24
27
# test 2: Extract information from CanonVRD.vrd
25
28
{
26
29
    ++$testnum;
47
50
    print "ok $testnum\n";
48
51
}
49
52
 
 
53
# tests 4-8: Write CanonVRD as a block to various images
 
54
{
 
55
    my $exifTool = new Image::ExifTool;
 
56
    $exifTool->SetNewValuesFromFile('t/images/CanonVRD.vrd', 'CanonVRD');
 
57
    $exifTool->Options(PrintConv => 0);
 
58
    my ($file, $ext);
 
59
    foreach $file (qw(Writer.jpg ExifTool.jpg CanonRaw.cr2 CanonRaw.crw CanonVRD.vrd)) {
 
60
        ++$testnum;
 
61
        if ($file eq 'CanonVRD.vrd') {
 
62
            $exifTool->SetNewValuesFromFile('t/images/ExifTool.jpg', 'CanonVRD');
 
63
        }
 
64
        ($ext = $file) =~ s/^\w+//;
 
65
        $testfile = "t/${testname}_${testnum}_failed$ext";
 
66
        unlink $testfile;
 
67
        $exifTool->WriteInfo("t/images/$file", $testfile);
 
68
        my $info = $exifTool->ImageInfo($testfile, @checkTags);
 
69
        if (check($exifTool, $info, $testname, $testnum)) {
 
70
            unlink $testfile;
 
71
        } else {
 
72
            print 'not ';
 
73
        }
 
74
        print "ok $testnum\n";
 
75
    }
 
76
}
 
77
 
 
78
# test 9: Delete VRD as a block
 
79
{
 
80
    ++$testnum;
 
81
    my $exifTool = new Image::ExifTool;
 
82
    $exifTool->SetNewValue(CanonVRD => undef, Protected => 1);
 
83
    $testfile = "t/${testname}_${testnum}_failed.jpg";
 
84
    unlink $testfile;
 
85
    $exifTool->WriteInfo('t/images/ExifTool.jpg', $testfile);
 
86
    $exifTool->Options(PrintConv => 0);
 
87
    my $info = $exifTool->ImageInfo($testfile, @checkTags);
 
88
    if (check($exifTool, $info, $testname, $testnum)) {
 
89
        unlink $testfile;
 
90
    } else {
 
91
        print 'not ';
 
92
    }
 
93
    print "ok $testnum\n";
 
94
}
 
95
 
 
96
# test 10: Create a VRD file from scratch
 
97
{
 
98
    ++$testnum;
 
99
    my $exifTool = new Image::ExifTool;
 
100
    $exifTool->SetNewValuesFromFile('t/images/ExifTool.jpg', 'CanonVRD');
 
101
    $exifTool->Options(PrintConv => 0);
 
102
    $testfile = "t/${testname}_${testnum}_failed.vrd";
 
103
    unlink $testfile;
 
104
    $exifTool->WriteInfo(undef, $testfile);
 
105
    my $info = $exifTool->ImageInfo($testfile, @checkTags);
 
106
    if (check($exifTool, $info, $testname, $testnum, 8)) {
 
107
        unlink $testfile;
 
108
    } else {
 
109
        print 'not ';
 
110
    }
 
111
    print "ok $testnum\n";
 
112
}
 
113
 
50
114
# end