QuickTime.t 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # Before "make install", this script should be runnable with "make test".
  2. # After "make install" it should work as "perl t/QuickTime.t".
  3. BEGIN { $| = 1; print "1..5\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::QuickTime;
  8. $loaded = 1;
  9. print "ok 1\n";
  10. use t::TestLib;
  11. my $testname = 'QuickTime';
  12. my $testnum = 1;
  13. # tests 2-3: Extract information from QuickTime.mov and QuickTime.m4a
  14. {
  15. my $ext;
  16. foreach $ext (qw(mov m4a)) {
  17. ++$testnum;
  18. my $exifTool = new Image::ExifTool;
  19. my $info = $exifTool->ImageInfo("t/images/QuickTime.$ext");
  20. print 'not ' unless check($exifTool, $info, $testname, $testnum);
  21. print "ok $testnum\n";
  22. }
  23. }
  24. # tests 4-5: Try writing XMP to the different file formats
  25. {
  26. my $ext;
  27. my $exifTool = new Image::ExifTool;
  28. $exifTool->Options(SavePath => 1); # to save group 5 names
  29. $exifTool->SetNewValue('XMP:Title' => 'x');
  30. $exifTool->SetNewValue('TrackCreateDate' => '2000:01:02 03:04:05');
  31. $exifTool->SetNewValue('Track1:TrackModifyDate' => '2013:11:04 10:32:15');
  32. foreach $ext (qw(mov m4a)) {
  33. ++$testnum;
  34. my $testfile = "t/${testname}_$testnum.failed";
  35. unlink $testfile;
  36. my $rtnVal = $exifTool->WriteInfo("t/images/QuickTime.$ext", $testfile);
  37. my $info = $exifTool->ImageInfo($testfile, 'title', 'time:all');
  38. if (check($exifTool, $info, $testname, $testnum, undef, 5)) {
  39. unlink $testfile;
  40. } else {
  41. print 'not ';
  42. }
  43. print "ok $testnum\n";
  44. }
  45. }
  46. # end