From 091f7a070d58e1f8de6bbfdc5b60e1cef84e58c3 Mon Sep 17 00:00:00 2001 From: Wei Li Date: Mon, 9 Nov 2015 12:09:55 -0800 Subject: Merge to XFA: Add path service to retrieve test data directory at run time so tests can be run from any directory. Previously the tests which read test files assume the current directory is under pdfium. Running from any other directory will break the build. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1408003014 . (cherry picked from commit c0e93a9a942fe7d99800502a61d2fbb58cf9276f) Conflicts: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser_embeddertest.cpp fpdfsdk/src/fpdfdoc_embeddertest.cpp testing/embedder_test.cpp testing/embedder_test.h Review URL: https://codereview.chromium.org/1411403012 . --- fpdfsdk/src/fpdfview_embeddertest.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'fpdfsdk/src/fpdfview_embeddertest.cpp') diff --git a/fpdfsdk/src/fpdfview_embeddertest.cpp b/fpdfsdk/src/fpdfview_embeddertest.cpp index 2a00193a5e..35da9b6caf 100644 --- a/fpdfsdk/src/fpdfview_embeddertest.cpp +++ b/fpdfsdk/src/fpdfview_embeddertest.cpp @@ -5,9 +5,9 @@ #include #include -#include "../../testing/embedder_test.h" -#include "fpdfview_c_api_test.h" +#include "fpdfsdk/src/fpdfview_c_api_test.h" #include "public/fpdfview.h" +#include "testing/embedder_test.h" #include "testing/gtest/include/gtest/gtest.h" TEST(fpdf, CApiTest) { @@ -17,7 +17,7 @@ TEST(fpdf, CApiTest) { class FPDFViewEmbeddertest : public EmbedderTest {}; TEST_F(FPDFViewEmbeddertest, Document) { - EXPECT_TRUE(OpenDocument("testing/resources/about_blank.pdf")); + EXPECT_TRUE(OpenDocument("about_blank.pdf")); EXPECT_EQ(1, GetPageCount()); EXPECT_EQ(0, GetFirstPageNum()); @@ -30,7 +30,7 @@ TEST_F(FPDFViewEmbeddertest, Document) { } TEST_F(FPDFViewEmbeddertest, Page) { - EXPECT_TRUE(OpenDocument("testing/resources/about_blank.pdf")); + EXPECT_TRUE(OpenDocument("about_blank.pdf")); FPDF_PAGE page = LoadPage(0); EXPECT_NE(nullptr, page); EXPECT_EQ(612.0, FPDF_GetPageWidth(page)); @@ -40,14 +40,14 @@ TEST_F(FPDFViewEmbeddertest, Page) { } TEST_F(FPDFViewEmbeddertest, ViewerRef) { - EXPECT_TRUE(OpenDocument("testing/resources/about_blank.pdf")); + EXPECT_TRUE(OpenDocument("about_blank.pdf")); EXPECT_TRUE(FPDF_VIEWERREF_GetPrintScaling(document())); EXPECT_EQ(1, FPDF_VIEWERREF_GetNumCopies(document())); EXPECT_EQ(DuplexUndefined, FPDF_VIEWERREF_GetDuplex(document())); } TEST_F(FPDFViewEmbeddertest, NamedDests) { - EXPECT_TRUE(OpenDocument("testing/resources/named_dests.pdf")); + EXPECT_TRUE(OpenDocument("named_dests.pdf")); long buffer_size; char fixed_buffer[512]; FPDF_DEST dest; @@ -142,7 +142,7 @@ TEST_F(FPDFViewEmbeddertest, NamedDests) { } TEST_F(FPDFViewEmbeddertest, NamedDestsByName) { - EXPECT_TRUE(OpenDocument("testing/resources/named_dests.pdf")); + EXPECT_TRUE(OpenDocument("named_dests.pdf")); // Null pointer returns NULL. FPDF_DEST dest = FPDF_GetNamedDestByName(document(), nullptr); @@ -180,16 +180,16 @@ TEST_F(FPDFViewEmbeddertest, NamedDestsByName) { // The following tests pass if the document opens without crashing. TEST_F(FPDFViewEmbeddertest, Crasher_113) { - EXPECT_TRUE(OpenDocument("testing/resources/bug_113.pdf")); + EXPECT_TRUE(OpenDocument("bug_113.pdf")); } TEST_F(FPDFViewEmbeddertest, Crasher_451830) { // Document is damaged and can't be opened. - EXPECT_FALSE(OpenDocument("testing/resources/bug_451830.pdf")); + EXPECT_FALSE(OpenDocument("bug_451830.pdf")); } TEST_F(FPDFViewEmbeddertest, Crasher_452455) { - EXPECT_TRUE(OpenDocument("testing/resources/bug_452455.pdf")); + EXPECT_TRUE(OpenDocument("bug_452455.pdf")); FPDF_PAGE page = LoadPage(0); EXPECT_NE(nullptr, page); UnloadPage(page); @@ -197,5 +197,5 @@ TEST_F(FPDFViewEmbeddertest, Crasher_452455) { TEST_F(FPDFViewEmbeddertest, Crasher_454695) { // Document is damanged and can't be opened. - EXPECT_FALSE(OpenDocument("testing/resources/bug_454695.pdf")); + EXPECT_FALSE(OpenDocument("bug_454695.pdf")); } -- cgit v1.2.3