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

Side by Side Diff: fpdfsdk/src/fpdfedit_embeddertest.cpp

Issue 1561303002: Disentangle fpdfsave_embeddertest's FPDF_FILEWRITE, use gmock matchers. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Blank line Created 4 years, 11 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 | fpdfsdk/src/fpdfsave_embeddertest.cpp » ('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/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/test_support.h"
9 11
10 class FPDFEditEmbeddertest : public EmbedderTest {}; 12 class FPDFEditEmbeddertest : public EmbedderTest, public TestSaver {};
11 13
12 TEST_F(FPDFEditEmbeddertest, EmptyCreation) { 14 TEST_F(FPDFEditEmbeddertest, EmptyCreation) {
13 EXPECT_TRUE(CreateEmptyDocument()); 15 EXPECT_TRUE(CreateEmptyDocument());
14 FPDF_PAGE page = FPDFPage_New(document(), 1, 640.0, 480.0); 16 FPDF_PAGE page = FPDFPage_New(document(), 1, 640.0, 480.0);
15 EXPECT_NE(nullptr, page); 17 EXPECT_NE(nullptr, page);
16 EXPECT_TRUE(FPDFPage_GenerateContent(page)); 18 EXPECT_TRUE(FPDFPage_GenerateContent(page));
19 EXPECT_TRUE(FPDF_SaveAsCopy(document(), this, 0));
20 EXPECT_THAT(GetString(),
21 testing::MatchesRegex(
22 "%PDF-1.7\r\n"
23 "%\xA1\xB3\xC5\xD7\r\n"
24 "1 0 obj\r\n"
25 "<</Type/Catalog/Pages 2 0 R >>\r\n"
26 "endobj\r\n"
27 "2 0 obj\r\n"
28 "<</Type/Pages/Count 1/Kids\\[ 4 0 R \\]>>\r\n"
29 "endobj\r\n"
30 "3 0 obj\r\n"
31 "<</CreationDate\\(D:.*\\)/Creator\\(PDFium\\)>>\r\n"
32 "endobj\r\n"
33 "4 0 obj\r\n"
34 "<</Type/Page/Parent 2 0 R /MediaBox\\[ 0 0 640 "
35 "480\\]/Rotate 0/Resources<<>>/Contents 5 0 R >>\r\n"
36 "endobj\r\n"
37 "5 0 obj\r\n"
38 "<</Length 8/Filter/FlateDecode>>stream\r\n"
39 "x\x9C\x3\0\0\0\0\x1\r\n"
40 "endstream\r\n"
41 "endobj\r\n"
42 "xref\r\n"
43 "0 6\r\n"
44 "0000000000 65535 f\r\n"
45 "0000000017 00000 n\r\n"
46 "0000000066 00000 n\r\n"
47 "0000000122 00000 n\r\n"
48 "0000000192 00000 n\r\n"
49 "0000000301 00000 n\r\n"
50 "trailer\r\n"
51 "<<\r\n"
52 "/Root 1 0 R\r\n"
53 "/Info 3 0 R\r\n"
54 "/Size 6/ID\\[<.*><.*>\\]>>\r\n"
55 "startxref\r\n"
56 "379\r\n"
57 "%%EOF\r\n"));
17 FPDFPage_Delete(document(), 1); 58 FPDFPage_Delete(document(), 1);
18 } 59 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/src/fpdfsave_embeddertest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698