diff options
Diffstat (limited to 'fpdfsdk/fpdf_edit_embeddertest.cpp')
-rw-r--r-- | fpdfsdk/fpdf_edit_embeddertest.cpp | 16 |
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"; |