mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-11 07:30:57 +00:00
Add test case for removing a page we don't have
This commit is contained in:
parent
4f305488d8
commit
2a057ac0d4
@ -111,7 +111,7 @@ $td->runtest("new stream",
|
||||
show_ntests();
|
||||
# ----------
|
||||
$td->notify("--- Page API Tests ---");
|
||||
$n_tests += 8;
|
||||
$n_tests += 9;
|
||||
|
||||
$td->runtest("basic page API",
|
||||
{$td->COMMAND => "test_driver 15 page_api_1.pdf"},
|
||||
@ -142,6 +142,10 @@ $td->runtest("duplicate page",
|
||||
{$td->COMMAND => "test_driver 19 page_api_1.pdf"},
|
||||
{$td->FILE => "page_api_1.out", $td->EXIT_STATUS => 2},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
$td->runtest("remove page we don't have",
|
||||
{$td->COMMAND => "test_driver 22 page_api_1.pdf"},
|
||||
{$td->FILE => "page_api_1.out2", $td->EXIT_STATUS => 2},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
# ----------
|
||||
$td->notify("--- Miscellaneous Tests ---");
|
||||
$n_tests += 40;
|
||||
|
1
qpdf/qtest/qpdf/page_api_1.out2
Normal file
1
qpdf/qtest/qpdf/page_api_1.out2
Normal file
@ -0,0 +1 @@
|
||||
page_api_1.pdf (page object: object 4 0): page object not referenced in /Pages tree
|
@ -826,6 +826,15 @@ void runtest(int n, char const* filename)
|
||||
contents.shallowCopy();
|
||||
std::cout << "you can't see this" << std::endl;
|
||||
}
|
||||
else if (n == 22)
|
||||
{
|
||||
// Try to remove a page we don't have
|
||||
std::vector<QPDFObjectHandle> const& pages = pdf.getAllPages();
|
||||
QPDFObjectHandle page = pages[0];
|
||||
pdf.removePage(page);
|
||||
pdf.removePage(page);
|
||||
std::cout << "you can't see this" << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(std::string("invalid test ") +
|
||||
|
Loading…
Reference in New Issue
Block a user