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_metafile_mac.h" | 5 #include "printing/pdf_metafile_mac.h" |
6 | 6 |
7 #import <ApplicationServices/ApplicationServices.h> | 7 #import <ApplicationServices/ApplicationServices.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 | 14 |
15 namespace printing { | 15 namespace printing { |
16 | 16 |
17 TEST(PdfMetafileTest, Pdf) { | 17 TEST(PdfMetafileTest, Pdf) { |
18 // Test in-renderer constructor. | 18 // Test in-renderer constructor. |
19 printing::PdfMetafile pdf; | 19 printing::PdfMetafile pdf; |
20 EXPECT_TRUE(pdf.Init() != NULL); | 20 pdf.Init(); |
Lei Zhang
2011/03/04 12:02:36
probably good to make sure this returns true.
dpapad
2011/03/04 19:19:43
Done.
| |
21 EXPECT_TRUE(pdf.context() != NULL); | |
21 | 22 |
22 // Render page 1 at origin (10.0, 10.0). | 23 // Render page 1 at origin (10.0, 10.0). |
23 gfx::Point origin_1(10.0f, 10.0f); | 24 gfx::Point origin_1(10.0f, 10.0f); |
24 gfx::Size size_1(540, 720); | 25 gfx::Size size_1(540, 720); |
25 pdf.StartPage(size_1, origin_1, 1.25); | 26 pdf.StartPage(size_1, origin_1, 1.25); |
26 pdf.FinishPage(); | 27 pdf.FinishPage(); |
27 | 28 |
28 // Render page 2 at origin (10.0, 10.0). | 29 // Render page 2 at origin (10.0, 10.0). |
29 gfx::Point origin_2(10.0f, 10.0f); | 30 gfx::Point origin_2(10.0f, 10.0f); |
30 gfx::Size size_2(720, 540); | 31 gfx::Size size_2(720, 540); |
(...skipping 26 matching lines...) Expand all Loading... | |
57 EXPECT_EQ(2U, pdf2.GetPageCount()); | 58 EXPECT_EQ(2U, pdf2.GetPageCount()); |
58 gfx::Size page_size = pdf2.GetPageBounds(1).size(); | 59 gfx::Size page_size = pdf2.GetPageBounds(1).size(); |
59 EXPECT_EQ(540, page_size.width()); | 60 EXPECT_EQ(540, page_size.width()); |
60 EXPECT_EQ(720, page_size.height()); | 61 EXPECT_EQ(720, page_size.height()); |
61 page_size = pdf2.GetPageBounds(2).size(); | 62 page_size = pdf2.GetPageBounds(2).size(); |
62 EXPECT_EQ(720, page_size.width()); | 63 EXPECT_EQ(720, page_size.width()); |
63 EXPECT_EQ(540, page_size.height()); | 64 EXPECT_EQ(540, page_size.height()); |
64 } | 65 } |
65 | 66 |
66 } // namespace printing | 67 } // namespace printing |
OLD | NEW |