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

Side by Side Diff: tests/PDFPrimitivesTest.cpp

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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 | « tests/PDFMetadataAttributeTest.cpp ('k') | tests/PathTest.cpp » ('j') | 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 SkDynamicMemoryWStream compressedByteStream; 99 SkDynamicMemoryWStream compressedByteStream;
100 SkDeflateWStream deflateWStream(&compressedByteStream); 100 SkDeflateWStream deflateWStream(&compressedByteStream);
101 deflateWStream.write(streamBytes2, strlen(streamBytes2)); 101 deflateWStream.write(streamBytes2, strlen(streamBytes2));
102 deflateWStream.finalize(); 102 deflateWStream.finalize();
103 103
104 SkDynamicMemoryWStream expected; 104 SkDynamicMemoryWStream expected;
105 expected.writeText("<</Filter /FlateDecode\n/Length 116>> stream\n"); 105 expected.writeText("<</Filter /FlateDecode\n/Length 116>> stream\n");
106 compressedByteStream.writeToStream(&expected); 106 compressedByteStream.writeToStream(&expected);
107 compressedByteStream.reset(); 107 compressedByteStream.reset();
108 expected.writeText("\nendstream"); 108 expected.writeText("\nendstream");
109 sk_sp<SkData> expectedResultData2(expected.copyToData()); 109 sk_sp<SkData> expectedResultData2(expected.detachAsData());
110 SkString result = emit_to_string(*stream); 110 SkString result = emit_to_string(*stream);
111 #ifndef SK_PDF_LESS_COMPRESSION 111 #ifndef SK_PDF_LESS_COMPRESSION
112 assert_eql(reporter, 112 assert_eql(reporter,
113 result, 113 result,
114 (const char*)expectedResultData2->data(), 114 (const char*)expectedResultData2->data(),
115 expectedResultData2->size()); 115 expectedResultData2->size());
116 #endif 116 #endif
117 } 117 }
118 } 118 }
119 119
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 char buffer[5]; 479 char buffer[5];
480 for (int i = 0; i < 256; ++i) { 480 for (int i = 0; i < 256; ++i) {
481 size_t len = SkPDFUtils::ColorToDecimal(i, buffer); 481 size_t len = SkPDFUtils::ColorToDecimal(i, buffer);
482 REPORTER_ASSERT(reporter, len == strlen(buffer)); 482 REPORTER_ASSERT(reporter, len == strlen(buffer));
483 float f; 483 float f;
484 REPORTER_ASSERT(reporter, 1 == sscanf(buffer, "%f", &f)); 484 REPORTER_ASSERT(reporter, 1 == sscanf(buffer, "%f", &f));
485 int roundTrip = (int)(0.5 + f * 255); 485 int roundTrip = (int)(0.5 + f * 255);
486 REPORTER_ASSERT(reporter, roundTrip == i); 486 REPORTER_ASSERT(reporter, roundTrip == i);
487 } 487 }
488 } 488 }
OLDNEW
« no previous file with comments | « tests/PDFMetadataAttributeTest.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698