summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_structtree_embeddertest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdf_structtree_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_structtree_embeddertest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/fpdfsdk/fpdf_structtree_embeddertest.cpp b/fpdfsdk/fpdf_structtree_embeddertest.cpp
index 05b77fc0f7..7ca81f7b2e 100644
--- a/fpdfsdk/fpdf_structtree_embeddertest.cpp
+++ b/fpdfsdk/fpdf_structtree_embeddertest.cpp
@@ -6,6 +6,7 @@
#include "public/fpdf_structtree.h"
#include "testing/embedder_test.h"
#include "testing/test_support.h"
+#include "third_party/base/optional.h"
class FPDFStructTreeEmbeddertest : public EmbedderTest {};
@@ -24,6 +25,7 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) {
EXPECT_EQ(nullptr, element);
element = FPDF_StructTree_GetChildAtIndex(struct_tree, 0);
ASSERT_NE(nullptr, element);
+ EXPECT_EQ(-1, FPDF_StructElement_GetMarkedContentID(element));
EXPECT_EQ(0U, FPDF_StructElement_GetAltText(element, nullptr, 0));
ASSERT_EQ(1, FPDF_StructElement_CountChildren(element));
@@ -34,6 +36,7 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) {
EXPECT_EQ(nullptr, child_element);
child_element = FPDF_StructElement_GetChildAtIndex(element, 0);
ASSERT_NE(nullptr, child_element);
+ EXPECT_EQ(-1, FPDF_StructElement_GetMarkedContentID(child_element));
EXPECT_EQ(0U, FPDF_StructElement_GetAltText(child_element, nullptr, 0));
ASSERT_EQ(1, FPDF_StructElement_CountChildren(child_element));
@@ -44,6 +47,7 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) {
EXPECT_EQ(nullptr, gchild_element);
gchild_element = FPDF_StructElement_GetChildAtIndex(child_element, 0);
ASSERT_NE(nullptr, gchild_element);
+ EXPECT_EQ(-1, FPDF_StructElement_GetMarkedContentID(gchild_element));
ASSERT_EQ(24U, FPDF_StructElement_GetAltText(gchild_element, nullptr, 0));
unsigned short buffer[12];
@@ -54,6 +58,7 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) {
for (size_t i = 0; i < FX_ArraySize(buffer); ++i)
EXPECT_EQ(0U, buffer[i]);
+ EXPECT_EQ(-1, FPDF_StructElement_GetMarkedContentID(gchild_element));
ASSERT_EQ(24U, FPDF_StructElement_GetAltText(gchild_element, buffer,
sizeof(buffer)));
const wchar_t kExpected[] = L"Black Image";
@@ -69,6 +74,22 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) {
FPDF_ClosePage(page);
}
+TEST_F(FPDFStructTreeEmbeddertest, GetMarkedContentID) {
+ ASSERT_TRUE(OpenDocument("marked_content_id.pdf"));
+ FPDF_PAGE page = LoadPage(0);
+ ASSERT_TRUE(page);
+
+ FPDF_STRUCTTREE struct_tree = FPDF_StructTree_GetForPage(page);
+ ASSERT_TRUE(struct_tree);
+ ASSERT_EQ(1, FPDF_StructTree_CountChildren(struct_tree));
+
+ FPDF_STRUCTELEMENT element = FPDF_StructTree_GetChildAtIndex(struct_tree, 0);
+ EXPECT_EQ(0, FPDF_StructElement_GetMarkedContentID(element));
+
+ FPDF_StructTree_Close(struct_tree);
+ FPDF_ClosePage(page);
+}
+
TEST_F(FPDFStructTreeEmbeddertest, GetType) {
ASSERT_TRUE(OpenDocument("tagged_alt_text.pdf"));
FPDF_PAGE page = LoadPage(0);