Index: testing/test_support.cpp |
diff --git a/testing/test_support.cpp b/testing/test_support.cpp |
index ce143ae8e9b75153f00c072fde2616eeec296445..1e5943be2805eae18153f855a459fad5c98b27c7 100644 |
--- a/testing/test_support.cpp |
+++ b/testing/test_support.cpp |
@@ -171,3 +171,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; |
+} |