libtiff: Merge branch 'tiffcp_LZW_JBIG_test' into 'master'

From d4253ba1d317b094441c141f2584c7c9378089b2 Mon Sep 17 00:00:00 2001
From: Lee Howard <[EMAIL REDACTED]>
Date: Sat, 30 Mar 2024 11:43:03 -0700
Subject: [PATCH] Add basic sanity check for tiffcp LZW->JBIG conversion.

---
 test/Makefile.am                     | 12 +++++++++++-
 test/tiffcp-lzw-single-strip-jbig.sh |  7 +++++++
 2 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100755 test/tiffcp-lzw-single-strip-jbig.sh

diff --git a/test/Makefile.am b/test/Makefile.am
index ed0ae4d2..1f6e8c2d 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -68,6 +68,15 @@ JPEG_DEPENDENT_CHECK_PROG=
 JPEG_DEPENDENT_TESTSCRIPTS=
 endif
 
+if HAVE_JBIG
+if TIFF_TOOLS
+JBIG_DEPENDENT_TESTSCRIPTS=\
+	tiffcp-lzw-single-strip-jbig.sh
+endif
+else
+JBIG_DEPENDENT_TESTSCRIPTS=
+endif
+
 if BUILD_STATIC
 STATIC_CHECK_PROGS=rational_precision2double test_write_read_tags test_transferfunction_write_read
 endif
@@ -162,7 +171,8 @@ TESTSCRIPTS = \
 	testfax4.sh \
 	testfax3_bug_513.sh \
 	testdeflatelaststripextradata.sh \
-	$(JPEG_DEPENDENT_TESTSCRIPTS)
+	$(JPEG_DEPENDENT_TESTSCRIPTS) \
+	$(JBIG_DEPENDENT_TESTSCRIPTS)
 else
 TESTSCRIPTS=
 endif
diff --git a/test/tiffcp-lzw-single-strip-jbig.sh b/test/tiffcp-lzw-single-strip-jbig.sh
new file mode 100755
index 00000000..8b592296
--- /dev/null
+++ b/test/tiffcp-lzw-single-strip-jbig.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Generated file, master is Makefile.am
+. ${srcdir:-.}/common.sh
+infile="$srcdir/images/lzw-single-strip.tiff"
+outfile="o-tiffcp-lzw-single-strip-jbig.tiff"
+f_test_convert "${TIFFCP} -c jbig" $infile $outfile
+f_tiffinfo_validate $outfile