Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
fpdf_parser_decode_embeddertest.cpp
Go to the documentation of this file.
1// Copyright 2015 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "build/build_config.h"
6#include "core/fpdfapi/parser/fpdf_parser_decode.h"
7#include "public/cpp/fpdf_scopers.h"
8#include "testing/embedder_test.h"
9#include "testing/embedder_test_constants.h"
10#include "testing/gtest/include/gtest/gtest.h"
11#include "testing/test_support.h"
12
13using FPDFParserDecodeEmbedderTest = EmbedderTest;
14using pdfium::kBlankPage612By792Checksum;
15
16TEST_F(FPDFParserDecodeEmbedderTest, Bug552046) {
17 // Tests specifying multiple image filters for a stream. Should not cause a
18 // crash when rendered.
19 ASSERT_TRUE(OpenDocument("bug_552046.pdf"));
20 FPDF_PAGE page = LoadPage(0);
21 ASSERT_TRUE(page);
22 ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
23 CompareBitmap(bitmap.get(), 612, 792, kBlankPage612By792Checksum);
24 UnloadPage(page);
25}
26
27TEST_F(FPDFParserDecodeEmbedderTest, Bug555784) {
28 // Tests bad input to the run length decoder that caused a heap overflow.
29 // Should not cause a crash when rendered.
30 ASSERT_TRUE(OpenDocument("bug_555784.pdf"));
31 FPDF_PAGE page = LoadPage(0);
32 ASSERT_TRUE(page);
33 ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
34 CompareBitmap(bitmap.get(), 612, 792, kBlankPage612By792Checksum);
35 UnloadPage(page);
36}
37
38TEST_F(FPDFParserDecodeEmbedderTest, Bug455199) {
39 // Tests object numbers with a value > 01000000.
40 // Should open successfully.
41 ASSERT_TRUE(OpenDocument("bug_455199.pdf"));
42 FPDF_PAGE page = LoadPage(0);
43 ASSERT_TRUE(page);
44 ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
45
46 CompareBitmap(bitmap.get(), 200, 200, pdfium::HelloWorldChecksum());
47 UnloadPage(page);
48}
TEST_F(FPDFParserDecodeEmbedderTest, Bug552046)
const char kBlankPage612By792Checksum[]
const char * HelloWorldChecksum()