tsepez | d0ecd89 | 2016-11-08 17:30:04 -0800 | [diff] [blame^] | 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 "core/fxcrt/fx_basic.h" |
| 6 | #include "public/fpdf_flatten.h" |
| 7 | #include "public/fpdfview.h" |
| 8 | #include "testing/embedder_test.h" |
| 9 | #include "testing/gtest/include/gtest/gtest.h" |
| 10 | #include "testing/test_support.h" |
| 11 | |
| 12 | namespace { |
| 13 | |
| 14 | class FPDFFlattenEmbeddertest : public EmbedderTest {}; |
| 15 | |
| 16 | } // namespace |
| 17 | |
| 18 | TEST_F(FPDFFlattenEmbeddertest, FlatNothing) { |
| 19 | EXPECT_TRUE(OpenDocument("hello_world.pdf")); |
| 20 | FPDF_PAGE page = LoadPage(0); |
| 21 | EXPECT_TRUE(page); |
| 22 | EXPECT_EQ(FLATTEN_NOTHINGTODO, FPDFPage_Flatten(page, FLAT_NORMALDISPLAY)); |
| 23 | UnloadPage(page); |
| 24 | } |
| 25 | |
| 26 | TEST_F(FPDFFlattenEmbeddertest, FlatNormal) { |
| 27 | EXPECT_TRUE(OpenDocument("annotiter.pdf")); |
| 28 | FPDF_PAGE page = LoadPage(0); |
| 29 | EXPECT_TRUE(page); |
| 30 | EXPECT_EQ(FLATTEN_SUCCESS, FPDFPage_Flatten(page, FLAT_NORMALDISPLAY)); |
| 31 | UnloadPage(page); |
| 32 | } |
| 33 | |
| 34 | TEST_F(FPDFFlattenEmbeddertest, FlatPrint) { |
| 35 | EXPECT_TRUE(OpenDocument("annotiter.pdf")); |
| 36 | FPDF_PAGE page = LoadPage(0); |
| 37 | EXPECT_TRUE(page); |
| 38 | EXPECT_EQ(FLATTEN_SUCCESS, FPDFPage_Flatten(page, FLAT_PRINT)); |
| 39 | UnloadPage(page); |
| 40 | } |