From 3ff54008a163eea3158a7c107595daf79ccc7d44 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Wed, 5 Jul 2017 11:55:35 -0400 Subject: Allow EmbedderTest to test saving MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL adds helper methods for EmbedderTest to save. This means that TestSaver is no longer needed and all the methods it uses are moved to the EmbedderTest. Change-Id: I740f29699bfd8c6b570cb1fd85e7aab9bc1d3f6f Reviewed-on: https://pdfium-review.googlesource.com/7171 Reviewed-by: dsinclair Commit-Queue: Nicolás Peña --- fpdfsdk/fpdfformfill_embeddertest.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'fpdfsdk/fpdfformfill_embeddertest.cpp') diff --git a/fpdfsdk/fpdfformfill_embeddertest.cpp b/fpdfsdk/fpdfformfill_embeddertest.cpp index 7779ed25a7..83e560a60c 100644 --- a/fpdfsdk/fpdfformfill_embeddertest.cpp +++ b/fpdfsdk/fpdfformfill_embeddertest.cpp @@ -20,7 +20,7 @@ using testing::_; using testing::Return; -class FPDFFormFillEmbeddertest : public EmbedderTest, public TestSaver { +class FPDFFormFillEmbeddertest : public EmbedderTest { protected: void TypeTextIntoTextfield(FPDF_PAGE page, int num_chars, @@ -366,26 +366,11 @@ TEST_F(FPDFFormFillEmbeddertest, FormText) { EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0)); - // Close everything + // Close page UnloadPage(page); - FPDFDOC_ExitFormFillEnvironment(form_handle_); - FPDF_CloseDocument(document_); } // Check saved document - std::string new_file = GetString(); - FPDF_FILEACCESS file_access; - memset(&file_access, 0, sizeof(file_access)); - file_access.m_FileLen = new_file.size(); - file_access.m_GetBlock = GetBlockFromString; - file_access.m_Param = &new_file; - document_ = FPDF_LoadCustomDocument(&file_access, nullptr); - SetupFormFillEnvironment(); - EXPECT_EQ(1, FPDF_GetPageCount(document_)); - std::unique_ptr new_page(FPDF_LoadPage(document_, 0)); - ASSERT_TRUE(new_page.get()); - std::unique_ptr new_bitmap( - RenderPage(new_page.get())); - CompareBitmap(new_bitmap.get(), 300, 300, md5_3); + TestAndCloseSaved(300, 300, md5_3); } TEST_F(FPDFFormFillEmbeddertest, GetSelectedTextEmptyAndBasicKeyboard) { -- cgit v1.2.3