summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_edit_embeddertest.cpp
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-07-12 19:45:29 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-07-12 19:45:29 +0000
commit07520f6e9cfd1c1f304d18af614d83938e382adb (patch)
tree19616c41d1a7540f0bc334164ab76aa44e0f2020 /fpdfsdk/fpdf_edit_embeddertest.cpp
parent83f2d7060194a146ffcb9cbac993178d92a166bc (diff)
downloadpdfium-07520f6e9cfd1c1f304d18af614d83938e382adb.tar.xz
Create API to set and get blob values from a mark dict.
The new functions are: - FPDFPageObjMark_GetParamBlobValue - FPDFPageObjMark_SetBlobParam Bug: pdfium:1037 Change-Id: Ie04df04c64c6cf517a8cde182d7e9a38c3c78d1b Reviewed-on: https://pdfium-review.googlesource.com/37570 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_edit_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_edit_embeddertest.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index 800fc70076..e47f3db360 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -2175,11 +2175,17 @@ TEST_F(FPDFEditEmbeddertest, AddMarkedText) {
// Add parameters:
// - int "IntKey" : 42
// - string "StringKey": "StringValue"
+ // - blob "BlobKey": "\x01\x02\x03\0BlobValue1\0\0\0BlobValue2\0"
+ constexpr const size_t kBlobLen = 28;
+ char kBlobValue[kBlobLen];
+ memcpy(kBlobValue, "\x01\x02\x03\0BlobValue1\0\0\0BlobValue2\0", kBlobLen);
EXPECT_EQ(0, FPDFPageObjMark_CountParams(mark));
EXPECT_TRUE(FPDFPageObjMark_SetIntParam(document(), mark, "IntKey", 42));
EXPECT_TRUE(FPDFPageObjMark_SetStringParam(document(), mark, "StringKey",
"StringValue"));
- EXPECT_EQ(2, FPDFPageObjMark_CountParams(mark));
+ EXPECT_TRUE(FPDFPageObjMark_SetBlobParam(document(), mark, "BlobKey",
+ kBlobValue, kBlobLen));
+ EXPECT_EQ(3, FPDFPageObjMark_CountParams(mark));
// Check the two parameters can be retrieved.
EXPECT_EQ(FPDF_OBJECT_NUMBER,
@@ -2197,6 +2203,14 @@ TEST_F(FPDFEditEmbeddertest, AddMarkedText) {
name = GetPlatformWString(reinterpret_cast<unsigned short*>(buffer));
EXPECT_EQ(L"StringValue", name);
+ EXPECT_EQ(FPDF_OBJECT_STRING,
+ FPDFPageObjMark_GetParamValueType(mark, "BlobKey"));
+ out_buffer_len = 0;
+ EXPECT_TRUE(FPDFPageObjMark_GetParamBlobValue(mark, "BlobKey", buffer, 256,
+ &out_buffer_len));
+ EXPECT_EQ(kBlobLen, out_buffer_len);
+ EXPECT_EQ(0, memcmp(kBlobValue, buffer, kBlobLen));
+
// Render and check the bitmap is the expected one.
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
const char md5[] = "17d2b6cd574cf66170b09c8927529a94";