blob: a8915fe60ce7e0e0fedb12916fa52096435efdbc [file] [log] [blame]
tsepezd0ecd892016-11-08 17:30:04 -08001// 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
tsepezd0ecd892016-11-08 17:30:04 -08005#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
11namespace {
12
13class FPDFFlattenEmbeddertest : public EmbedderTest {};
14
15} // namespace
16
17TEST_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
25TEST_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
33TEST_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}