summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdfdoc_embeddertest.cpp55
-rw-r--r--testing/resources/bug_821454.in75
-rw-r--r--testing/resources/bug_821454.pdf96
3 files changed, 226 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp
index 7cd27751e7..07b83263be 100644
--- a/fpdfsdk/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/fpdfdoc_embeddertest.cpp
@@ -143,6 +143,61 @@ TEST_F(FPDFDocEmbeddertest, BUG_680376) {
EXPECT_EQ(-1, FPDFDest_GetDestPageIndex(document(), dest));
}
+TEST_F(FPDFDocEmbeddertest, BUG_821454) {
+ EXPECT_TRUE(OpenDocument("bug_821454.pdf"));
+
+ FPDF_PAGE page = LoadPage(0);
+ ASSERT_TRUE(page);
+
+ FPDF_LINK link1 = FPDFLink_GetLinkAtPoint(page, 150, 360);
+ ASSERT_TRUE(link1);
+ FPDF_LINK link2 = FPDFLink_GetLinkAtPoint(page, 150, 420);
+ ASSERT_TRUE(link2);
+
+ FPDF_DEST dest1 = FPDFLink_GetDest(document(), link1);
+ ASSERT_TRUE(dest1);
+ FPDF_DEST dest2 = FPDFLink_GetDest(document(), link2);
+ ASSERT_TRUE(dest2);
+
+ EXPECT_EQ(0, FPDFDest_GetDestPageIndex(document(), dest1));
+ EXPECT_EQ(0, FPDFDest_GetDestPageIndex(document(), dest2));
+
+ {
+ FPDF_BOOL has_x_coord;
+ FPDF_BOOL has_y_coord;
+ FPDF_BOOL has_zoom;
+ FS_FLOAT x;
+ FS_FLOAT y;
+ FS_FLOAT zoom;
+ FPDF_BOOL success = FPDFDest_GetLocationInPage(
+ dest1, &has_x_coord, &has_y_coord, &has_zoom, &x, &y, &zoom);
+ ASSERT_TRUE(success);
+ EXPECT_TRUE(has_x_coord);
+ EXPECT_TRUE(has_y_coord);
+ EXPECT_FALSE(has_zoom);
+ EXPECT_FLOAT_EQ(100.0f, x);
+ EXPECT_FLOAT_EQ(200.0f, y);
+ }
+ {
+ FPDF_BOOL has_x_coord;
+ FPDF_BOOL has_y_coord;
+ FPDF_BOOL has_zoom;
+ FS_FLOAT x;
+ FS_FLOAT y;
+ FS_FLOAT zoom;
+ FPDF_BOOL success = FPDFDest_GetLocationInPage(
+ dest2, &has_x_coord, &has_y_coord, &has_zoom, &x, &y, &zoom);
+ ASSERT_TRUE(success);
+ EXPECT_TRUE(has_x_coord);
+ EXPECT_TRUE(has_y_coord);
+ EXPECT_FALSE(has_zoom);
+ EXPECT_FLOAT_EQ(150.0f, x);
+ EXPECT_FLOAT_EQ(250.0f, y);
+ }
+
+ UnloadPage(page);
+}
+
TEST_F(FPDFDocEmbeddertest, ActionGetFilePath) {
EXPECT_TRUE(OpenDocument("launch_action.pdf"));
diff --git a/testing/resources/bug_821454.in b/testing/resources/bug_821454.in
new file mode 100644
index 0000000000..168c983d10
--- /dev/null
+++ b/testing/resources/bug_821454.in
@@ -0,0 +1,75 @@
+{{header}}
+{{object 1 0}}
+<<
+ /Type /Catalog
+ /Pages 2 0 R
+ /Names 14 0 R
+ /AcroForm << /Fields [ 8 0 R 9 0 R ] >>
+>>
+endobj
+{{object 2 0}}
+<<
+ /Type /Pages
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+{{object 3 0}}
+<<
+ /Type /Page
+ /Parent 2 0 R
+ /Contents 6 0 R
+ /MediaBox [ 0 0 300 600 ]
+ /Annots [ 8 0 R 9 0 R ]
+>>
+endobj
+{{object 6 0}}
+<<
+{{streamlen}}
+>>
+stream
+endstream
+endobj
+{{object 8 0}}
+<<
+ /Type /Annot
+ /Subtype /Link
+ /Rect [ 100 350 200 380 ]
+ /Dest (target10)
+>>
+endobj
+{{object 9 0}}
+<<
+ /Type /Annot
+ /Subtype /Link
+ /Rect [ 100 400 200 430 ]
+ /Dest (target100)
+>>
+endobj
+{{object 14 0}}
+<<
+ /Dests 15 0 R
+>>
+endobj
+{{object 15 0}}
+<<
+ /Names [
+ (target10) 16 0 R
+ (target100) 17 0 R
+ ]
+>>
+endobj
+{{object 16 0}}
+<<
+ /D [3 0 R /XYZ 100 200 0]
+>>
+endobj
+{{object 17 0}}
+<<
+ /D [3 0 R /XYZ 150 250 0]
+>>
+endobj
+{{xref}}
+{{trailer}}
+{{startxref}}
+%%EOF
diff --git a/testing/resources/bug_821454.pdf b/testing/resources/bug_821454.pdf
new file mode 100644
index 0000000000..d6229a5790
--- /dev/null
+++ b/testing/resources/bug_821454.pdf
@@ -0,0 +1,96 @@
+%PDF-1.7
+% ò¤ô
+1 0 obj
+<<
+ /Type /Catalog
+ /Pages 2 0 R
+ /Names 14 0 R
+ /AcroForm << /Fields [ 8 0 R 9 0 R ] >>
+>>
+endobj
+2 0 obj
+<<
+ /Type /Pages
+ /Count 1
+ /Kids [ 3 0 R ]
+>>
+endobj
+3 0 obj
+<<
+ /Type /Page
+ /Parent 2 0 R
+ /Contents 6 0 R
+ /MediaBox [ 0 0 300 600 ]
+ /Annots [ 8 0 R 9 0 R ]
+>>
+endobj
+6 0 obj
+<<
+/Length 0
+>>
+stream
+endstream
+endobj
+8 0 obj
+<<
+ /Type /Annot
+ /Subtype /Link
+ /Rect [ 100 350 200 380 ]
+ /Dest (target10)
+>>
+endobj
+9 0 obj
+<<
+ /Type /Annot
+ /Subtype /Link
+ /Rect [ 100 400 200 430 ]
+ /Dest (target100)
+>>
+endobj
+14 0 obj
+<<
+ /Dests 15 0 R
+>>
+endobj
+15 0 obj
+<<
+ /Names [
+ (target10) 16 0 R
+ (target100) 17 0 R
+ ]
+>>
+endobj
+16 0 obj
+<<
+ /D [3 0 R /XYZ 100 200 0]
+>>
+endobj
+17 0 obj
+<<
+ /D [3 0 R /XYZ 150 250 0]
+>>
+endobj
+xref
+0 18
+0000000000 65535 f
+0000000015 00000 n
+0000000126 00000 n
+0000000191 00000 n
+0000000000 65535 f
+0000000000 65535 f
+0000000314 00000 n
+0000000000 65535 f
+0000000362 00000 n
+0000000462 00000 n
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000000 65535 f
+0000000563 00000 n
+0000000601 00000 n
+0000000683 00000 n
+0000000733 00000 n
+trailer<< /Root 1 0 R /Size 18 >>
+startxref
+783
+%%EOF