OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 base::FilePath emf_file; | 89 base::FilePath emf_file; |
90 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &emf_file)); | 90 EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &emf_file)); |
91 emf_file = emf_file.Append(FILE_PATH_LITERAL("printing")) | 91 emf_file = emf_file.Append(FILE_PATH_LITERAL("printing")) |
92 .Append(FILE_PATH_LITERAL("test")) | 92 .Append(FILE_PATH_LITERAL("test")) |
93 .Append(FILE_PATH_LITERAL("data")) | 93 .Append(FILE_PATH_LITERAL("data")) |
94 .Append(FILE_PATH_LITERAL("test4.emf")); | 94 .Append(FILE_PATH_LITERAL("test4.emf")); |
95 // Load any EMF with an image. | 95 // Load any EMF with an image. |
96 Emf emf; | 96 Emf emf; |
97 std::string emf_data; | 97 std::string emf_data; |
98 file_util::ReadFileToString(emf_file, &emf_data); | 98 base::ReadFileToString(emf_file, &emf_data); |
99 ASSERT_TRUE(emf_data.size()); | 99 ASSERT_TRUE(emf_data.size()); |
100 EXPECT_TRUE(emf.InitFromData(&emf_data[0], emf_data.size())); | 100 EXPECT_TRUE(emf.InitFromData(&emf_data[0], emf_data.size())); |
101 | 101 |
102 // This will print to file. The reason is that when running inside a | 102 // This will print to file. The reason is that when running inside a |
103 // unit_test, PrintingContext automatically dumps its files to the | 103 // unit_test, PrintingContext automatically dumps its files to the |
104 // current directory. | 104 // current directory. |
105 // TODO(maruel): Clean the .PRN file generated in current directory. | 105 // TODO(maruel): Clean the .PRN file generated in current directory. |
106 context->NewDocument(L"EmfTest.Enumerate"); | 106 context->NewDocument(L"EmfTest.Enumerate"); |
107 context->NewPage(); | 107 context->NewPage(); |
108 // Process one at a time. | 108 // Process one at a time. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 EXPECT_EQ(emf.GetPageBounds(1), raster->GetPageBounds(1)); | 221 EXPECT_EQ(emf.GetPageBounds(1), raster->GetPageBounds(1)); |
222 | 222 |
223 raster.reset(emf.RasterizeMetafile(16*1024*1024)); | 223 raster.reset(emf.RasterizeMetafile(16*1024*1024)); |
224 // Expected size about 64MB. | 224 // Expected size about 64MB. |
225 EXPECT_LE(abs(int(raster->GetDataSize()) - 64*1024*1024), 1024*1024); | 225 EXPECT_LE(abs(int(raster->GetDataSize()) - 64*1024*1024), 1024*1024); |
226 // Bounds should still be the same. | 226 // Bounds should still be the same. |
227 EXPECT_EQ(emf.GetPageBounds(1), raster->GetPageBounds(1)); | 227 EXPECT_EQ(emf.GetPageBounds(1), raster->GetPageBounds(1)); |
228 } | 228 } |
229 | 229 |
230 } // namespace printing | 230 } // namespace printing |
OLD | NEW |