Commit Graph

50 Commits

Author SHA1 Message Date
Thomas Bernard
69ce2652ef
Add test to check that libtiff types have the correct size
in configure/CMakeList.txt :

- TIFF_INT8_T/TIFF_UINT8_T is signed/unsigned char
sizeof(char)==1 in C standard
- TIFF_INT16_T/TIFF_UINT16_T is signed/unsigned short
sizeof(short)>=2 in C standard
- TIFF_INT32_T/TIFF_UINT32_T is defined so its sizeof() is 4

- TIFF_INT64_T/TIFF_UINT64_T is defined so its sizeof() is 8

- TIFF_SIZE_T is defined so it has same sizeof() than size_t

- TIFF_SSIZE_T is defined so it has same sizeof() than unsigned char *
2019-05-31 20:10:51 +02:00
Even Rouault
eaeca6274a
Add TIFFDeferStrileArrayWriting() and TIFFForceStrileArrayWriting()
Those advanced writing functions must be used in a particular sequence
to make their intended effect. Their aim is to control when/where
the [Strip/Tile][Offsets/ByteCounts] arrays are written into the file.

The purpose of this is to generate 'cloud-optimized geotiff' files where
the first KB of the file only contain the IFD entries without the potentially
large strile arrays. Those are written afterwards.

The typical sequence of calls is:
TIFFOpen()
[ TIFFCreateDirectory(tif) ]
Set fields with calls to TIFFSetField(tif, ...)
TIFFDeferStrileArrayWriting(tif)
TIFFWriteCheck(tif, ...)
 TIFFWriteDirectory(tif)
 ... potentially create other directories and come back to the above directory
TIFFForceStrileArrayWriting(tif): emit the arrays at the end of file

See test/defer_strile_writing.c for a practical example.
2019-05-25 11:37:34 +02:00
Even Rouault
371ad2658c
Make defer strile offset/bytecount loading available at runtime
... and add per-strile offset/bytecount loading capabilities.

Part of this commit makes the behaviour that was previously met when
libtiff was compiled with -DDEFER_STRILE_LOAD available for default builds
when specifying the new 'D' (Deferred) TIFFOpen() flag. In that mode, the [Tile/Strip][ByteCounts/Offsets]
arrays are only loaded when first accessed. This can speed-up the opening
of files stored on the network when just metadata retrieval is needed.
This mode has been used for years by the GDAL library when compiled with
its embeded libtiff copy.

To avoid potential out-of-tree code (typically codecs) that would use
the td_stripbytecount and td_stripoffset array inconditionnaly assuming they
have been loaded, those have been suffixed with _p (for protected). The
use of the new functions mentionned below is then recommended.

Another addition of this commit is the capability of loading only the
values of the offset/bytecount of the strile of interest instead of the
whole array. This is enabled with the new 'O' (Ondemand) flag of TIFFOpen()
(which implies 'D'). That behaviour has also been used by GDAL, which hacked
into the td_stripoffset/td_stripbytecount arrays directly. The new code
added in the _TIFFFetchStrileValue() and _TIFFPartialReadStripArray() internal
functions is mostly a port of what was in GDAL GTiff driver previously.

Related to that, the public TIFFGetStrileOffset[WithErr]() and TIFFGetStrileByteCount[WithErr]()
functions have been added to API. They are of particular interest when
using sparse files (with offset == bytecount == 0) and you want to detect
if a strile is present or not without decompressing the data, or updating
an existing sparse file.
They will also be used to enable a future enhancement where client code can entirely
skip bytecount loading in some situtations

A new test/defer_strile_loading.c test has been added to test the above
capabilities.
2019-05-10 14:46:45 +02:00
Even Rouault
b9b93f661e Merge branch 'bug2799' into 'master'
fix fax2tiff

See merge request libtiff/libtiff!55
2019-05-08 08:36:34 +00:00
Thomas Bernard
57c112bfa9
Add output check for tiff2ps
note : the reference files have been generated in master branch
2019-04-03 14:55:29 +02:00
Thomas Bernard
933575f505
add a test for fax2tiff tool 2019-03-22 10:06:01 +01:00
Even Rouault
4af64003c8
Fix libtiff 4.0.8 regression when reading LZW-compressed strips with scanline API
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2800
2018-08-07 11:54:27 +02:00
Bob Friesenhahn
45065882ae * test/Makefile.am: Add some tests for tiff2bw. 2017-11-02 13:51:22 +00:00
Even Rouault
6dac309a97 * test/Makefile.am: add missing reference to images/quad-lzw-compat.tiff
to fix "make distcheck". Patch by Roger Leigh
2017-08-28 15:43:14 +00:00
Even Rouault
abc862b594 * test/tiffcp-lzw-compat.sh, test/images/quad-lzw-compat.tiff: new files
to test old-style LZW decompression
* test/common.sh, Makefile.am, CMakeList.txt: updated with above
2017-07-11 09:20:31 +00:00
Bob Friesenhahn
30366c9f22 * tools/Makefile.am: The libtiff tools bmp2tiff, gif2tiff,
ras2tiff, sgi2tiff, sgisv, and ycbcr are completely removed from
the distribution.  The libtiff tools rgb2ycbcr and thumbnail are
only built in the build tree for testing.  Old files are put in
new 'archive' subdirectory of the source repository, but not in
distribution archives.  These changes are made in order to lessen
the maintenance burden.
2016-06-05 19:53:59 +00:00
Bob Friesenhahn
ba57d5f0b7 * CMakeLists.txt, libtiff/test/Makefile.am: Applied patches by
Roger Leigh (via tiff mailing list on 2015-08-31.

CMake reads all version information directly from configure.ac to
avoid duplication of values.  This basically greps over the file
for the LIBTIFF_* variables, then translates them to the form
needed for cmake. This includes the release version and libtool
shared library version information.

Make shared/static library building configurable.  Currently it
always builds shared libraries, with static libs having a _static
suffix (copying zlib, but it means it's got a non-standard name).
CMake has a -DBUILD_SHARED_LIBS=ON|OFF option to select one or the
other, which is now used instead.  There's now a single "tiff"
target to build either shared or static as required, and all the
tests and tools are linked with this. Note: the Windows tests fail
when linked with a static libtiff (says: libtiff.dll not found).
Not really a regression since this was not tested up to this
point, and it's likely the unit tests haven't (ever?) been run on
Windows with a static libtiff, so there's some additional
portability issue here to address.  Works fine on UNIX systems,
and fine on Windows with the default to build a DLL.

Add a missing file which wasn't being distributed, causing unit
tests to fail.  Note that "find . -name '*.cmake'" lists all the
CMake files which need distributing in addition to all the
CMakeLists.txt files (which now are distributed).
2015-09-01 02:51:50 +00:00
Bob Friesenhahn
e9b10efff9 Additional CMake-related files were missing from the distribution tarball. 2015-08-31 00:01:18 +00:00
Bob Friesenhahn
1fea0da266 All the CMakeLists.txt files were missing from the distribution tarball. 2015-08-30 21:26:45 +00:00
Bob Friesenhahn
0319952da2 * test/Makefile.am: tiff2rgba-quad-tile.jpg.sh depends on the JPEG
library so only execute if JPEG is available.
2015-06-21 19:32:32 +00:00
Bob Friesenhahn
bdd91bbdf8 * configure.ac: Add a HAVE_FOO Automake conditional for each
add-on library.

* test/Makefile.am (JPEG_DEPENDENT_CHECK_PROG): raw_decode
requires JPEG support to compile.  Use Automake conditional to
only include it when JPEG support is available.
2015-06-21 18:46:29 +00:00
Bob Friesenhahn
12f78c491f Update the valgrind memcheck recipe for the test suite. 2014-12-06 20:36:14 +00:00
Bob Friesenhahn
f458c10308 * Makefile.am: Update to Automake 1.12.4 2012-09-20 13:50:27 +00:00
Frank Warmerdam
a14505cf0a add custom directory read/write testing 2012-06-06 04:58:29 +00:00
Frank Warmerdam
7f67da5de1 add jpeg in tiff decode testing 2012-06-01 21:04:22 +00:00
Lee Howard
f7aebc2647 tiffcrop-extractz14-logluv-3c-16b.sh now passes 2010-12-14 03:27:13 +00:00
Bob Friesenhahn
c9d00c6c3c Change tiffcrop parameters to -X 60 -Y 60 2009-11-02 18:30:21 +00:00
Bob Friesenhahn
eecc3405f3 * tools/tiffcrop.c, man/tiffcrop.1: New tiffcrop from Richard
Nolde.  Major updates to add significant functionality for reading
and writing tile based images with bit depths not a multiple of 8
which cannot be handled by tiffcp.
2009-09-24 21:57:11 +00:00
Bob Friesenhahn
61635e13d2 * test/{bmp2tiff_palette.sh, bmp2tiff_rgb.sh, gif2tiff.sh,
ppm2tiff_pbm.sh, ppm2tiff_pgm.sh, ppm2tiff_ppm.sh}: Additional
utilities tests.
2009-08-29 20:45:09 +00:00
Bob Friesenhahn
e39271f390 Add tiffcrop-extractz14-logluv-3c-16b.sh to XFAIL_TESTS 2009-08-28 23:53:15 +00:00
Bob Friesenhahn
0f2332cec2 * test/Makefile.am (TIFFIMAGES): Add test images in BMP, GIF, and
PNM formats so that we will be able to test more of the tools.
While adding these test images I notice that bmp2tiff and gif2tiff
only support ancient versions of their respective formats.
2009-08-28 17:46:01 +00:00
Bob Friesenhahn
7492898195 Fix typo. 2009-08-24 02:55:05 +00:00
Bob Friesenhahn
b772c5a5d6 Export certain variables (MAKE, MAKEFLAGS, MEMCHECK) to tests and
added 'memcheck' and 'ptrcheck' targets to make it easy to run the
tests under valgrind.
2009-08-23 23:23:19 +00:00
Bob Friesenhahn
63e03ebcec tiffcrop.sh into a collection of many specific tests. Re-wrote
all of the existing tests to be based on some simple shell
functions.  Make distcheck works again.
2009-08-23 22:58:25 +00:00
Bob Friesenhahn
3237e5e177 * test/Makefile.am, test/tiffcrop*.sh: Split previously existing
tiffcrop.sh into a collection of many specific tests.
2009-08-23 20:19:40 +00:00
Bob Friesenhahn
b44da14dea Add start of XFAIL_TESTS 2009-08-22 01:45:32 +00:00
Bob Friesenhahn
38521145a6 * test/Makefile.am (AUTOMAKE_OPTIONS): Colorized tests was not
actually activated since it needed to be enabled in this
Makefile.am.  Also activated parallel-tests mode since it offers
useful features such as per-test .log files and a summary test
report .log file.
2009-08-21 16:52:14 +00:00
Frank Warmerdam
f4da7ed52e add -c sgilog to tiffcp, add minimal logluv testing 2009-06-30 17:25:26 +00:00
Frank Warmerdam
a042a8d460 added tiff2rgba tests 2009-02-13 21:26:03 +00:00
Bob Friesenhahn
d6c4560053 * test/Makefile.am (CLEANFILES): Make sure that test output files
are removed by 'make clean'
2009-01-21 02:06:55 +00:00
Bob Friesenhahn
506c21992e * test/tiffcrop.sh: New test script for tiffcrop from Richard
Nolde.

* tools/tiff2ps.c: Remove spurious message to stderr.
2009-01-12 16:23:11 +00:00
Bob Friesenhahn
a4e657cc8a * test {tiff2pdf.sh tiff2ps-EPS1.sh tiff2ps-PS1.sh tiff2ps-PS2.sh
tiff2ps-PS3.sh tiffcp-g3-1d-fill.sh tiffcp-g3-1d.sh
tiffcp-g3-2d-fill.sh tiffcp-g3-2d.sh tiffcp-g3.sh tiffcp-g4.sh
tiffcp-split-join.sh tiffcp-split.sh tiffcp-thumbnail.sh
tiffdump.sh tiffinfo.sh}: Added more test scripts based on
suggestions from Lee Howard posted to the tiff list on 13 Sep
2007.
2008-05-24 22:24:25 +00:00
Frank Warmerdam
d4099b8eee update for 4.0.0beta1 release 2008-05-18 16:25:47 +00:00
Andrey Kiselev
c87f985159 Added tifftest.h. 2008-04-15 14:19:08 +00:00
Frank Warmerdam
19fb2c9918 added rewrite_tag test 2008-01-01 13:57:21 +00:00
Bob Friesenhahn
2737e0e77b * test/images: Added a small collection of test images for use by
test programs and scripts.
* test/tiffinfo.sh: A trivial example test script.
* test/common.sh: Added small script for setting the environment
used by script-based tests.
2007-09-19 21:51:00 +00:00
Andrey Kiselev
b90b47e6f7 libtiff 3.8.2 released. 2006-03-23 14:54:00 +00:00
Bob Friesenhahn
c1961f4111 * test/Makefile.am (LIBTIFF): Due to linking against libtiff
incorrectly, tests were not actually testing the uninstalled
libtiff.  Now they are.
2006-01-08 18:57:33 +00:00
Andrey Kiselev
1d7710fbd1 *** empty log message *** 2004-10-09 18:36:47 +00:00
Andrey Kiselev
453ae1a8e4 *** empty log message *** 2004-10-01 14:16:37 +00:00
Andrey Kiselev
cdd3cd562d New tests. 2004-09-14 15:01:16 +00:00
Andrey Kiselev
ee0fe81fd0 short.tag.c test case added. 2004-09-13 10:33:57 +00:00
Andrey Kiselev
566bf7c4d8 long_tag.c test added. 2004-09-10 13:46:21 +00:00
Andrey Kiselev
570f55bb0c Added test case for ASCII tags. 2004-09-03 15:03:34 +00:00
Andrey Kiselev
6caede6c10 *** empty log message *** 2004-08-07 18:20:35 +00:00