GeoTiff.t 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # Before "make install", this script should be runnable with "make test".
  2. # After "make install" it should work as "perl t/GeoTiff.t".
  3. BEGIN { $| = 1; print "1..4\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::GeoTiff;
  8. $loaded = 1;
  9. print "ok 1\n";
  10. use t::TestLib;
  11. my $testname = 'GeoTiff';
  12. my $testnum = 1;
  13. # test 2: Extract information from GeoTiff.tif
  14. {
  15. ++$testnum;
  16. my $exifTool = new Image::ExifTool;
  17. my $info = $exifTool->ImageInfo('t/images/GeoTiff.tif');
  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 = (['ResolutionUnit','cm']);
  25. print 'not ' unless writeCheck(\@writeInfo, $testname, $testnum, 't/images/GeoTiff.tif');
  26. print "ok $testnum\n";
  27. }
  28. # test 4: Copy GeoTiff information
  29. {
  30. ++$testnum;
  31. my $exifTool = new Image::ExifTool;
  32. my $testfile = "t/${testname}_${testnum}_failed.out";
  33. unlink $testfile;
  34. $exifTool->SetNewValuesFromFile('t/images/GeoTiff.tif', 'GeoTiff*');
  35. my $ok = writeInfo($exifTool,'t/images/ExifTool.tif',$testfile);
  36. my $info = $exifTool->ImageInfo($testfile, 'GeoTiff:*');
  37. if (check($exifTool, $info, $testname, $testnum) and $ok) {
  38. unlink $testfile;
  39. } else {
  40. print 'not ';
  41. }
  42. print "ok $testnum\n";
  43. }
  44. # end