diff options
author | Jane Liu <janeliulwq@google.com> | 2017-08-24 12:31:10 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-28 20:13:02 +0000 |
commit | d1ed1ce582efc877487c749924e21772e73df6a2 (patch) | |
tree | 83a13bf3423fd16de1b7c29d7004bbfac476c103 /fpdfsdk/fpdfannot_embeddertest.cpp | |
parent | 827f6ff220edea40252e52d128662d37a591fdb9 (diff) | |
download | pdfium-d1ed1ce582efc877487c749924e21772e73df6a2.tar.xz |
Added FPDFAnnot_GetAnnotIndex()
Added FPDFAnnot_GetAnnotIndex() to get the index of an annotation. This
is useful if linked annotations are renedered together - then we need to
know which ones in the annotation list we need to skip.
Bug=pdfium:863,pdfium:737
Change-Id: I53482a15e0fd9a896b348b64d68e99f9c21da9f9
Reviewed-on: https://pdfium-review.googlesource.com/11970
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfannot_embeddertest.cpp')
-rw-r--r-- | fpdfsdk/fpdfannot_embeddertest.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fpdfsdk/fpdfannot_embeddertest.cpp b/fpdfsdk/fpdfannot_embeddertest.cpp index 47b71667b2..6c0cdedab5 100644 --- a/fpdfsdk/fpdfannot_embeddertest.cpp +++ b/fpdfsdk/fpdfannot_embeddertest.cpp @@ -919,11 +919,13 @@ TEST_F(FPDFAnnotEmbeddertest, ExtractLinkedAnnotations) { ASSERT_TRUE(OpenDocument("annotation_highlight_square_with_ap.pdf")); FPDF_PAGE page = FPDF_LoadPage(document(), 0); ASSERT_TRUE(page); + EXPECT_EQ(-1, FPDFPage_GetAnnotIndex(page, nullptr)); // Retrieve the highlight annotation which has its popup defined. FPDF_ANNOTATION annot = FPDFPage_GetAnnot(page, 0); ASSERT_TRUE(annot); EXPECT_EQ(FPDF_ANNOT_HIGHLIGHT, FPDFAnnot_GetSubtype(annot)); + EXPECT_EQ(0, FPDFPage_GetAnnotIndex(page, annot)); std::unique_ptr<unsigned short, pdfium::FreeDeleter> popup_key = GetFPDFWideString(L"Popup"); ASSERT_TRUE(FPDFAnnot_HasKey(annot, popup_key.get())); @@ -934,6 +936,7 @@ TEST_F(FPDFAnnotEmbeddertest, ExtractLinkedAnnotations) { FPDF_ANNOTATION popup = FPDFAnnot_GetLinkedAnnot(annot, popup_key.get()); ASSERT_TRUE(popup); EXPECT_EQ(FPDF_ANNOT_POPUP, FPDFAnnot_GetSubtype(popup)); + EXPECT_EQ(1, FPDFPage_GetAnnotIndex(page, popup)); FS_RECTF rect; ASSERT_TRUE(FPDFAnnot_GetRect(popup, &rect)); EXPECT_NEAR(612.0f, rect.left, 0.001f); |