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

Unified Diff: fpdfsdk/src/fpdfdoc_embeddertest.cpp

Issue 1553313002: Merge to XFA: Cover FPDFBookmark_Find() with embedder tests. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 12 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdfdoc_embeddertest.cpp
diff --git a/fpdfsdk/src/fpdfdoc_embeddertest.cpp b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
index 6435704cb281c59327811f1e5a0641c8fb87527a..38a366268c59588599eff7e873f707dfea1bcb40 100644
--- a/fpdfsdk/src/fpdfdoc_embeddertest.cpp
+++ b/fpdfsdk/src/fpdfdoc_embeddertest.cpp
@@ -99,3 +99,22 @@ TEST_F(FPDFDocEmbeddertest, Bookmarks) {
EXPECT_EQ(nullptr, FPDFBookmark_GetNextSibling(document(), sibling));
}
+
+TEST_F(FPDFDocEmbeddertest, FindBookmarks) {
+ // Open a file with two bookmarks, and extract the first.
+ EXPECT_TRUE(OpenDocument("bookmarks.pdf"));
+
+ unsigned short buf[128];
+ FPDF_BOOKMARK child = FPDFBookmark_GetFirstChild(document(), nullptr);
+ EXPECT_NE(nullptr, child);
+ EXPECT_EQ(34, FPDFBookmark_GetTitle(child, buf, sizeof(buf)));
+ EXPECT_EQ(CFX_WideString(L"A Good Beginning"),
+ CFX_WideString::FromUTF16LE(buf, 16));
+
+ // Find the same one again using the title.
+ EXPECT_EQ(child, FPDFBookmark_Find(document(), buf));
+
+ // Try to find one using a non-existent title.
+ buf[0] = 'X';
+ EXPECT_EQ(nullptr, FPDFBookmark_Find(document(), buf));
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698