From b97a43e0912f44c59a83e02b9c0ca60352e2466e Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 19 Nov 2021 13:33:10 -0500 Subject: [PATCH] Add additional testing around improved array wrapping --- qpdf/qpdf-ctest.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qpdf/qpdf-ctest.c b/qpdf/qpdf-ctest.c index c954a64d..9557d522 100644 --- a/qpdf/qpdf-ctest.c +++ b/qpdf/qpdf-ctest.c @@ -536,6 +536,9 @@ static void test24(char const* infile, for (int i = 0; i < 4; ++i) { qpdf_oh item = qpdf_oh_get_array_item(qpdf, mediabox, i); + qpdf_oh item2 = qpdf_oh_get_array_item(qpdf, wrapped_mediabox, i); + assert(qpdf_oh_get_int_value_as_int(qpdf, item) == + qpdf_oh_get_int_value_as_int(qpdf, item2)); printf("item %d: %d %.2f\n", i, qpdf_oh_get_int_value_as_int(qpdf, item), qpdf_oh_get_numeric_value(qpdf, item)); @@ -571,6 +574,12 @@ static void test24(char const* infile, assert(qpdf_oh_get_object_id( qpdf, qpdf_oh_get_array_item(qpdf, contents_array, 0)) == qpdf_oh_get_object_id(qpdf, contents)); + qpdf_oh wrapped_contents_array = + qpdf_oh_wrap_in_array(qpdf, contents_array); + assert(qpdf_oh_get_array_n_items(qpdf, wrapped_contents_array) == 1); + assert(qpdf_oh_get_object_id( + qpdf, qpdf_oh_get_array_item(qpdf, wrapped_contents_array, 0)) == + qpdf_oh_get_object_id(qpdf, contents)); qpdf_oh resources = qpdf_oh_get_key(qpdf, page1, "/Resources"); qpdf_oh procset = qpdf_oh_get_key(qpdf, resources, "/ProcSet"); assert(strcmp(qpdf_oh_unparse(qpdf, procset),