示例#1
0
TEST_F(FPDFDocEmbedderTest, NoBookmarks) {
  // Open a file with no bookmarks.
  EXPECT_TRUE(OpenDocument("named_dests.pdf"));

  // The non-existent top-level bookmark has no title.
  unsigned short buf[128];
  EXPECT_EQ(0u, FPDFBookmark_GetTitle(nullptr, buf, sizeof(buf)));

  // NULL argument cases.
  EXPECT_EQ(nullptr, FPDFBookmark_GetFirstChild(nullptr, nullptr));
  EXPECT_EQ(nullptr, FPDFBookmark_GetFirstChild(document(), nullptr));
  EXPECT_EQ(nullptr, FPDFBookmark_GetNextSibling(nullptr, nullptr));
  EXPECT_EQ(nullptr, FPDFBookmark_GetNextSibling(document(), nullptr));
  EXPECT_EQ(nullptr, FPDFBookmark_Find(nullptr, nullptr));
  EXPECT_EQ(nullptr, FPDFBookmark_Find(document(), nullptr));
  EXPECT_EQ(nullptr, FPDFBookmark_GetDest(nullptr, nullptr));
  EXPECT_EQ(nullptr, FPDFBookmark_GetDest(document(), nullptr));
  EXPECT_EQ(nullptr, FPDFBookmark_GetAction(nullptr));
}
示例#2
0
csPDFiumDest csPDFiumDocument::resolveBookmark(const void *pointer) const
{
  if( isEmpty() ) {
    return csPDFiumDest();
  }

  CSPDFIUM_DOCIMPL();

  if( pointer == 0 ) {
    return csPDFiumDest();
  }

  const FPDF_BOOKMARK bookmark = (const FPDF_BOOKMARK)pointer;
  const FPDF_DEST         dest = FPDFBookmark_GetDest(impl->document, bookmark);

  return createDest(dest, FPDFBookmark_GetAction(bookmark));
}