Olympus.t 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. BEGIN { $| = 1; print "1..8\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::Olympus;
  8. $loaded = 1;
  9. print "ok 1\n";
  10. use t::TestLib;
  11. my $testname = 'Olympus';
  12. my $testnum = 1;
  13. # test 2: Extract information from Olympus.jpg
  14. {
  15. ++$testnum;
  16. my $exifTool = new Image::ExifTool;
  17. my $info = $exifTool->ImageInfo('t/images/Olympus.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. [Software => 'ExifTool', Group => 'XMP'],
  26. [Macro => 'On'],
  27. );
  28. print 'not ' unless writeCheck(\@writeInfo, $testname, $testnum);
  29. print "ok $testnum\n";
  30. }
  31. # test 4: Extract information from OlympusE1.jpg
  32. {
  33. ++$testnum;
  34. my $exifTool = new Image::ExifTool;
  35. my $info = $exifTool->ImageInfo('t/images/OlympusE1.jpg');
  36. print 'not ' unless check($exifTool, $info, $testname, $testnum);
  37. print "ok $testnum\n";
  38. }
  39. # test 5: Rewrite Olympus E1 image
  40. {
  41. ++$testnum;
  42. my @writeInfo = (
  43. [LensSerialNumber => '012345678'],
  44. [CoringFilter => 0],
  45. );
  46. print 'not ' unless writeCheck(\@writeInfo, $testname, $testnum, 't/images/OlympusE1.jpg');
  47. print "ok $testnum\n";
  48. }
  49. # test 6: Test reading Olympus type 2 maker notes
  50. {
  51. ++$testnum;
  52. my $exifTool = new Image::ExifTool;
  53. my $info = $exifTool->ImageInfo('t/images/Olympus2.jpg');
  54. print 'not ' unless check($exifTool, $info, $testname, $testnum);
  55. print "ok $testnum\n";
  56. }
  57. # test 7: Rewrite type 2 maker notes
  58. {
  59. ++$testnum;
  60. my $exifTool = new Image::ExifTool;
  61. my $testfile = "t/${testname}_${testnum}_failed.jpg";
  62. unlink $testfile;
  63. $exifTool->SetNewValue(FocusDistance => 100);
  64. $exifTool->SetNewValue(Macro => 'On');
  65. $exifTool->WriteInfo('t/images/Olympus2.jpg', $testfile);
  66. if (testVerbose($testname, $testnum, $testfile, 2)) {
  67. unlink $testfile;
  68. } else {
  69. print 'not ';
  70. }
  71. print "ok $testnum\n";
  72. }
  73. # test 8: Extract information from Olympus.dss
  74. {
  75. ++$testnum;
  76. my $exifTool = new Image::ExifTool;
  77. my $info = $exifTool->ImageInfo('t/images/Olympus.dss');
  78. print 'not ' unless check($exifTool, $info, $testname, $testnum);
  79. print "ok $testnum\n";
  80. }
  81. # end