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

Side by Side Diff: tests/DataRefTest.cpp

Issue 132843002: Add REPORTF test macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: final rebase Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « tests/BlitRowTest.cpp ('k') | tests/EmptyPathTest.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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 "Test.h" 8 #include "Test.h"
9 #include "TestClassDef.h" 9 #include "TestClassDef.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (tmpDir.isEmpty()) { 179 if (tmpDir.isEmpty()) {
180 return; 180 return;
181 } 181 }
182 182
183 SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "data_test"); 183 SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "data_test");
184 184
185 const char s[] = "abcdefghijklmnopqrstuvwxyz"; 185 const char s[] = "abcdefghijklmnopqrstuvwxyz";
186 { 186 {
187 SkFILEWStream writer(path.c_str()); 187 SkFILEWStream writer(path.c_str());
188 if (!writer.isValid()) { 188 if (!writer.isValid()) {
189 SkString msg; 189 ERRORF(reporter, "Failed to create tmp file %s\n", path.c_str());
190 msg.printf("Failed to create tmp file %s\n", path.c_str());
191 reporter->reportFailed(msg);
192 return; 190 return;
193 } 191 }
194 writer.write(s, 26); 192 writer.write(s, 26);
195 } 193 }
196 194
197 SkFILE* file = sk_fopen(path.c_str(), kRead_SkFILE_Flag); 195 SkFILE* file = sk_fopen(path.c_str(), kRead_SkFILE_Flag);
198 SkAutoTUnref<SkData> r1(SkData::NewFromFILE(file)); 196 SkAutoTUnref<SkData> r1(SkData::NewFromFILE(file));
199 REPORTER_ASSERT(reporter, r1.get() != NULL); 197 REPORTER_ASSERT(reporter, r1.get() != NULL);
200 REPORTER_ASSERT(reporter, r1->size() == 26); 198 REPORTER_ASSERT(reporter, r1->size() == 26);
201 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 2 6) == 0); 199 REPORTER_ASSERT(reporter, strncmp(static_cast<const char*>(r1->data()), s, 2 6) == 0);
(...skipping 26 matching lines...) Expand all
228 SkData* tmp = SkData::NewSubset(r1, strlen(str), 10); 226 SkData* tmp = SkData::NewSubset(r1, strlen(str), 10);
229 assert_len(reporter, tmp, 0); 227 assert_len(reporter, tmp, 0);
230 tmp->unref(); 228 tmp->unref();
231 tmp = SkData::NewSubset(r1, 0, 0); 229 tmp = SkData::NewSubset(r1, 0, 0);
232 assert_len(reporter, tmp, 0); 230 assert_len(reporter, tmp, 0);
233 tmp->unref(); 231 tmp->unref();
234 232
235 test_cstring(reporter); 233 test_cstring(reporter);
236 test_files(reporter); 234 test_files(reporter);
237 } 235 }
OLDNEW
« no previous file with comments | « tests/BlitRowTest.cpp ('k') | tests/EmptyPathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698