diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-02-07 22:54:16 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-02-08 01:41:34 +0100 |
commit | 553ac7f353c7043806ec0de70d8630f5cd0a7bb8 (patch) | |
tree | 245fe2d4882377c894c00c00071834dc7152c269 /libtests/qutil.cc | |
parent | efdd46da5117353abf1eda3625221f15c0ea128a (diff) | |
download | qpdf-553ac7f353c7043806ec0de70d8630f5cd0a7bb8.tar.zst |
Add QUtil::pipe_file and QUtil::file_provider
Diffstat (limited to 'libtests/qutil.cc')
-rw-r--r-- | libtests/qutil.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libtests/qutil.cc b/libtests/qutil.cc index abfefce0..bc12a6ea 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -6,6 +6,7 @@ #include <qpdf/QUtil.hh> #include <qpdf/PointerHolder.hh> #include <qpdf/QPDFSystemError.hh> +#include <qpdf/Pl_Buffer.hh> #include <string.h> #include <limits.h> #include <assert.h> @@ -483,6 +484,12 @@ void read_from_file_test() assert(memcmp(p, "This file is used for qutil testing.", 36) == 0); assert(p[59] == static_cast<char>(13)); assert(memcmp(p + 24641, "very long.", 10) == 0); + Pl_Buffer b2("buffer"); + // QUtil::file_provider also exercises QUtil::pipe_file + QUtil::file_provider("other-file")(&b2); + auto buf2 = b2.getBuffer(); + assert(buf2->getSize() == size); + assert(memcmp(buf2->getBuffer(), p, size) == 0); } void assert_hex_encode(std::string const& input, std::string const& expected) |