FujiFilm.t 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Before "make install", this script should be runnable with "make test".
  2. # After "make install" it should work as "perl t/FujiFilm.t".
  3. BEGIN { $| = 1; print "1..6\n"; $Image::ExifTool::noConfig = 1; }
  4. END {print "not ok 1\n" unless $loaded;}
  5. # test 1: Load the module(s)
  6. use Image::ExifTool 'ImageInfo';
  7. use Image::ExifTool::FujiFilm;
  8. $loaded = 1;
  9. print "ok 1\n";
  10. use t::TestLib;
  11. my $testname = 'FujiFilm';
  12. my $testnum = 1;
  13. # test 2: Extract information from FujiFilm.jpg
  14. {
  15. ++$testnum;
  16. my $exifTool = new Image::ExifTool;
  17. my $info = $exifTool->ImageInfo('t/images/FujiFilm.jpg');
  18. print 'not ' unless check($exifTool, $info, $testname, $testnum);
  19. print "ok $testnum\n";
  20. }
  21. # test 3: Write some new information
  22. {
  23. ++$testnum;
  24. my @writeInfo = (
  25. ['CreateDate','2005:01:06 11:51:09'],
  26. ['WhiteBalance', 'day white', 'Group', 'MakerNotes'],
  27. );
  28. print 'not ' unless writeCheck(\@writeInfo, $testname, $testnum);
  29. print "ok $testnum\n";
  30. }
  31. # test 4: Extract information from FujiFilm.raf
  32. {
  33. ++$testnum;
  34. my $exifTool = new Image::ExifTool;
  35. my @tags = qw(-filename -directory -filemodifydate -fileaccessdate
  36. -filecreatedate -fileinodechangedate -filepermissions);
  37. my $info = $exifTool->ImageInfo('t/images/FujiFilm.raf', @tags, {Duplicates=>1});
  38. print 'not ' unless check($exifTool, $info, $testname, $testnum);
  39. print "ok $testnum\n";
  40. }
  41. # tests 5-6: Write writing a RAF and changing it back again in memory
  42. {
  43. ++$testnum;
  44. my $exifTool = new Image::ExifTool;
  45. # set IgnoreMinorErrors option to allow invalid JpgFromRaw to be written
  46. $exifTool->SetNewValue(UserComment => 'test comment');
  47. my $testfile = "t/${testname}_${testnum}_failed.raf";
  48. unlink $testfile;
  49. $exifTool->WriteInfo('t/images/FujiFilm.raf', $testfile);
  50. my $info = $exifTool->ImageInfo($testfile, 'UserComment');
  51. print 'not ' unless check($exifTool, $info, $testname, $testnum);
  52. print "ok $testnum\n";
  53. ++$testnum;
  54. my $outfile;
  55. # pad out comment to make image the same size as the original
  56. $exifTool->SetNewValue(UserComment => ' ' x 248);
  57. $exifTool->WriteInfo($testfile, \$outfile);
  58. $info = $exifTool->ImageInfo(\$outfile, {Duplicates=>1});
  59. if (check($exifTool, $info, $testname, $testnum, 4)) {
  60. unlink $testfile;
  61. } else {
  62. print 'not ';
  63. }
  64. print "ok $testnum\n";
  65. }
  66. # end