Lang.t 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # Before `make install' is performed this script should be runnable with
  2. # `make test'. After `make install' it should work as `perl t/Lang.t'
  3. use Image::ExifTool;
  4. use t::TestLib;
  5. $| = 1;
  6. print "1..", scalar(@Image::ExifTool::langs), "\n";
  7. my $testname = 'Lang';
  8. my $testnum = 0;
  9. # test 1: Test localized language description for a lang-alt tag
  10. {
  11. ++$testnum;
  12. my $exifTool = new Image::ExifTool;
  13. $exifTool->Options(Lang => 'de');
  14. my $info = $exifTool->ImageInfo('t/images/MIE.mie', 'Comment-fr_FR');
  15. print 'not ' unless check($exifTool, $info, $testname, $testnum);
  16. print "ok $testnum\n";
  17. }
  18. # tests 2-N: Test all languages
  19. my $exifTool = new Image::ExifTool;
  20. my $lang;
  21. foreach $lang (@Image::ExifTool::langs) {
  22. next if $lang eq 'en'; # skip english
  23. ++$testnum;
  24. my $not = 'not ';
  25. $exifTool->Options(Lang => $lang);
  26. if ($exifTool->Options('Lang') eq $lang) {
  27. my $info = $exifTool->ImageInfo('t/images/FujiFilm.jpg', 'Exif:All');
  28. $not = '' if check($exifTool, $info, $testname, $testnum);
  29. } else {
  30. warn "\n Error loading language $lang\n";
  31. }
  32. print "${not}ok $testnum\n";
  33. }
  34. # end