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/emf_win.h" | 5 #include "printing/emf_win.h" |
6 | 6 |
7 // For quick access. | 7 // For quick access. |
8 #include <wingdi.h> | 8 #include <wingdi.h> |
9 #include <winspool.h> | 9 #include <winspool.h> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 return true; | 32 return true; |
33 DeleteDC(hdc); | 33 DeleteDC(hdc); |
34 return false; | 34 return false; |
35 } | 35 } |
36 }; | 36 }; |
37 | 37 |
38 const uint32 EMF_HEADER_SIZE = 128; | 38 const uint32 EMF_HEADER_SIZE = 128; |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
| 42 namespace printing { |
| 43 |
42 TEST(EmfTest, DC) { | 44 TEST(EmfTest, DC) { |
43 // Simplest use case. | 45 // Simplest use case. |
44 printing::Emf emf; | 46 printing::Emf emf; |
45 RECT rect = {100, 100, 200, 200}; | 47 RECT rect = {100, 100, 200, 200}; |
46 HDC hdc = CreateCompatibleDC(NULL); | 48 HDC hdc = CreateCompatibleDC(NULL); |
47 EXPECT_TRUE(hdc != NULL); | 49 EXPECT_TRUE(hdc != NULL); |
48 EXPECT_TRUE(emf.CreateDc(hdc, &rect)); | 50 EXPECT_TRUE(emf.CreateDc(hdc, &rect)); |
49 EXPECT_TRUE(emf.hdc() != NULL); | 51 EXPECT_TRUE(emf.hdc() != NULL); |
50 // In theory, you'd use the HDC with GDI functions here. | 52 // In theory, you'd use the HDC with GDI functions here. |
51 EXPECT_TRUE(emf.CloseDc()); | 53 EXPECT_TRUE(emf.CloseDc()); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // Playback the data. | 190 // Playback the data. |
189 hdc = CreateCompatibleDC(NULL); | 191 hdc = CreateCompatibleDC(NULL); |
190 EXPECT_TRUE(hdc); | 192 EXPECT_TRUE(hdc); |
191 EXPECT_TRUE(emf.CreateFromFile(metafile_path)); | 193 EXPECT_TRUE(emf.CreateFromFile(metafile_path)); |
192 RECT output_rect = {0, 0, 10, 10}; | 194 RECT output_rect = {0, 0, 10, 10}; |
193 EXPECT_TRUE(emf.Playback(hdc, &output_rect)); | 195 EXPECT_TRUE(emf.Playback(hdc, &output_rect)); |
194 EXPECT_TRUE(DeleteDC(hdc)); | 196 EXPECT_TRUE(DeleteDC(hdc)); |
195 emf.CloseEmf(); | 197 emf.CloseEmf(); |
196 } | 198 } |
197 | 199 |
| 200 } // namespace printing |
OLD | NEW |