OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Test.h" | 8 #include "Test.h" |
9 #include "SkData.h" | 9 #include "SkData.h" |
10 #include "SkDataSet.h" | 10 #include "SkDataSet.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 SkAutoTUnref<SkData> r1(SkData::NewWithCString(str)); | 253 SkAutoTUnref<SkData> r1(SkData::NewWithCString(str)); |
254 | 254 |
255 REPORTER_ASSERT(reporter, r0->equals(r1)); | 255 REPORTER_ASSERT(reporter, r0->equals(r1)); |
256 | 256 |
257 SkAutoTUnref<SkData> r2(SkData::NewWithCString(NULL)); | 257 SkAutoTUnref<SkData> r2(SkData::NewWithCString(NULL)); |
258 REPORTER_ASSERT(reporter, 1 == r2->size()); | 258 REPORTER_ASSERT(reporter, 1 == r2->size()); |
259 REPORTER_ASSERT(reporter, 0 == *r2->bytes()); | 259 REPORTER_ASSERT(reporter, 0 == *r2->bytes()); |
260 } | 260 } |
261 | 261 |
262 static void test_files(skiatest::Reporter* reporter) { | 262 static void test_files(skiatest::Reporter* reporter) { |
263 if (skiatest::Test::GetTmpDir().isEmpty()) { | 263 SkString tmpDir = skiatest::Test::GetTmpDir(); |
| 264 if (tmpDir.isEmpty()) { |
264 return; | 265 return; |
265 } | 266 } |
266 | 267 |
267 const char* tmpDir = skiatest::Test::GetTmpDir().c_str(); | 268 SkString path = SkOSPath::SkPathJoin(tmpDir.c_str(), "data_test"); |
268 SkString path; | |
269 path.printf("%s%s", tmpDir, "data_test"); | |
270 | 269 |
271 const char s[] = "abcdefghijklmnopqrstuvwxyz"; | 270 const char s[] = "abcdefghijklmnopqrstuvwxyz"; |
272 { | 271 { |
273 SkFILEWStream writer(path.c_str()); | 272 SkFILEWStream writer(path.c_str()); |
274 if (!writer.isValid()) { | 273 if (!writer.isValid()) { |
275 SkString msg; | 274 SkString msg; |
276 msg.printf("Failed to create tmp file %s\n", path.c_str()); | 275 msg.printf("Failed to create tmp file %s\n", path.c_str()); |
277 reporter->reportFailed(msg.c_str()); | 276 reporter->reportFailed(msg.c_str()); |
278 return; | 277 return; |
279 } | 278 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 tmp->unref(); | 318 tmp->unref(); |
320 | 319 |
321 test_cstring(reporter); | 320 test_cstring(reporter); |
322 test_dataset(reporter); | 321 test_dataset(reporter); |
323 test_files(reporter); | 322 test_files(reporter); |
324 } | 323 } |
325 | 324 |
326 #include "TestClassDef.h" | 325 #include "TestClassDef.h" |
327 DEFINE_TESTCLASS("Data", DataTestClass, TestData) | 326 DEFINE_TESTCLASS("Data", DataTestClass, TestData) |
328 DEFINE_TESTCLASS("DataTable", DataTableTestClass, TestDataTable) | 327 DEFINE_TESTCLASS("DataTable", DataTableTestClass, TestDataTable) |
OLD | NEW |