diff --git a/tests/bash_tests/testcases.py b/tests/bash_tests/testcases.py index 27752aab..4e16c492 100644 --- a/tests/bash_tests/testcases.py +++ b/tests/bash_tests/testcases.py @@ -860,6 +860,40 @@ set Exif.Photo.DateTimeDigitized 2020:05:26 07:31:42 BT.reportTest('modify-test', out) + def nls_test(self): + # Test driver for exiv2.exe nls support + nls = BT.Executer('exiv2 -vVg nls').stdout.split('\n')[1] + platform = BT.Executer('exiv2 -vVg platform').stdout.split('\n')[1] + + if nls != 'enable_nls=1': + print('Skipped. Because exiv2 is not built with nls.') + return + if platform == 'platform=windows': + print('Skipped. Because nls_test cannot be run msvc builds.') + return + + # variable LANG is unused + # if platform == 'platform=linux': + # LANG = 'LANGUAGE' + # else: + # LANG = 'LANG' + + share_dir = os.path.normpath(os.path.join(BT.Config.bin_dir, '..', 'share2')) + os.makedirs(share_dir, exist_ok=True) + + locale_dir = '/usr/local/share/locale' + if os.path.isdir(locale_dir) and os.path.isdir(share_dir): + BT.cp(locale_dir, share_dir) + else: + print('Skipped. Because localisation files are not installed in {}.'.format(locale_dir)) + + # The above part is checking the environment, and the following part is executing the actual test + out = BT.Output() + for language in ['fr_FR', 'es_ES']: + out += BT.Executer('exiv2', extra_env={'LC_ALL': language, 'LANG': language}, assert_returncode=[1]) + BT.reportTest('nls-test', out) + + def path_test(self): # Mini test-driver for path utility functions BT.copyTestFile('path-test.txt')