mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
Add test cases for parsing an empty file and a truncated file.
This commit is contained in:
parent
07a557194c
commit
d8013f9c3a
Notes:
sideshowbarker
2024-07-17 21:25:11 +09:00
Author: https://github.com/swoertz Commit: https://github.com/SerenityOS/serenity/commit/d8013f9c3a4 Pull-request: https://github.com/SerenityOS/serenity/pull/10969 Issue: https://github.com/SerenityOS/serenity/issues/8215 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/BenWiederhake Reviewed-by: https://github.com/bcoles Reviewed-by: https://github.com/linusg
1 changed files with 16 additions and 0 deletions
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/MappedFile.h>
|
||||
#include <LibPDF/Document.h>
|
||||
#include <LibTest/Macros.h>
|
||||
|
@ -29,3 +31,17 @@ TEST_CASE(complex_pdf)
|
|||
auto document = PDF::Document::create(file->bytes());
|
||||
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
Reference in a new issue