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

Side by Side Diff: tests/PDFPrimitivesTest.cpp

Issue 2099463002: SkPDF: alloc less memory for strings (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-06-23 (Thursday) 16:23:34 EDT Created 4 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
« src/pdf/SkPDFDevice.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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, ".0000152587890");
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, 220 ASSERT_EMIT_EQ(reporter, stringComplex, "(\\011test \\) string \\( foo)");
221 stringComplex, 221
222 "<0974657374202920737472696E67202820666F6F>"); 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);
224 ASSERT_EMIT_EQ(reporter, binaryString, "<0102030405060708090A0B0C0D0E0F10>") ;
223 225
224 SkString nameInput("Test name\twith#tab"); 226 SkString nameInput("Test name\twith#tab");
225 SkPDFUnion name = SkPDFUnion::Name(nameInput); 227 SkPDFUnion name = SkPDFUnion::Name(nameInput);
226 ASSERT_EMIT_EQ(reporter, name, "/Test#20name#09with#23tab"); 228 ASSERT_EMIT_EQ(reporter, name, "/Test#20name#09with#23tab");
227 229
228 SkString nameInput2("A#/%()<>[]{}B"); 230 SkString nameInput2("A#/%()<>[]{}B");
229 SkPDFUnion name2 = SkPDFUnion::Name(nameInput2); 231 SkPDFUnion name2 = SkPDFUnion::Name(nameInput2);
230 ASSERT_EMIT_EQ(reporter, name2, "/A#23#2F#25#28#29#3C#3E#5B#5D#7B#7DB"); 232 ASSERT_EMIT_EQ(reporter, name2, "/A#23#2F#25#28#29#3C#3E#5B#5D#7B#7DB");
231 233
232 SkPDFUnion name3 = SkPDFUnion::Name("SimpleNameWithOnlyPrintableASCII"); 234 SkPDFUnion name3 = SkPDFUnion::Name("SimpleNameWithOnlyPrintableASCII");
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 float alwaysCheck[] = { 484 float alwaysCheck[] = {
483 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,
484 -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,
485 SK_FloatNaN, SK_FloatInfinity, SK_FloatNegativeInfinity, 487 SK_FloatNaN, SK_FloatInfinity, SK_FloatNegativeInfinity,
486 -FLT_MIN / 8388608.0 488 -FLT_MIN / 8388608.0
487 }; 489 };
488 for (float inputFloat: alwaysCheck) { 490 for (float inputFloat: alwaysCheck) {
489 check_pdf_scalar_serialization(reporter, inputFloat); 491 check_pdf_scalar_serialization(reporter, inputFloat);
490 } 492 }
491 } 493 }
OLDNEW
« src/pdf/SkPDFDevice.cpp ('K') | « src/pdf/SkPDFUtils.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698