OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_cairo.h" | 5 #include "printing/pdf_ps_metafile_cairo.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 namespace printing { | 27 namespace printing { |
28 | 28 |
29 TEST_F(PdfPsTest, Pdf) { | 29 TEST_F(PdfPsTest, Pdf) { |
30 // Tests in-renderer constructor. | 30 // Tests in-renderer constructor. |
31 printing::PdfPsMetafile pdf; | 31 printing::PdfPsMetafile pdf; |
32 EXPECT_TRUE(pdf.Init()); | 32 EXPECT_TRUE(pdf.Init()); |
33 | 33 |
34 // Renders page 1. | 34 // Renders page 1. |
35 EXPECT_TRUE(pdf.StartPage(gfx::Size(72, 73), gfx::Point(4, 5), 1)); | 35 EXPECT_TRUE(pdf.StartPage(gfx::Size(72, 73), gfx::Point(4, 5), 1)); |
36 EXPECT_EQ(printing::PdfPsMetafile::FromCairoContext(pdf.context()), &pdf); | |
37 // In theory, we should use Cairo to draw something on |context|. | 36 // In theory, we should use Cairo to draw something on |context|. |
38 EXPECT_TRUE(pdf.FinishPage()); | 37 EXPECT_TRUE(pdf.FinishPage()); |
39 | 38 |
40 // Renders page 2. | 39 // Renders page 2. |
41 EXPECT_TRUE(pdf.StartPage(gfx::Size(72, 73), gfx::Point(4, 5), 1)); | 40 EXPECT_TRUE(pdf.StartPage(gfx::Size(72, 73), gfx::Point(4, 5), 1)); |
42 // In theory, we should use Cairo to draw something on |context|. | 41 // In theory, we should use Cairo to draw something on |context|. |
43 EXPECT_TRUE(pdf.FinishPage()); | 42 EXPECT_TRUE(pdf.FinishPage()); |
44 | 43 |
45 // Closes the file. | 44 // Closes the file. |
46 pdf.FinishDocument(); | 45 pdf.FinishDocument(); |
(...skipping 30 matching lines...) Expand all Loading... |
77 EXPECT_TRUE(pdf3.FinishPage()); | 76 EXPECT_TRUE(pdf3.FinishPage()); |
78 pdf3.FinishDocument(); | 77 pdf3.FinishDocument(); |
79 size = pdf3.GetDataSize(); | 78 size = pdf3.GetDataSize(); |
80 EXPECT_EQ(test_raw_data.size(), size); | 79 EXPECT_EQ(test_raw_data.size(), size); |
81 std::string output; | 80 std::string output; |
82 pdf3.GetData(WriteInto(&output, size + 1), size); | 81 pdf3.GetData(WriteInto(&output, size + 1), size); |
83 EXPECT_EQ(test_raw_data, output); | 82 EXPECT_EQ(test_raw_data, output); |
84 } | 83 } |
85 | 84 |
86 } // namespace printing | 85 } // namespace printing |
OLD | NEW |