Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: printing/backend/cups_helper_unittest.cc

Issue 2769913002: Better detect color options for Samsung CUPS printers. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « printing/backend/cups_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, TestPpdParsingNoColorDuplexShortEdge) { 9 TEST(PrintBackendCupsHelperTest, TestPpdParsingNoColorDuplexShortEdge) {
10 const char kTestPpdData[] = 10 const char kTestPpdData[] =
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 EXPECT_TRUE(caps.duplex_capable); 165 EXPECT_TRUE(caps.duplex_capable);
166 EXPECT_EQ(printing::LONG_EDGE, caps.duplex_default); 166 EXPECT_EQ(printing::LONG_EDGE, caps.duplex_default);
167 EXPECT_TRUE(caps.color_changeable); 167 EXPECT_TRUE(caps.color_changeable);
168 EXPECT_FALSE(caps.color_default); 168 EXPECT_FALSE(caps.color_default);
169 } 169 }
170 170
171 TEST(PrintBackendCupsHelperTest, TestPpdParsingPageSize) { 171 TEST(PrintBackendCupsHelperTest, TestPpdParsingPageSize) {
172 const char kTestPpdData[] = 172 const char kTestPpdData[] =
173 "*PPD-Adobe: \"4.3\"\n\n" 173 "*PPD-Adobe: \"4.3\"\n\n"
174 "*OpenUI *PageSize: PickOne\n" 174 "*OpenUI *PageSize: PickOne\n"
175 "*OrderDependency: 30 AnySetup *PageSize\n"
176 "*DefaultPageSize: Letter\n" 175 "*DefaultPageSize: Letter\n"
177 "*PageSize Letter/US Letter: \"" 176 "*PageSize Letter/US Letter: \""
178 " <</DeferredMediaSelection true /PageSize [612 792] " 177 " <</DeferredMediaSelection true /PageSize [612 792] "
179 " /ImagingBBox null /MediaClass null >> setpagedevice\"\n" 178 " /ImagingBBox null /MediaClass null >> setpagedevice\"\n"
180 "*End\n" 179 "*End\n"
181 "*PageSize Legal/US Legal: \"" 180 "*PageSize Legal/US Legal: \""
182 " <</DeferredMediaSelection true /PageSize [612 1008] " 181 " <</DeferredMediaSelection true /PageSize [612 1008] "
183 " /ImagingBBox null /MediaClass null >> setpagedevice\"\n" 182 " /ImagingBBox null /MediaClass null >> setpagedevice\"\n"
184 "*End\n" 183 "*End\n"
185 "*DefaultPaperDimension: Letter\n" 184 "*DefaultPaperDimension: Letter\n"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 EXPECT_TRUE(caps.color_changeable); 234 EXPECT_TRUE(caps.color_changeable);
236 EXPECT_TRUE(caps.color_default); 235 EXPECT_TRUE(caps.color_default);
237 EXPECT_EQ(printing::BROTHER_CUPS_COLOR, caps.color_model); 236 EXPECT_EQ(printing::BROTHER_CUPS_COLOR, caps.color_model);
238 EXPECT_EQ(printing::BROTHER_CUPS_MONO, caps.bw_model); 237 EXPECT_EQ(printing::BROTHER_CUPS_MONO, caps.bw_model);
239 } 238 }
240 { 239 {
241 const char kTestPpdData[] = 240 const char kTestPpdData[] =
242 "*PPD-Adobe: \"4.3\"\n\n" 241 "*PPD-Adobe: \"4.3\"\n\n"
243 "*ColorDevice: True\n" 242 "*ColorDevice: True\n"
244 "*OpenUI *BRDuplex/Two-Sided Printing: PickOne\n" 243 "*OpenUI *BRDuplex/Two-Sided Printing: PickOne\n"
245 "*OrderDependency: 25 AnySetup *BRDuplex\n"
246 "*DefaultBRDuplex: DuplexTumble\n" 244 "*DefaultBRDuplex: DuplexTumble\n"
247 "*BRDuplex DuplexTumble/Short-Edge Binding: \"\"\n" 245 "*BRDuplex DuplexTumble/Short-Edge Binding: \"\"\n"
248 "*BRDuplex DuplexNoTumble/Long-Edge Binding: \"\"\n" 246 "*BRDuplex DuplexNoTumble/Long-Edge Binding: \"\"\n"
249 "*BRDuplex None/Off: \"\"\n" 247 "*BRDuplex None/Off: \"\"\n"
250 "*CloseUI: *BRDuplex\n\n"; 248 "*CloseUI: *BRDuplex\n\n";
251 249
252 printing::PrinterSemanticCapsAndDefaults caps; 250 printing::PrinterSemanticCapsAndDefaults caps;
253 EXPECT_TRUE(printing::ParsePpdCapabilities("test", kTestPpdData, &caps)); 251 EXPECT_TRUE(printing::ParsePpdCapabilities("test", kTestPpdData, &caps));
254 EXPECT_TRUE(caps.duplex_capable); 252 EXPECT_TRUE(caps.duplex_capable);
255 EXPECT_EQ(printing::SHORT_EDGE, caps.duplex_default); 253 EXPECT_EQ(printing::SHORT_EDGE, caps.duplex_default);
256 } 254 }
257 } 255 }
256
257 TEST(PrintBackendCupsHelperTest, TestPpdParsingSamsungPrinters) {
258 {
259 const char kTestPpdData[] =
260 "*PPD-Adobe: \"4.3\"\n\n"
261 "*ColorDevice: True\n"
262 "*OpenUI *ColorMode/Color Mode: Boolean\n"
263 "*DefaultColorMode: True\n"
264 "*ColorMode False/Grayscale: \"\"\n"
265 "*ColorMode True/Color: \"\"\n"
266 "*CloseUI: *ColorMode\n\n";
267
268 printing::PrinterSemanticCapsAndDefaults caps;
269 EXPECT_TRUE(printing::ParsePpdCapabilities("test", kTestPpdData, &caps));
270 EXPECT_TRUE(caps.color_changeable);
271 EXPECT_TRUE(caps.color_default);
272 EXPECT_EQ(printing::COLORMODE_COLOR, caps.color_model);
273 EXPECT_EQ(printing::COLORMODE_MONOCHROME, caps.bw_model);
274 }
275 }
OLDNEW
« no previous file with comments | « printing/backend/cups_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698