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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/backend/cups_helper.cc ('k') | printing/backend/print_backend.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/backend/cups_helper_unittest.cc
diff --git a/printing/backend/cups_helper_unittest.cc b/printing/backend/cups_helper_unittest.cc
index 83dc0a1135e2654c932dc2a6db44dfc24247d0eb..2a0e72b14cd52ad00bc5eb51923df73b83838deb 100644
--- a/printing/backend/cups_helper_unittest.cc
+++ b/printing/backend/cups_helper_unittest.cc
@@ -172,3 +172,36 @@ TEST(PrintBackendCupsHelperTest, TestPpdParsingColorFalseDuplexLongEdge) {
EXPECT_TRUE(caps.color_changeable);
EXPECT_FALSE(caps.color_default);
}
+
+TEST(PrintBackendCupsHelperTest, TestPpdParsingPageSize) {
+ std::string test_ppd_data;
+ test_ppd_data.append(
+ "*PPD-Adobe: \"4.3\"\n\n"
+ "*OpenUI *PageSize: PickOne\n"
+ "*OrderDependency: 30 AnySetup *PageSize\n"
+ "*DefaultPageSize: Letter\n"
+ "*PageSize Letter/US Letter: \""
+ " <</DeferredMediaSelection true /PageSize [612 792] "
+ " /ImagingBBox null /MediaClass null >> setpagedevice\"\n"
+ "*End\n"
+ "*PageSize Legal/US Legal: \""
+ " <</DeferredMediaSelection true /PageSize [612 1008] "
+ " /ImagingBBox null /MediaClass null >> setpagedevice\"\n"
+ "*End\n"
+ "*DefaultPaperDimension: Letter\n"
+ "*PaperDimension Letter/US Letter: \"612 792\"\n"
+ "*PaperDimension Legal/US Legal: \"612 1008\"\n\n"
+ "*CloseUI: *PageSize\n\n");
+
+ printing::PrinterSemanticCapsAndDefaults caps;
+ EXPECT_TRUE(printing::ParsePpdCapabilities("test", test_ppd_data, &caps));
+ ASSERT_EQ(2UL, caps.papers.size());
+ EXPECT_EQ("Letter", caps.papers[0].vendor_id);
+ EXPECT_EQ("US Letter", caps.papers[0].display_name);
+ EXPECT_EQ(214200, caps.papers[0].size_um.width());
+ EXPECT_EQ(277200, caps.papers[0].size_um.height());
+ EXPECT_EQ("Legal", caps.papers[1].vendor_id);
+ EXPECT_EQ("US Legal", caps.papers[1].display_name);
+ EXPECT_EQ(214200, caps.papers[1].size_um.width());
+ EXPECT_EQ(352800, caps.papers[1].size_um.height());
+}
« 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