Index: testing/test_support.cpp |
diff --git a/testing/test_support.cpp b/testing/test_support.cpp |
index 96e01c5b01cbf04ba989c83e58a6744a557f02d3..da5ea7e9ee5d06126ed8a149c3dca0b90444e52c 100644 |
--- a/testing/test_support.cpp |
+++ b/testing/test_support.cpp |
@@ -172,3 +172,21 @@ int TestLoader::GetBlock(void* param, |
memcpy(pBuf, pLoader->m_pBuf + pos, size); |
return 1; |
} |
+ |
+TestSaver::TestSaver() { |
+ FPDF_FILEWRITE::version = 1; |
+ FPDF_FILEWRITE::WriteBlock = WriteBlockCallback; |
+} |
+ |
+void TestSaver::ClearString() { |
+ m_String.clear(); |
+} |
+ |
+// static |
+int TestSaver::WriteBlockCallback(FPDF_FILEWRITE* pFileWrite, |
+ const void* data, |
+ unsigned long size) { |
+ TestSaver* pThis = static_cast<TestSaver*>(pFileWrite); |
+ pThis->m_String.append(static_cast<const char*>(data), size); |
+ return 1; |
+} |