Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(952)

Unified Diff: fpdfsdk/fpdfdoc_embeddertest.cpp

Issue 2481743004: Add FPDFDest_GetLocationInPage API (Closed)
Patch Set: Review feedback Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/fpdfdoc.cpp ('k') | fpdfsdk/fpdfdoc_unittest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/fpdfdoc_embeddertest.cpp
diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp
index 39b36c4bee8ab0cf07721021df636a5074ad4a39..16160936e6809a82a09e382b9bd960f93377e293 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"));
« no previous file with comments | « fpdfsdk/fpdfdoc.cpp ('k') | fpdfsdk/fpdfdoc_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698