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 | |
44 TEST(EmfTest, DC) { | 42 TEST(EmfTest, DC) { |
45 // Simplest use case. | 43 // Simplest use case. |
46 printing::Emf emf; | 44 printing::Emf emf; |
47 RECT rect = {100, 100, 200, 200}; | 45 RECT rect = {100, 100, 200, 200}; |
48 HDC hdc = CreateCompatibleDC(NULL); | 46 HDC hdc = CreateCompatibleDC(NULL); |
49 EXPECT_TRUE(hdc != NULL); | 47 EXPECT_TRUE(hdc != NULL); |
50 EXPECT_TRUE(emf.CreateDc(hdc, &rect)); | 48 EXPECT_TRUE(emf.CreateDc(hdc, &rect)); |
51 EXPECT_TRUE(emf.hdc() != NULL); | 49 EXPECT_TRUE(emf.hdc() != NULL); |
52 // In theory, you'd use the HDC with GDI functions here. | 50 // In theory, you'd use the HDC with GDI functions here. |
53 EXPECT_TRUE(emf.CloseDc()); | 51 EXPECT_TRUE(emf.CloseDc()); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // Playback the data. | 188 // Playback the data. |
191 hdc = CreateCompatibleDC(NULL); | 189 hdc = CreateCompatibleDC(NULL); |
192 EXPECT_TRUE(hdc); | 190 EXPECT_TRUE(hdc); |
193 EXPECT_TRUE(emf.CreateFromFile(metafile_path)); | 191 EXPECT_TRUE(emf.CreateFromFile(metafile_path)); |
194 RECT output_rect = {0, 0, 10, 10}; | 192 RECT output_rect = {0, 0, 10, 10}; |
195 EXPECT_TRUE(emf.Playback(hdc, &output_rect)); | 193 EXPECT_TRUE(emf.Playback(hdc, &output_rect)); |
196 EXPECT_TRUE(DeleteDC(hdc)); | 194 EXPECT_TRUE(DeleteDC(hdc)); |
197 emf.CloseEmf(); | 195 emf.CloseEmf(); |
198 } | 196 } |
199 | 197 |
200 } // namespace printing | |
OLD | NEW |