diff --git a/test/data/issue_1934_poc4-thumb_ref.jpg b/test/data/issue_1934_poc4-thumb_ref.jpg new file mode 100644 index 00000000..c001236b Binary files /dev/null and b/test/data/issue_1934_poc4-thumb_ref.jpg differ diff --git a/test/data/issue_1934_poc4.jpg b/test/data/issue_1934_poc4.jpg new file mode 100644 index 00000000..c7d8a41e Binary files /dev/null and b/test/data/issue_1934_poc4.jpg differ diff --git a/test/data/issue_1934_poc4_comment_ref.txt b/test/data/issue_1934_poc4_comment_ref.txt new file mode 100644 index 00000000..76c0241d Binary files /dev/null and b/test/data/issue_1934_poc4_comment_ref.txt differ diff --git a/test/data/issue_1934_poc4_ref.exv b/test/data/issue_1934_poc4_ref.exv new file mode 100644 index 00000000..cd26821d Binary files /dev/null and b/test/data/issue_1934_poc4_ref.exv differ diff --git a/test/data/issue_1934_poc4_ref.icc b/test/data/issue_1934_poc4_ref.icc new file mode 100644 index 00000000..7f9d18d0 Binary files /dev/null and b/test/data/issue_1934_poc4_ref.icc differ diff --git a/tests/bugfixes/github/test_pr_2000.py b/tests/bugfixes/github/test_pr_2000.py new file mode 100644 index 00000000..745f0545 --- /dev/null +++ b/tests/bugfixes/github/test_pr_2000.py @@ -0,0 +1,214 @@ +# -*- coding: utf-8 -*- + +import system_tests +from system_tests import CaseMeta, path, check_no_ASAN_UBSAN_errors + +class TestVerboseExtractXmpSidecarToStdout(metaclass=CaseMeta): + """ + Regression test for 'verbose extracting XMP sidecar to stdout' bug described in: + https://github.com/Exiv2/exiv2/issues/1934 + """ + url = "https://github.com/Exiv2/exiv2/issues/1934" + + filename = path("$data_path/issue_1934_poc4.jpg") + commands = ["$exiv2 --verbose --extract X- $filename"] + + stdout = [""" + + + + + + Value 1 + + + + + Value 1 + + + + + +"""] + + stderr = [""] + retval = [0] + +class TestVerboseModifyRegAddExtractXmpSidecarToStdout(metaclass=CaseMeta): + """ + Regression test for 'verbose with modify register and add when extracting XMP sidecar to stdout' + bug described in: + https://github.com/Exiv2/exiv2/issues/1934 + """ + url = "https://github.com/Exiv2/exiv2/issues/1934" + + filename = path("$data_path/issue_1934_poc4.jpg") + commands = ["""$exiv2 --verbose --Modify "reg TempGroup tempgroup/" --Modify "add Xmp.TempGroup.val Value 1" --extract X- $filename"""] + + stdout = [""" + + + + + + Value 1 + + + + + Value 1 + + + + + +"""] + + stderr = [""] + retval = [0] + +class TestVerboseModifySetExtractXmpSidecarToStdout(metaclass=CaseMeta): + """ + Regression test for 'verbose modify set when extracting XMP sidecar to stdout' bug described in: + https://github.com/Exiv2/exiv2/issues/1934 + """ + url = "https://github.com/Exiv2/exiv2/issues/1934" + + filename = path("$data_path/issue_1934_poc4.jpg") + commands = ["""$exiv2 --verbose --Modify "set Xmp.dc.subject Value 2" --extract X- $filename"""] + + stdout = [""" + + + + + + Value 1 + Value 2 + + + + + Value 1 + + + + + +"""] + + stderr = [""] + retval = [0] + +class TestVerboseModifyDelExtractXmpSidecarToStdout(metaclass=CaseMeta): + """ + Regression test for 'verbose modify delete when extracting XMP sidecar to stdout' bug described in: + https://github.com/Exiv2/exiv2/issues/1934 + """ + url = "https://github.com/Exiv2/exiv2/issues/1934" + + filename = path("$data_path/issue_1934_poc4.jpg") + commands = ["""$exiv2 --verbose --Modify "del Xmp.dc.subject" --extract X- $filename"""] + + stdout = [""" + + + + + + Value 1 + + + + + +"""] + + stderr = [""] + retval = [0] + +class TestVerboseExtractRawMetadataToStdout(metaclass=CaseMeta): + """ + Regression test for 'verbose extracting raw metadata to stdout' bug described in: + https://github.com/Exiv2/exiv2/issues/1934 + """ + url = "https://github.com/Exiv2/exiv2/issues/1934" + + filenameJPG = path("$data_path/issue_1934_poc4.jpg") + filenameEXV = path("$tmp_path/issue_1934_poc4.exv") + filenameRefEXV = path("$data_path/issue_1934_poc4_ref.exv") + + commands = ["$exiv2 --verbose --extract XXeix- $filenameJPG > $filenameEXV", + "cmp $filenameEXV $filenameRefEXV"] + + stderr = [""]*2 + retval = [0]*2 + + compare_stdout = check_no_ASAN_UBSAN_errors + +class TestVerboseExtractThumbnailToStdout(metaclass=CaseMeta): + """ + Regression test for 'verbose extracting the thumbnail to stdout' bug described in: + https://github.com/Exiv2/exiv2/issues/1934 + """ + url = "https://github.com/Exiv2/exiv2/issues/1934" + + filenameJPG = path("$data_path/issue_1934_poc4.jpg") + filenameThumbnail = path("$tmp_path/issue_1934_poc4-thumb.jpg") + filenameRefThumbnail = path("$data_path/issue_1934_poc4-thumb_ref.jpg") + + commands = ["$exiv2 --verbose --extract t- $filenameJPG > $filenameThumbnail", + "cmp $filenameThumbnail $filenameRefThumbnail"] + + stderr = [""]*2 + retval = [0]*2 + + compare_stdout = check_no_ASAN_UBSAN_errors + +class TestVerboseExtractICCProfileToStdout(metaclass=CaseMeta): + """ + Regression test for 'verbose extracting the ICC profile to stdout' bug described in: + https://github.com/Exiv2/exiv2/issues/1934 + """ + url = "https://github.com/Exiv2/exiv2/issues/1934" + + filenameJPG = path("$data_path/issue_1934_poc4.jpg") + filenameICC = path("$tmp_path/issue_1934_poc4.icc") + filenameRefICC = path("$data_path/issue_1934_poc4_ref.icc") + + commands = ["$exiv2 --verbose --extract C- $filenameJPG > $filenameICC", + "cmp $filenameICC $filenameRefICC"] + + stderr = [""]*2 + retval = [0]*2 + + compare_stdout = check_no_ASAN_UBSAN_errors + +class TestVerboseExtractCommentToStdout(metaclass=CaseMeta): + """ + Regression test for 'verbose extracting the comment to stdout' bug described in: + https://github.com/Exiv2/exiv2/issues/1934 + """ + url = "https://github.com/Exiv2/exiv2/issues/1934" + + filenameJPG = path("$data_path/issue_1934_poc4.jpg") + filenameComment = path("$tmp_path/issue_1934_poc4_comment.txt") + filenameRefComment = path("$data_path/issue_1934_poc4_comment_ref.txt") + + commands = ["$exiv2 --verbose --extract c- $filenameJPG > $filenameComment", + "cmp $filenameComment $filenameRefComment"] + + stderr = [""]*2 + retval = [0]*2 + + compare_stdout = check_no_ASAN_UBSAN_errors