diff options
author | Jay Berkenbilt <ejb@ql.org> | 2017-12-25 16:27:45 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2017-12-26 00:20:52 +0100 |
commit | 4edfe1f41d386c0fa6043926d761219bdb29e7c0 (patch) | |
tree | dbc7a303c88226360788db0ee3373dcde99910da /libtests/png_filter.cc | |
parent | 38bdbc071973f833cee81508b68737506f138017 (diff) | |
download | qpdf-4edfe1f41d386c0fa6043926d761219bdb29e7c0.tar.zst |
Add tests for new PNG filters
Diffstat (limited to 'libtests/png_filter.cc')
-rw-r--r-- | libtests/png_filter.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libtests/png_filter.cc b/libtests/png_filter.cc index 6a4f676c..7494cb7a 100644 --- a/libtests/png_filter.cc +++ b/libtests/png_filter.cc @@ -8,7 +8,8 @@ #include <string.h> #include <stdlib.h> -void run(char const* filename, bool encode, unsigned int columns) +void run(char const* filename, bool encode, unsigned int columns, + int bits_per_sample, int samples_per_pixel) { // Decode the file FILE* in = QUtil::safe_fopen(filename, "rb"); @@ -17,7 +18,7 @@ void run(char const* filename, bool encode, unsigned int columns) Pipeline* pl = new Pl_PNGFilter( "png", out, encode ? Pl_PNGFilter::a_encode : Pl_PNGFilter::a_decode, - columns); + columns, samples_per_pixel, bits_per_sample); assert((2 * (columns + 1)) < 1024); unsigned char buf[1024]; size_t len; @@ -54,18 +55,22 @@ void run(char const* filename, bool encode, unsigned int columns) int main(int argc, char* argv[]) { - if (argc != 4) + if (argc != 6) { - std::cerr << "Usage: pipeline {en,de}code filename columns" << std::endl; + std::cerr << "Usage: png_filter {en,de}code filename" + << " columns samples-per-pixel bits-per-sample" + << std::endl; exit(2); } bool encode = (strcmp(argv[1], "encode") == 0); char* filename = argv[2]; int columns = QUtil::string_to_int(argv[3]); + int samples_per_pixel = QUtil::string_to_int(argv[4]); + int bits_per_sample = QUtil::string_to_int(argv[5]); try { - run(filename, encode, columns); + run(filename, encode, columns, bits_per_sample, samples_per_pixel); } catch (std::exception& e) { |