diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-01-16 08:55:17 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-01-16 08:55:17 -0800 |
commit | 74b91b279d0dee175c2e461ffa4fcc7fe5002a6e (patch) | |
tree | 7291f9199291a54fe4649627ccb5b7ad44a65b30 /fpdfsdk | |
parent | 624b166d4f50874f93c6d0824e91cd5b955c0487 (diff) | |
download | pdfium-74b91b279d0dee175c2e461ffa4fcc7fe5002a6e.tar.xz |
Follow-on to pdfium_embeddertests.
This includes:
- Fix TestLoader lifetime.
- Rename test file to match the equivalent .cpp under test
- Re-organize a few tests to avoid duplicate loading
- add tests for a few additional functions.
R=jam@chromium.org
Review URL: https://codereview.chromium.org/857483005
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/src/fpdfview_embeddertest.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/fpdfsdk/src/fpdfview_embeddertest.cpp b/fpdfsdk/src/fpdfview_embeddertest.cpp new file mode 100644 index 0000000000..94a51094a8 --- /dev/null +++ b/fpdfsdk/src/fpdfview_embeddertest.cpp @@ -0,0 +1,42 @@ +// Copyright 2015 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "../../testing/embedder_test.h" +#include "testing/gtest/include/gtest/gtest.h" + +class FPDFViewEmbeddertest : public EmbedderTest { +}; + +TEST_F(FPDFViewEmbeddertest, Document) { + EXPECT_TRUE(OpenDocument("testing/resources/about_blank.pdf")); + EXPECT_EQ(1, GetPageCount()); + EXPECT_EQ(0, GetFirstPageNum()); + + int version; + EXPECT_TRUE(FPDF_GetFileVersion(document(), &version)); + EXPECT_EQ(14, version); + + EXPECT_EQ(0xFFFFFFFF, FPDF_GetDocPermissions(document())); + EXPECT_EQ(-1, FPDF_GetSecurityHandlerRevision(document())); +} + +TEST_F(FPDFViewEmbeddertest, Page) { + EXPECT_TRUE(OpenDocument("testing/resources/about_blank.pdf")); + FPDF_FORMHANDLE form_handle = SetFormFillEnvironment(); + FPDF_PAGE page = LoadPage(0, form_handle); + EXPECT_NE(nullptr, page); + EXPECT_EQ(612.0, FPDF_GetPageWidth(page)); + EXPECT_EQ(792.0, FPDF_GetPageHeight(page)); + UnloadPage(page, form_handle); + EXPECT_EQ(nullptr, LoadPage(1, form_handle)); + ClearFormFillEnvironment(form_handle); +} + +TEST_F(FPDFViewEmbeddertest, ViewerRef) { + EXPECT_TRUE(OpenDocument("testing/resources/about_blank.pdf")); + EXPECT_TRUE(FPDF_VIEWERREF_GetPrintScaling(document())); + EXPECT_EQ(1, FPDF_VIEWERREF_GetNumCopies(document())); + EXPECT_EQ(DuplexUndefined, FPDF_VIEWERREF_GetDuplex(document())); +} + |