summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2015-11-09 10:22:30 -0800
committerWei Li <weili@chromium.org>2015-11-09 10:22:30 -0800
commitc0e93a9a942fe7d99800502a61d2fbb58cf9276f (patch)
treed129c72f56be283d4436b9d493d590c6b3825500 /fpdfsdk/src
parenta8f5b7b5e7501bdcfba585fc8af76c4a0fab22cb (diff)
downloadpdfium-c0e93a9a942fe7d99800502a61d2fbb58cf9276f.tar.xz
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 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fpdf_dataavail_embeddertest.cpp6
-rw-r--r--fpdfsdk/src/fpdfdoc_embeddertest.cpp12
-rw-r--r--fpdfsdk/src/fpdfformfill_embeddertest.cpp16
-rw-r--r--fpdfsdk/src/fpdftext_embeddertest.cpp10
-rw-r--r--fpdfsdk/src/fpdfview_embeddertest.cpp22
5 files changed, 33 insertions, 33 deletions
diff --git a/fpdfsdk/src/fpdf_dataavail_embeddertest.cpp b/fpdfsdk/src/fpdf_dataavail_embeddertest.cpp
index ee4c3e6104..222fdc4be2 100644
--- a/fpdfsdk/src/fpdf_dataavail_embeddertest.cpp
+++ b/fpdfsdk/src/fpdf_dataavail_embeddertest.cpp
@@ -2,21 +2,21 @@
// 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 "public/fpdf_doc.h"
#include "public/fpdfview.h"
+#include "testing/embedder_test.h"
#include "testing/gtest/include/gtest/gtest.h"
class FPDFDataAvailEmbeddertest : public EmbedderTest {};
TEST_F(FPDFDataAvailEmbeddertest, TrailerUnterminated) {
// Document must load without crashing but is too malformed to be available.
- EXPECT_FALSE(OpenDocument("testing/resources/trailer_unterminated.pdf"));
+ EXPECT_FALSE(OpenDocument("trailer_unterminated.pdf"));
EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_));
}
TEST_F(FPDFDataAvailEmbeddertest, TrailerAsHexstring) {
// Document must load without crashing but is too malformed to be available.
- EXPECT_FALSE(OpenDocument("testing/resources/trailer_as_hexstring.pdf"));
+ EXPECT_FALSE(OpenDocument("trailer_as_hexstring.pdf"));
EXPECT_FALSE(FPDFAvail_IsDocAvail(avail_, &hints_));
}
diff --git a/fpdfsdk/src/fpdfdoc_embeddertest.cpp b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
index 99442f31df..6435704cb2 100644
--- a/fpdfsdk/src/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
@@ -2,17 +2,17 @@
// 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/fx_string_testhelpers.h"
#include "core/include/fxcrt/fx_string.h"
#include "public/fpdf_doc.h"
#include "public/fpdfview.h"
+#include "testing/embedder_test.h"
+#include "testing/fx_string_testhelpers.h"
#include "testing/gtest/include/gtest/gtest.h"
class FPDFDocEmbeddertest : public EmbedderTest {};
TEST_F(FPDFDocEmbeddertest, DestGetPageIndex) {
- EXPECT_TRUE(OpenDocument("testing/resources/named_dests.pdf"));
+ EXPECT_TRUE(OpenDocument("named_dests.pdf"));
// NULL FPDF_DEST case.
EXPECT_EQ(0U, FPDFDest_GetPageIndex(document(), nullptr));
@@ -39,7 +39,7 @@ TEST_F(FPDFDocEmbeddertest, DestGetPageIndex) {
}
TEST_F(FPDFDocEmbeddertest, ActionGetFilePath) {
- EXPECT_TRUE(OpenDocument("testing/resources/launch_action.pdf"));
+ EXPECT_TRUE(OpenDocument("launch_action.pdf"));
FPDF_PAGE page = FPDF_LoadPage(document(), 0);
ASSERT_TRUE(page);
@@ -65,7 +65,7 @@ TEST_F(FPDFDocEmbeddertest, ActionGetFilePath) {
TEST_F(FPDFDocEmbeddertest, NoBookmarks) {
// Open a file with no bookmarks.
- EXPECT_TRUE(OpenDocument("testing/resources/named_dests.pdf"));
+ EXPECT_TRUE(OpenDocument("named_dests.pdf"));
// The non-existent top-level bookmark has no title.
unsigned short buf[128];
@@ -77,7 +77,7 @@ TEST_F(FPDFDocEmbeddertest, NoBookmarks) {
TEST_F(FPDFDocEmbeddertest, Bookmarks) {
// Open a file with two bookmarks.
- EXPECT_TRUE(OpenDocument("testing/resources/bookmarks.pdf"));
+ EXPECT_TRUE(OpenDocument("bookmarks.pdf"));
// The existent top-level bookmark has no title.
unsigned short buf[128];
diff --git a/fpdfsdk/src/fpdfformfill_embeddertest.cpp b/fpdfsdk/src/fpdfformfill_embeddertest.cpp
index f6d444abed..aae6ea7f77 100644
--- a/fpdfsdk/src/fpdfformfill_embeddertest.cpp
+++ b/fpdfsdk/src/fpdfformfill_embeddertest.cpp
@@ -2,10 +2,10 @@
// 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/embedder_test_mock_delegate.h"
-#include "../../testing/embedder_test_timer_handling_delegate.h"
#include "public/fpdf_formfill.h"
+#include "testing/embedder_test.h"
+#include "testing/embedder_test_mock_delegate.h"
+#include "testing/embedder_test_timer_handling_delegate.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -22,7 +22,7 @@ TEST_F(FPDFFormFillEmbeddertest, FirstTest) {
EXPECT_CALL(mock, KillTimer(_)).Times(0);
SetDelegate(&mock);
- EXPECT_TRUE(OpenDocument("testing/resources/hello_world.pdf"));
+ EXPECT_TRUE(OpenDocument("hello_world.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
UnloadPage(page);
@@ -32,7 +32,7 @@ TEST_F(FPDFFormFillEmbeddertest, BUG_487928) {
EmbedderTestTimerHandlingDelegate delegate;
SetDelegate(&delegate);
- EXPECT_TRUE(OpenDocument("testing/resources/bug_487928.pdf"));
+ EXPECT_TRUE(OpenDocument("bug_487928.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
DoOpenActions();
@@ -44,7 +44,7 @@ TEST_F(FPDFFormFillEmbeddertest, BUG_507316) {
EmbedderTestTimerHandlingDelegate delegate;
SetDelegate(&delegate);
- EXPECT_TRUE(OpenDocument("testing/resources/bug_507316.pdf"));
+ EXPECT_TRUE(OpenDocument("bug_507316.pdf"));
FPDF_PAGE page = LoadAndCachePage(2);
EXPECT_NE(nullptr, page);
DoOpenActions();
@@ -53,7 +53,7 @@ TEST_F(FPDFFormFillEmbeddertest, BUG_507316) {
}
TEST_F(FPDFFormFillEmbeddertest, BUG_514690) {
- EXPECT_TRUE(OpenDocument("testing/resources/hello_world.pdf"));
+ EXPECT_TRUE(OpenDocument("hello_world.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
@@ -68,7 +68,7 @@ TEST_F(FPDFFormFillEmbeddertest, BUG_551248) {
EmbedderTestTimerHandlingDelegate delegate;
SetDelegate(&delegate);
- EXPECT_TRUE(OpenDocument("testing/resources/bug_551248.pdf"));
+ EXPECT_TRUE(OpenDocument("bug_551248.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
DoOpenActions();
diff --git a/fpdfsdk/src/fpdftext_embeddertest.cpp b/fpdfsdk/src/fpdftext_embeddertest.cpp
index 52cec7028a..6c1ae4ceb8 100644
--- a/fpdfsdk/src/fpdftext_embeddertest.cpp
+++ b/fpdfsdk/src/fpdftext_embeddertest.cpp
@@ -2,9 +2,9 @@
// 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 "public/fpdf_text.h"
#include "public/fpdfview.h"
+#include "testing/embedder_test.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -28,7 +28,7 @@ static bool check_unsigned_shorts(const char* expected,
class FPDFTextEmbeddertest : public EmbedderTest {};
TEST_F(FPDFTextEmbeddertest, Text) {
- EXPECT_TRUE(OpenDocument("testing/resources/hello_world.pdf"));
+ EXPECT_TRUE(OpenDocument("hello_world.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
@@ -136,7 +136,7 @@ TEST_F(FPDFTextEmbeddertest, Text) {
}
TEST_F(FPDFTextEmbeddertest, TextSearch) {
- EXPECT_TRUE(OpenDocument("testing/resources/hello_world.pdf"));
+ EXPECT_TRUE(OpenDocument("hello_world.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
@@ -243,7 +243,7 @@ TEST_F(FPDFTextEmbeddertest, TextSearch) {
// Test that the page has characters despite a bad stream length.
TEST_F(FPDFTextEmbeddertest, StreamLengthPastEndOfFile) {
- EXPECT_TRUE(OpenDocument("testing/resources/bug_57.pdf"));
+ EXPECT_TRUE(OpenDocument("bug_57.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
@@ -256,7 +256,7 @@ TEST_F(FPDFTextEmbeddertest, StreamLengthPastEndOfFile) {
}
TEST_F(FPDFTextEmbeddertest, WebLinks) {
- EXPECT_TRUE(OpenDocument("testing/resources/weblinks.pdf"));
+ EXPECT_TRUE(OpenDocument("weblinks.pdf"));
FPDF_PAGE page = LoadPage(0);
EXPECT_NE(nullptr, page);
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 <limits>
#include <string>
-#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"));
}