mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
Add test cases for parsing an empty file and a truncated file.
This commit is contained in:
parent
07a557194c
commit
d8013f9c3a
1 changed files with 16 additions and 0 deletions
|
@ -4,6 +4,8 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <AK/Forward.h>
|
||||||
|
#include <AK/String.h>
|
||||||
#include <LibCore/MappedFile.h>
|
#include <LibCore/MappedFile.h>
|
||||||
#include <LibPDF/Document.h>
|
#include <LibPDF/Document.h>
|
||||||
#include <LibTest/Macros.h>
|
#include <LibTest/Macros.h>
|
||||||
|
@ -29,3 +31,17 @@ TEST_CASE(complex_pdf)
|
||||||
auto document = PDF::Document::create(file->bytes());
|
auto document = PDF::Document::create(file->bytes());
|
||||||
EXPECT_EQ(document->get_page_count(), 3U);
|
EXPECT_EQ(document->get_page_count(), 3U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE(empty_file_issue_10702)
|
||||||
|
{
|
||||||
|
AK::ReadonlyBytes empty;
|
||||||
|
auto document = PDF::Document::create(empty);
|
||||||
|
EXPECT(document.is_null());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE(truncated_pdf_header_issue_10717)
|
||||||
|
{
|
||||||
|
AK::String string { "%PDF-2.11%" };
|
||||||
|
auto document = PDF::Document::create(string.bytes());
|
||||||
|
EXPECT(document.is_null());
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue