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

Side by Side Diff: printing/pdf_ps_metafile_linux_unittest.cc

Issue 193086: Fix printing project on linux. (Closed)
Patch Set: fix git error Created 11 years, 3 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 | « printing/page_overlays_unittest.cc ('k') | printing/printed_document.cc » ('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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium 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 "printing/pdf_ps_metafile_linux.h" 5 #include "printing/pdf_ps_metafile_linux.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 typedef struct _cairo cairo_t; 13 typedef struct _cairo cairo_t;
14 14
15 TEST(PdfTest, DISABLED_Basic) { 15 TEST(PdfTest, ThreePages) {
16 // Tests in-renderer constructor. 16 // Tests in-renderer constructor.
17 printing::PdfPsMetafile pdf(printing::PdfPsMetafile::PDF); 17 printing::PdfPsMetafile pdf(printing::PdfPsMetafile::PDF);
18 EXPECT_TRUE(pdf.Init()); 18 EXPECT_TRUE(pdf.Init());
19 19
20 // Renders page 1. 20 // Renders page 1.
21 cairo_t* context = pdf.StartPage(72, 72); 21 cairo_t* context = pdf.StartPage(72, 72);
22 EXPECT_TRUE(context != NULL); 22 EXPECT_TRUE(context != NULL);
23 // In theory, we should use Cairo to draw something on |context|. 23 // In theory, we should use Cairo to draw something on |context|.
24 EXPECT_TRUE(pdf.FinishPage(1.5)); 24 EXPECT_TRUE(pdf.FinishPage(1.5));
25 25
(...skipping 23 matching lines...) Expand all
49 pdf2.GetData(&buffer2.front(), 4); 49 pdf2.GetData(&buffer2.front(), 4);
50 50
51 // Tests if the header begins with "%PDF". 51 // Tests if the header begins with "%PDF".
52 std::string header(&buffer2.front(), 4); 52 std::string header(&buffer2.front(), 4);
53 EXPECT_EQ(header.find("%PDF", 0), 0u); 53 EXPECT_EQ(header.find("%PDF", 0), 0u);
54 54
55 // Tests if we can save data. 55 // Tests if we can save data.
56 EXPECT_TRUE(pdf.SaveTo(FilePath("/dev/null"))); 56 EXPECT_TRUE(pdf.SaveTo(FilePath("/dev/null")));
57 } 57 }
58 58
59 TEST(PsTest, DISABLED_Basic2) { 59 TEST(PsTest, TwoPages) {
60 // Tests in-renderer constructor. 60 // Tests in-renderer constructor.
61 printing::PdfPsMetafile ps(printing::PdfPsMetafile::PS); 61 printing::PdfPsMetafile ps(printing::PdfPsMetafile::PS);
62 EXPECT_TRUE(ps.Init()); 62 EXPECT_TRUE(ps.Init());
63 63
64 // Renders page 1. 64 // Renders page 1.
65 cairo_t* context = ps.StartPage(72, 72); 65 cairo_t* context = ps.StartPage(72, 72);
66 EXPECT_TRUE(context != NULL); 66 EXPECT_TRUE(context != NULL);
67 // In theory, we should use Cairo to draw something on |context|. 67 // In theory, we should use Cairo to draw something on |context|.
68 EXPECT_TRUE(ps.FinishPage(1.5)); 68 EXPECT_TRUE(ps.FinishPage(1.5));
69 69
(...skipping 22 matching lines...) Expand all
92 std::vector<char> buffer2(4, 0x00); 92 std::vector<char> buffer2(4, 0x00);
93 ps2.GetData(&buffer2.front(), 4); 93 ps2.GetData(&buffer2.front(), 4);
94 94
95 // Tests if the header begins with "%!PS". 95 // Tests if the header begins with "%!PS".
96 std::string header(&buffer2.front(), 4); 96 std::string header(&buffer2.front(), 4);
97 EXPECT_EQ(header.find("%!PS", 0), 0u); 97 EXPECT_EQ(header.find("%!PS", 0), 0u);
98 98
99 // Tests if we can save data. 99 // Tests if we can save data.
100 EXPECT_TRUE(ps.SaveTo(FilePath("/dev/null"))); 100 EXPECT_TRUE(ps.SaveTo(FilePath("/dev/null")));
101 } 101 }
OLDNEW
« no previous file with comments | « printing/page_overlays_unittest.cc ('k') | printing/printed_document.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698