Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(578)

Side by Side Diff: fpdfsdk/fpdfedit_embeddertest.cpp

Issue 2260683003: Fix an embedder test with leaked page object (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@fix
Patch Set: tidy Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | public/fpdf_edit.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "public/fpdf_edit.h" 5 #include "public/fpdf_edit.h"
6 #include "public/fpdfview.h" 6 #include "public/fpdfview.h"
7 #include "testing/embedder_test.h" 7 #include "testing/embedder_test.h"
8 #include "testing/gmock/include/gmock/gmock-matchers.h" 8 #include "testing/gmock/include/gmock/gmock-matchers.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/test_support.h" 10 #include "testing/test_support.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 "/Root 1 0 R\r\n" 48 "/Root 1 0 R\r\n"
49 "/Info 3 0 R\r\n" 49 "/Info 3 0 R\r\n"
50 "/Size 6/ID\\[<.*><.*>\\]>>\r\n" 50 "/Size 6/ID\\[<.*><.*>\\]>>\r\n"
51 "startxref\r\n" 51 "startxref\r\n"
52 "379\r\n" 52 "379\r\n"
53 "%%EOF\r\n"; 53 "%%EOF\r\n";
54 } // namespace 54 } // namespace
55 55
56 TEST_F(FPDFEditEmbeddertest, EmptyCreation) { 56 TEST_F(FPDFEditEmbeddertest, EmptyCreation) {
57 EXPECT_TRUE(CreateEmptyDocument()); 57 EXPECT_TRUE(CreateEmptyDocument());
58 FPDF_PAGE page = FPDFPage_New(document(), 1, 640.0, 480.0); 58 FPDF_PAGE page = FPDFPage_New(document(), 0, 640.0, 480.0);
59 EXPECT_NE(nullptr, page); 59 EXPECT_NE(nullptr, page);
60 EXPECT_TRUE(FPDFPage_GenerateContent(page)); 60 EXPECT_TRUE(FPDFPage_GenerateContent(page));
61 EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0)); 61 EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
62 62
63 // The MatchesRegexp doesn't support embedded NUL ('\0') characters. They are 63 // The MatchesRegexp doesn't support embedded NUL ('\0') characters. They are
64 // replaced by '_' for the purpose of the test. 64 // replaced by '_' for the purpose of the test.
65 std::string result = GetString(); 65 std::string result = GetString();
66 std::replace(result.begin(), result.end(), '\0', '_'); 66 std::replace(result.begin(), result.end(), '\0', '_');
67 EXPECT_THAT(result, testing::MatchesRegex( 67 EXPECT_THAT(result, testing::MatchesRegex(
68 std::string(kExpectedPDF, sizeof(kExpectedPDF)))); 68 std::string(kExpectedPDF, sizeof(kExpectedPDF))));
69 FPDFPage_Delete(document(), 1); 69 FPDF_ClosePage(page);
70 } 70 }
OLDNEW
« no previous file with comments | « no previous file | public/fpdf_edit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698