| 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 |
| 11 #include <string> |
| 12 |
| 11 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 12 #include "base/file_path.h" | 14 #include "base/file_path.h" |
| 13 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 16 #include "base/scoped_temp_dir.h" | 18 #include "base/scoped_temp_dir.h" |
| 17 #include "base/win/scoped_hdc.h" | 19 #include "base/win/scoped_hdc.h" |
| 18 #include "printing/printing_context.h" | 20 #include "printing/printing_context.h" |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "ui/gfx/point.h" | 22 #include "ui/gfx/point.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 EMR_HEADER; | 119 EMR_HEADER; |
| 118 EXPECT_TRUE(itr->SafePlayback(NULL)) << | 120 EXPECT_TRUE(itr->SafePlayback(NULL)) << |
| 119 " index: " << index << " type: " << itr->record()->iType; | 121 " index: " << index << " type: " << itr->record()->iType; |
| 120 } | 122 } |
| 121 context->PageDone(); | 123 context->PageDone(); |
| 122 context->DocumentDone(); | 124 context->DocumentDone(); |
| 123 } | 125 } |
| 124 | 126 |
| 125 // Disabled if no "UnitTest printer" exists. | 127 // Disabled if no "UnitTest printer" exists. |
| 126 TEST_F(EmfPrintingTest, PageBreak) { | 128 TEST_F(EmfPrintingTest, PageBreak) { |
| 127 base::win::ScopedHDC dc( | 129 base::win::ScopedCreateDC dc( |
| 128 CreateDC(L"WINSPOOL", L"UnitTest Printer", NULL, NULL)); | 130 CreateDC(L"WINSPOOL", L"UnitTest Printer", NULL, NULL)); |
| 129 if (!dc.Get()) | 131 if (!dc.Get()) |
| 130 return; | 132 return; |
| 131 uint32 size; | 133 uint32 size; |
| 132 std::vector<BYTE> data; | 134 std::vector<BYTE> data; |
| 133 { | 135 { |
| 134 printing::Emf emf; | 136 printing::Emf emf; |
| 135 EXPECT_TRUE(emf.Init()); | 137 EXPECT_TRUE(emf.Init()); |
| 136 EXPECT_TRUE(emf.context() != NULL); | 138 EXPECT_TRUE(emf.context() != NULL); |
| 137 int pages = 3; | 139 int pages = 3; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 HDC hdc = CreateCompatibleDC(NULL); | 197 HDC hdc = CreateCompatibleDC(NULL); |
| 196 EXPECT_TRUE(hdc); | 198 EXPECT_TRUE(hdc); |
| 197 printing::Emf emf; | 199 printing::Emf emf; |
| 198 EXPECT_TRUE(emf.InitFromFile(metafile_path)); | 200 EXPECT_TRUE(emf.InitFromFile(metafile_path)); |
| 199 RECT output_rect = {0, 0, 10, 10}; | 201 RECT output_rect = {0, 0, 10, 10}; |
| 200 EXPECT_TRUE(emf.Playback(hdc, &output_rect)); | 202 EXPECT_TRUE(emf.Playback(hdc, &output_rect)); |
| 201 EXPECT_TRUE(DeleteDC(hdc)); | 203 EXPECT_TRUE(DeleteDC(hdc)); |
| 202 } | 204 } |
| 203 | 205 |
| 204 } // namespace printing | 206 } // namespace printing |
| OLD | NEW |