summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfdoc_embeddertest.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-08 06:55:40 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-08 06:55:40 -0800
commitc59fa8895fa6fa8428b9b278eee6f05478ab8f56 (patch)
tree3216ee06e894144d578c07e5c655b7637bb6c59c /fpdfsdk/fpdfdoc_embeddertest.cpp
parent3c669a7fb05dfb602992a5d2333081daef6f002f (diff)
downloadpdfium-c59fa8895fa6fa8428b9b278eee6f05478ab8f56.tar.xz
Add FPDFDest_GetLocationInPage API
Add an API to get the value of the /XYZ destination parameter. This CL was originally from https://codereview.chromium.org/1960193003/ by halcanary@. Review-Url: https://codereview.chromium.org/2481743004
Diffstat (limited to 'fpdfsdk/fpdfdoc_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdfdoc_embeddertest.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp
index 39b36c4bee..16160936e6 100644
--- a/fpdfsdk/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/fpdfdoc_embeddertest.cpp
@@ -42,6 +42,31 @@ TEST_F(FPDFDocEmbeddertest, DestGetPageIndex) {
EXPECT_EQ(0U, FPDFDest_GetPageIndex(document(), dest));
}
+TEST_F(FPDFDocEmbeddertest, DestGetLocationInPage) {
+ EXPECT_TRUE(OpenDocument("named_dests.pdf"));
+
+ // NULL FPDF_DEST case.
+ EXPECT_EQ(0U, FPDFDest_GetPageIndex(document(), nullptr));
+
+ FPDF_DEST dest = FPDF_GetNamedDestByName(document(), "First");
+ EXPECT_TRUE(dest);
+
+ FPDF_BOOL hasX;
+ FPDF_BOOL hasY;
+ FPDF_BOOL hasZoom;
+ FS_FLOAT x;
+ FS_FLOAT y;
+ FS_FLOAT zoom;
+ EXPECT_TRUE(
+ FPDFDest_GetLocationInPage(dest, &hasX, &hasY, &hasZoom, &x, &y, &zoom));
+ EXPECT_TRUE(hasX);
+ EXPECT_TRUE(hasY);
+ EXPECT_TRUE(hasZoom);
+ EXPECT_EQ(0, x);
+ EXPECT_EQ(0, y);
+ EXPECT_EQ(1, zoom);
+}
+
TEST_F(FPDFDocEmbeddertest, ActionGetFilePath) {
EXPECT_TRUE(OpenDocument("launch_action.pdf"));