blob: 9a79620a74961502dd28fa3a832a3f1ad937c581 [file] [log] [blame]
kumarashishg826308d2023-06-23 13:21:22 +00001// Copyright 2016 The PDFium Authors
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Haibo Huang49cc9302020-04-27 16:14:24 -07005#include "public/cpp/fpdf_scopers.h"
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -07006#include "testing/embedder_test.h"
kumarashishg826308d2023-06-23 13:21:22 +00007#include "testing/embedder_test_environment.h"
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -07008#include "testing/gtest/include/gtest/gtest.h"
9
kumarashishg826308d2023-06-23 13:21:22 +000010class FXGETextEmbedderTest : public EmbedderTest {
11 public:
12 void TearDown() override {
13 EmbedderTest::TearDown();
14
15 // TODO(tsepez): determine how this is changing the environment,
16 // such that FPDFAnnotEmbedderTest.BUG_1206 will diff if run
17 // after this.
18 EmbedderTestEnvironment::GetInstance()->TearDown();
19 EmbedderTestEnvironment::GetInstance()->SetUp();
20 }
21};
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070022
23TEST_F(FXGETextEmbedderTest, BadItalic) {
24 // Shouldn't crash.
kumarashishg826308d2023-06-23 13:21:22 +000025 ASSERT_TRUE(OpenDocument("bug_601362.pdf"));
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070026 FPDF_PAGE page = LoadPage(0);
Haibo Huang49cc9302020-04-27 16:14:24 -070027 ASSERT_TRUE(page);
28 ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
29 EXPECT_EQ(612, FPDFBitmap_GetWidth(bitmap.get()));
30 EXPECT_EQ(792, FPDFBitmap_GetHeight(bitmap.get()));
Philip P. Moltmann4d3acf42017-03-20 11:05:52 -070031 UnloadPage(page);
32}