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/backend/cups_helper.h" | 5 #include "printing/backend/cups_helper.h" |
6 #include "printing/backend/print_backend.h" | 6 #include "printing/backend/print_backend.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 TEST(PrintBackendCupsHelperTest, TestPpdParsingNoColorDuplexLongEdge) { | 9 TEST(PrintBackendCupsHelperTest, TestPpdParsingNoColorDuplexLongEdge) { |
10 std::string test_ppd_data; | 10 std::string test_ppd_data; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 printing::PrinterSemanticCapsAndDefaults caps; | 165 printing::PrinterSemanticCapsAndDefaults caps; |
166 EXPECT_TRUE(printing::ParsePpdCapabilities("test", test_ppd_data, &caps)); | 166 EXPECT_TRUE(printing::ParsePpdCapabilities("test", test_ppd_data, &caps)); |
167 EXPECT_TRUE(caps.collate_capable); | 167 EXPECT_TRUE(caps.collate_capable); |
168 EXPECT_TRUE(caps.collate_default); | 168 EXPECT_TRUE(caps.collate_default); |
169 EXPECT_TRUE(caps.copies_capable); | 169 EXPECT_TRUE(caps.copies_capable); |
170 EXPECT_TRUE(caps.duplex_capable); | 170 EXPECT_TRUE(caps.duplex_capable); |
171 EXPECT_EQ(caps.duplex_default, printing::LONG_EDGE); | 171 EXPECT_EQ(caps.duplex_default, printing::LONG_EDGE); |
172 EXPECT_TRUE(caps.color_changeable); | 172 EXPECT_TRUE(caps.color_changeable); |
173 EXPECT_FALSE(caps.color_default); | 173 EXPECT_FALSE(caps.color_default); |
174 } | 174 } |
| 175 |
| 176 TEST(PrintBackendCupsHelperTest, TestPpdParsingPageSize) { |
| 177 std::string test_ppd_data; |
| 178 test_ppd_data.append( |
| 179 "*PPD-Adobe: \"4.3\"\n\n" |
| 180 "*OpenUI *PageSize: PickOne\n" |
| 181 "*OrderDependency: 30 AnySetup *PageSize\n" |
| 182 "*DefaultPageSize: Letter\n" |
| 183 "*PageSize Letter/US Letter: \"" |
| 184 " <</DeferredMediaSelection true /PageSize [612 792] " |
| 185 " /ImagingBBox null /MediaClass null >> setpagedevice\"\n" |
| 186 "*End\n" |
| 187 "*PageSize Legal/US Legal: \"" |
| 188 " <</DeferredMediaSelection true /PageSize [612 1008] " |
| 189 " /ImagingBBox null /MediaClass null >> setpagedevice\"\n" |
| 190 "*End\n" |
| 191 "*DefaultPaperDimension: Letter\n" |
| 192 "*PaperDimension Letter/US Letter: \"612 792\"\n" |
| 193 "*PaperDimension Legal/US Legal: \"612 1008\"\n\n" |
| 194 "*CloseUI: *PageSize\n\n"); |
| 195 |
| 196 printing::PrinterSemanticCapsAndDefaults caps; |
| 197 EXPECT_TRUE(printing::ParsePpdCapabilities("test", test_ppd_data, &caps)); |
| 198 ASSERT_EQ(2UL, caps.papers.size()); |
| 199 EXPECT_EQ("Letter", caps.papers[0].vendor_id); |
| 200 EXPECT_EQ("US Letter", caps.papers[0].display_name); |
| 201 EXPECT_EQ(214200, caps.papers[0].size_um.width()); |
| 202 EXPECT_EQ(277200, caps.papers[0].size_um.height()); |
| 203 EXPECT_EQ("Legal", caps.papers[1].vendor_id); |
| 204 EXPECT_EQ("US Legal", caps.papers[1].display_name); |
| 205 EXPECT_EQ(214200, caps.papers[1].size_um.width()); |
| 206 EXPECT_EQ(352800, caps.papers[1].size_um.height()); |
| 207 } |
OLD | NEW |