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

Side by Side Diff: tests/PDFPrimitivesTest.cpp

Issue 2208743003: SkPDF: fewer GYP_DEFINES (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « gyp/pdf.gyp ('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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 deflateWStream.write(streamBytes2, strlen(streamBytes2)); 107 deflateWStream.write(streamBytes2, strlen(streamBytes2));
108 deflateWStream.finalize(); 108 deflateWStream.finalize();
109 109
110 SkDynamicMemoryWStream expected; 110 SkDynamicMemoryWStream expected;
111 expected.writeText("<</Filter /FlateDecode\n/Length 116>> stream\n"); 111 expected.writeText("<</Filter /FlateDecode\n/Length 116>> stream\n");
112 compressedByteStream.writeToStream(&expected); 112 compressedByteStream.writeToStream(&expected);
113 compressedByteStream.reset(); 113 compressedByteStream.reset();
114 expected.writeText("\nendstream"); 114 expected.writeText("\nendstream");
115 sk_sp<SkData> expectedResultData2(expected.copyToData()); 115 sk_sp<SkData> expectedResultData2(expected.copyToData());
116 SkString result = emit_to_string(*stream); 116 SkString result = emit_to_string(*stream);
117 #ifndef SK_PDF_LESS_COMPRESSION
mtklein 2016/08/03 19:28:45 ? Did this just also not work previously?
117 assert_eql(reporter, 118 assert_eql(reporter,
118 result, 119 result,
119 (const char*)expectedResultData2->data(), 120 (const char*)expectedResultData2->data(),
120 expectedResultData2->size()); 121 expectedResultData2->size());
122 #endif
121 } 123 }
122 } 124 }
123 125
124 static void TestObjectNumberMap(skiatest::Reporter* reporter) { 126 static void TestObjectNumberMap(skiatest::Reporter* reporter) {
125 SkPDFObjNumMap objNumMap; 127 SkPDFObjNumMap objNumMap;
126 sk_sp<SkPDFArray> a1(new SkPDFArray); 128 sk_sp<SkPDFArray> a1(new SkPDFArray);
127 sk_sp<SkPDFArray> a2(new SkPDFArray); 129 sk_sp<SkPDFArray> a2(new SkPDFArray);
128 sk_sp<SkPDFArray> a3(new SkPDFArray); 130 sk_sp<SkPDFArray> a3(new SkPDFArray);
129 131
130 objNumMap.addObject(a1.get()); 132 objNumMap.addObject(a1.get());
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 char buffer[5]; 501 char buffer[5];
500 for (int i = 0; i < 256; ++i) { 502 for (int i = 0; i < 256; ++i) {
501 size_t len = SkPDFUtils::ColorToDecimal(i, buffer); 503 size_t len = SkPDFUtils::ColorToDecimal(i, buffer);
502 REPORTER_ASSERT(reporter, len == strlen(buffer)); 504 REPORTER_ASSERT(reporter, len == strlen(buffer));
503 float f; 505 float f;
504 REPORTER_ASSERT(reporter, 1 == sscanf(buffer, "%f", &f)); 506 REPORTER_ASSERT(reporter, 1 == sscanf(buffer, "%f", &f));
505 int roundTrip = (int)(0.5 + f * 255); 507 int roundTrip = (int)(0.5 + f * 255);
506 REPORTER_ASSERT(reporter, roundTrip == i); 508 REPORTER_ASSERT(reporter, roundTrip == i);
507 } 509 }
508 } 510 }
OLDNEW
« no previous file with comments | « gyp/pdf.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698