xref: /aosp_15_r20/external/pdfium/core/fxge/fx_ge_text_embeddertest.cpp (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2016 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 "public/cpp/fpdf_scopers.h"
6 #include "testing/embedder_test.h"
7 #include "testing/embedder_test_environment.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 
10 class FXGETextEmbedderTest : public EmbedderTest {
11  public:
TearDown()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 };
22 
TEST_F(FXGETextEmbedderTest,BadItalic)23 TEST_F(FXGETextEmbedderTest, BadItalic) {
24   // Shouldn't crash.
25   ASSERT_TRUE(OpenDocument("bug_601362.pdf"));
26   FPDF_PAGE page = LoadPage(0);
27   ASSERT_TRUE(page);
28   ScopedFPDFBitmap bitmap = RenderLoadedPage(page);
29   EXPECT_EQ(612, FPDFBitmap_GetWidth(bitmap.get()));
30   EXPECT_EQ(792, FPDFBitmap_GetHeight(bitmap.get()));
31   UnloadPage(page);
32 }
33