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

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

Issue 334763002: Add paper size reporting for CUPS printers (to let user to select one in the Print Preview). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add unit test for PPD page size extraction, log error on PPD file opening, address other cl comment… Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « printing/backend/cups_helper.cc ('k') | printing/backend/print_backend.h » ('j') | 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, 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
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 }
OLDNEW
« no previous file with comments | « printing/backend/cups_helper.cc ('k') | printing/backend/print_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698