diff options
author | Nicolas Pena <npm@chromium.org> | 2017-04-13 15:28:20 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-13 19:52:31 +0000 |
commit | 742977f943b30638427d1ef6532acbc3d1c36bff (patch) | |
tree | aa6d3fccc2479002ddf2550bc6d25c14d7567737 /testing/test_support.cpp | |
parent | a119340ec92412d07e60654b2b22a5a5bea979b0 (diff) | |
download | pdfium-742977f943b30638427d1ef6532acbc3d1c36bff.tar.xz |
Add embeddertest for form text rendering and saving
This CL adds an embeddertest that adds text to a textfield and saves it. It
also adds a new 'charcode' option for .evt files in pdfium_test.
Change-Id: I14fbf50e2b1d5ae0bdc68d1dd25dc4f889c49bfb
Reviewed-on: https://pdfium-review.googlesource.com/4150
Commit-Queue: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'testing/test_support.cpp')
-rw-r--r-- | testing/test_support.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/testing/test_support.cpp b/testing/test_support.cpp index 20f1cadf09..1f527811c4 100644 --- a/testing/test_support.cpp +++ b/testing/test_support.cpp @@ -212,6 +212,23 @@ int TestSaver::WriteBlockCallback(FPDF_FILEWRITE* pFileWrite, return 1; } +// static +int TestSaver::GetBlockFromString(void* param, + unsigned long pos, + unsigned char* buf, + unsigned long size) { + std::string* new_file = static_cast<std::string*>(param); + if (!new_file || pos + size < pos) + return 0; + + unsigned long file_size = new_file->size(); + if (pos + size > file_size) + return 0; + + memcpy(buf, new_file->data() + pos, size); + return 1; +} + namespace pdfium { void FPDF_Test::SetUp() { |