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

Side by Side Diff: tests/PDFPrimitivesTest.cpp

Issue 2146103004: SkPDF: re-work SkPDFUtils::FloatToDecimal (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-07-14 (Thursday) 15:50:08 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 unified diff | Download patch
« src/pdf/SkPDFUtils.cpp ('K') | « src/pdf/SkPDFUtils.cpp ('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 /* 1 /*
2 * Copyright 2010 The Android Open Source Project 2 * Copyright 2010 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Resources.h" 8 #include "Resources.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 SkPDFUnion realHalf = SkPDFUnion::Scalar(SK_ScalarHalf); 203 SkPDFUnion realHalf = SkPDFUnion::Scalar(SK_ScalarHalf);
204 ASSERT_EMIT_EQ(reporter, realHalf, ".5"); 204 ASSERT_EMIT_EQ(reporter, realHalf, ".5");
205 205
206 SkPDFUnion bigScalar = SkPDFUnion::Scalar(110999.75f); 206 SkPDFUnion bigScalar = SkPDFUnion::Scalar(110999.75f);
207 ASSERT_EMIT_EQ(reporter, bigScalar, "110999.75"); 207 ASSERT_EMIT_EQ(reporter, bigScalar, "110999.75");
208 208
209 SkPDFUnion biggerScalar = SkPDFUnion::Scalar(50000000.1f); 209 SkPDFUnion biggerScalar = SkPDFUnion::Scalar(50000000.1f);
210 ASSERT_EMIT_EQ(reporter, biggerScalar, "50000000"); 210 ASSERT_EMIT_EQ(reporter, biggerScalar, "50000000");
211 211
212 SkPDFUnion smallestScalar = SkPDFUnion::Scalar(1.0f / 65536); 212 SkPDFUnion smallestScalar = SkPDFUnion::Scalar(1.0f / 65536);
213 ASSERT_EMIT_EQ(reporter, smallestScalar, ".0000152587890"); 213 ASSERT_EMIT_EQ(reporter, smallestScalar, ".0000152587891");
tomhudson 2016/07/15 20:45:42 One digit change? How did this ever work? Or is th
hal.canary 2016/07/17 02:33:42 Both values round back to the original float value
214 214
215 SkPDFUnion stringSimple = SkPDFUnion::String("test ) string ( foo"); 215 SkPDFUnion stringSimple = SkPDFUnion::String("test ) string ( foo");
216 ASSERT_EMIT_EQ(reporter, stringSimple, "(test \\) string \\( foo)"); 216 ASSERT_EMIT_EQ(reporter, stringSimple, "(test \\) string \\( foo)");
217 217
218 SkString stringComplexInput("\ttest ) string ( foo"); 218 SkString stringComplexInput("\ttest ) string ( foo");
219 SkPDFUnion stringComplex = SkPDFUnion::String(stringComplexInput); 219 SkPDFUnion stringComplex = SkPDFUnion::String(stringComplexInput);
220 ASSERT_EMIT_EQ(reporter, stringComplex, "(\\011test \\) string \\( foo)"); 220 ASSERT_EMIT_EQ(reporter, stringComplex, "(\\011test \\) string \\( foo)");
221 221
222 SkString binaryStringInput("\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\20"); 222 SkString binaryStringInput("\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\20");
223 SkPDFUnion binaryString = SkPDFUnion::String(binaryStringInput); 223 SkPDFUnion binaryString = SkPDFUnion::String(binaryStringInput);
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 float alwaysCheck[] = { 484 float alwaysCheck[] = {
485 0.0f, -0.0f, 1.0f, -1.0f, SK_ScalarPI, 0.1f, FLT_MIN, FLT_MAX, 485 0.0f, -0.0f, 1.0f, -1.0f, SK_ScalarPI, 0.1f, FLT_MIN, FLT_MAX,
486 -FLT_MIN, -FLT_MAX, FLT_MIN / 16.0f, -FLT_MIN / 16.0f, 486 -FLT_MIN, -FLT_MAX, FLT_MIN / 16.0f, -FLT_MIN / 16.0f,
487 SK_FloatNaN, SK_FloatInfinity, SK_FloatNegativeInfinity, 487 SK_FloatNaN, SK_FloatInfinity, SK_FloatNegativeInfinity,
488 -FLT_MIN / 8388608.0 488 -FLT_MIN / 8388608.0
489 }; 489 };
490 for (float inputFloat: alwaysCheck) { 490 for (float inputFloat: alwaysCheck) {
491 check_pdf_scalar_serialization(reporter, inputFloat); 491 check_pdf_scalar_serialization(reporter, inputFloat);
492 } 492 }
493 } 493 }
OLDNEW
« src/pdf/SkPDFUtils.cpp ('K') | « src/pdf/SkPDFUtils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698