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

Unified Diff: tests/PDFPrimitivesTest.cpp

Issue 2151863003: SkPdf: smaller color serialization (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: SkFixed - 2016-07-15 (Friday) 15:45:32 EDT Created 4 years, 5 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 | « src/pdf/SkPDFUtils.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PDFPrimitivesTest.cpp
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 9e2a89e60953b067faf69e588a05bad9b6a07657..d816b60823010b3fbc76187306fd2f2b155b6b73 100644
--- a/tests/PDFPrimitivesTest.cpp
+++ b/tests/PDFPrimitivesTest.cpp
@@ -491,3 +491,16 @@ DEF_TEST(PDFPrimitives_Scalar, reporter) {
check_pdf_scalar_serialization(reporter, inputFloat);
}
}
+
+// Test SkPDFUtils:: for accuracy.
+DEF_TEST(PDFPrimitives_Color, reporter) {
+ char buffer[5];
+ for (int i = 0; i < 256; ++i) {
+ size_t len = SkPDFUtils::ColorToDecimal(i, buffer);
+ REPORTER_ASSERT(reporter, len == strlen(buffer));
+ float f;
+ REPORTER_ASSERT(reporter, 1 == sscanf(buffer, "%f", &f));
+ int roundTrip = (int)(0.5 + f * 255);
+ REPORTER_ASSERT(reporter, roundTrip == i);
+ }
+}
« no previous file with comments | « src/pdf/SkPDFUtils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698