Commit b97a43e0912f44c59a83e02b9c0ca60352e2466e

Authored by Jay Berkenbilt
1 parent 4630b856

Add additional testing around improved array wrapping

Showing 1 changed file with 9 additions and 0 deletions
qpdf/qpdf-ctest.c
@@ -536,6 +536,9 @@ static void test24(char const* infile, @@ -536,6 +536,9 @@ static void test24(char const* infile,
536 for (int i = 0; i < 4; ++i) 536 for (int i = 0; i < 4; ++i)
537 { 537 {
538 qpdf_oh item = qpdf_oh_get_array_item(qpdf, mediabox, i); 538 qpdf_oh item = qpdf_oh_get_array_item(qpdf, mediabox, i);
  539 + qpdf_oh item2 = qpdf_oh_get_array_item(qpdf, wrapped_mediabox, i);
  540 + assert(qpdf_oh_get_int_value_as_int(qpdf, item) ==
  541 + qpdf_oh_get_int_value_as_int(qpdf, item2));
539 printf("item %d: %d %.2f\n", 542 printf("item %d: %d %.2f\n",
540 i, qpdf_oh_get_int_value_as_int(qpdf, item), 543 i, qpdf_oh_get_int_value_as_int(qpdf, item),
541 qpdf_oh_get_numeric_value(qpdf, item)); 544 qpdf_oh_get_numeric_value(qpdf, item));
@@ -571,6 +574,12 @@ static void test24(char const* infile, @@ -571,6 +574,12 @@ static void test24(char const* infile,
571 assert(qpdf_oh_get_object_id( 574 assert(qpdf_oh_get_object_id(
572 qpdf, qpdf_oh_get_array_item(qpdf, contents_array, 0)) == 575 qpdf, qpdf_oh_get_array_item(qpdf, contents_array, 0)) ==
573 qpdf_oh_get_object_id(qpdf, contents)); 576 qpdf_oh_get_object_id(qpdf, contents));
  577 + qpdf_oh wrapped_contents_array =
  578 + qpdf_oh_wrap_in_array(qpdf, contents_array);
  579 + assert(qpdf_oh_get_array_n_items(qpdf, wrapped_contents_array) == 1);
  580 + assert(qpdf_oh_get_object_id(
  581 + qpdf, qpdf_oh_get_array_item(qpdf, wrapped_contents_array, 0)) ==
  582 + qpdf_oh_get_object_id(qpdf, contents));
574 qpdf_oh resources = qpdf_oh_get_key(qpdf, page1, "/Resources"); 583 qpdf_oh resources = qpdf_oh_get_key(qpdf, page1, "/Resources");
575 qpdf_oh procset = qpdf_oh_get_key(qpdf, resources, "/ProcSet"); 584 qpdf_oh procset = qpdf_oh_get_key(qpdf, resources, "/ProcSet");
576 assert(strcmp(qpdf_oh_unparse(qpdf, procset), 585 assert(strcmp(qpdf_oh_unparse(qpdf, procset),