OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "printing/backend/cups_helper.h" | |
6 #include "printing/backend/print_backend.h" | |
7 #include "testing/gtest/include/gtest/gtest.h" | |
8 | |
9 TEST(PrintBackendCupsHelperTest, TestPpdParsing) { | |
10 std::string test_ppd_data; | |
11 test_ppd_data.append("*PPD-Adobe: \"4.3\"\n\n" | |
12 "*OpenGroup: General/General\n\n" | |
13 "*OpenUI *ColorModel/Color Model: PickOne\n" | |
14 "*DefaultColorModel: Gray\n" | |
15 "*ColorModel Gray/Grayscale: \"" | |
16 "<</cupsColorSpace 0/cupsColorOrder 0>>" | |
17 "setpagedevice\"\n" | |
18 "*ColorModel Black/Inverted Grayscale: \"" | |
19 "<</cupsColorSpace 3/cupsColorOrder 0>>" | |
20 "setpagedevice\"\n" | |
21 "*CloseUI: *ColorModel\n" | |
22 "*OpenUI *Duplex/2-Sided Printing: PickOne\n" | |
23 "*DefaultDuplex: DuplexTumble\n" | |
24 "*Duplex None/Off: \"<</Duplex false>>" | |
25 "setpagedevice\"\n" | |
26 "*Duplex DuplexNoTumble/LongEdge: \"" | |
27 "<</Duplex true/Tumble false>>setpagedevice\"\n" | |
28 "*Duplex DuplexTumble/ShortEdge: \"" | |
29 "<</Duplex true/Tumble true>>setpagedevice\"\n" | |
30 "*CloseUI: *Duplex\n\n" | |
31 "*CloseGroup: General\n"); | |
32 | |
33 printing::PrinterSemanticCapsAndDefaults caps; | |
34 EXPECT_TRUE(printing::parsePpdCapabilities("test", test_ppd_data, &caps)); | |
35 EXPECT_FALSE(caps.color_capable); | |
36 EXPECT_FALSE(caps.color_default); | |
37 EXPECT_TRUE(caps.duplex_capable); | |
38 EXPECT_EQ(caps.duplex_default, printing::LONG_EDGE); | |
39 } | |
40 | |
41 // Test duplex detection code, which regressed in http://crbug.com/103999. | |
Albert Bodenhamer
2012/09/04 23:09:36
Should there be more tests here? Different ways o
gene
2012/09/04 23:19:50
Sure. Let me add more. I've copied existing tests
| |
42 TEST(PrintBackendCupsHelperTest, TestPpdParsing2) { | |
43 std::string test_ppd_data; | |
44 test_ppd_data.append( | |
45 "*PPD-Adobe: \"4.3\"\n\n" | |
46 "*OpenGroup: General/General\n\n" | |
47 "*OpenUI *Duplex/Double-Sided Printing: PickOne\n" | |
48 "*DefaultDuplex: None\n" | |
49 "*Duplex None/Off: " | |
50 "\"<</Duplex false>>setpagedevice\"\n" | |
51 "*Duplex DuplexNoTumble/Long Edge (Standard): " | |
52 "\"<</Duplex true/Tumble false>>setpagedevice\"\n" | |
53 "*Duplex DuplexTumble/Short Edge (Flip): " | |
54 "\"<</Duplex true/Tumble true>>setpagedevice\"\n" | |
55 "*CloseUI: *Duplex\n\n" | |
56 "*CloseGroup: General\n"); | |
57 | |
58 printing::PrinterSemanticCapsAndDefaults caps; | |
59 EXPECT_TRUE(printing::parsePpdCapabilities("test", test_ppd_data, &caps)); | |
60 EXPECT_FALSE(caps.color_capable); | |
61 EXPECT_FALSE(caps.color_default); | |
62 EXPECT_TRUE(caps.duplex_capable); | |
63 EXPECT_EQ(caps.duplex_default, printing::SIMPLEX); | |
64 } | |
OLD | NEW |