Home | History | Annotate | Download | only in fpdfsdk
      1 // Copyright 2016 PDFium Authors. All rights reserved.
      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/fpdf_flatten.h"
      6 #include "public/fpdfview.h"
      7 #include "testing/embedder_test.h"
      8 #include "testing/gtest/include/gtest/gtest.h"
      9 #include "testing/test_support.h"
     10 
     11 namespace {
     12 
     13 class FPDFFlattenEmbeddertest : public EmbedderTest {};
     14 
     15 }  // namespace
     16 
     17 TEST_F(FPDFFlattenEmbeddertest, FlatNothing) {
     18   EXPECT_TRUE(OpenDocument("hello_world.pdf"));
     19   FPDF_PAGE page = LoadPage(0);
     20   EXPECT_TRUE(page);
     21   EXPECT_EQ(FLATTEN_NOTHINGTODO, FPDFPage_Flatten(page, FLAT_NORMALDISPLAY));
     22   UnloadPage(page);
     23 }
     24 
     25 TEST_F(FPDFFlattenEmbeddertest, FlatNormal) {
     26   EXPECT_TRUE(OpenDocument("annotiter.pdf"));
     27   FPDF_PAGE page = LoadPage(0);
     28   EXPECT_TRUE(page);
     29   EXPECT_EQ(FLATTEN_SUCCESS, FPDFPage_Flatten(page, FLAT_NORMALDISPLAY));
     30   UnloadPage(page);
     31 }
     32 
     33 TEST_F(FPDFFlattenEmbeddertest, FlatPrint) {
     34   EXPECT_TRUE(OpenDocument("annotiter.pdf"));
     35   FPDF_PAGE page = LoadPage(0);
     36   EXPECT_TRUE(page);
     37   EXPECT_EQ(FLATTEN_SUCCESS, FPDFPage_Flatten(page, FLAT_PRINT));
     38   UnloadPage(page);
     39 }
     40