PostScript.t 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Before "make install", this script should be runnable with "make test".
  2. # After "make install" it should work as "perl t/PostScript.t".
  3. BEGIN { $| = 1; print "1..3\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::PostScript;
  8. $loaded = 1;
  9. print "ok 1\n";
  10. use t::TestLib;
  11. my $testname = 'PostScript';
  12. my $testnum = 1;
  13. # test 2: Extract information from PostScript.eps
  14. {
  15. ++$testnum;
  16. my $exifTool = new Image::ExifTool;
  17. my $info = $exifTool->ImageInfo('t/images/PostScript.eps');
  18. print 'not ' unless check($exifTool, $info, $testname, $testnum);
  19. print "ok $testnum\n";
  20. }
  21. # test 3: Write EPS information (and test ExtractEmbedded option)
  22. {
  23. ++$testnum;
  24. my $exifTool = new Image::ExifTool;
  25. $exifTool->SetNewValuesFromFile('t/images/IPTC.jpg','*:*');
  26. $exifTool->SetNewValuesFromFile('t/images/XMP.jpg','*:*');
  27. $exifTool->SetNewValue(Title => 'new title');
  28. $exifTool->SetNewValue(Copyright => 'my copyright');
  29. $exifTool->SetNewValue(Creator => 'phil made it', Replace => 1);
  30. my $testfile = "t/${testname}_${testnum}_failed.eps";
  31. unlink $testfile;
  32. $exifTool->WriteInfo('t/images/PostScript.eps', $testfile);
  33. my $info = $exifTool->ImageInfo($testfile, {ExtractEmbedded => 1});
  34. if (check($exifTool, $info, $testname, $testnum, $testnum, 3)) {
  35. unlink $testfile;
  36. } else {
  37. print 'not ';
  38. }
  39. print "ok $testnum\n";
  40. }
  41. # end