OLD | NEW |
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 "SkData.h" | 8 #include "SkData.h" |
9 #include "SkDataTable.h" | 9 #include "SkDataTable.h" |
10 #include "SkOSFile.h" | 10 #include "SkOSFile.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 SkAutoTUnref<SkData> r1(SkData::NewWithCString(str)); | 167 SkAutoTUnref<SkData> r1(SkData::NewWithCString(str)); |
168 | 168 |
169 REPORTER_ASSERT(reporter, r0->equals(r1)); | 169 REPORTER_ASSERT(reporter, r0->equals(r1)); |
170 | 170 |
171 SkAutoTUnref<SkData> r2(SkData::NewWithCString(NULL)); | 171 SkAutoTUnref<SkData> r2(SkData::NewWithCString(NULL)); |
172 REPORTER_ASSERT(reporter, 1 == r2->size()); | 172 REPORTER_ASSERT(reporter, 1 == r2->size()); |
173 REPORTER_ASSERT(reporter, 0 == *r2->bytes()); | 173 REPORTER_ASSERT(reporter, 0 == *r2->bytes()); |
174 } | 174 } |
175 | 175 |
176 static void test_files(skiatest::Reporter* reporter) { | 176 static void test_files(skiatest::Reporter* reporter) { |
177 SkString tmpDir = skiatest::Test::GetTmpDir(); | 177 SkString tmpDir = skiatest::GetTmpDir(); |
178 if (tmpDir.isEmpty()) { | 178 if (tmpDir.isEmpty()) { |
179 return; | 179 return; |
180 } | 180 } |
181 | 181 |
182 SkString path = SkOSPath::Join(tmpDir.c_str(), "data_test"); | 182 SkString path = SkOSPath::Join(tmpDir.c_str(), "data_test"); |
183 | 183 |
184 const char s[] = "abcdefghijklmnopqrstuvwxyz"; | 184 const char s[] = "abcdefghijklmnopqrstuvwxyz"; |
185 { | 185 { |
186 SkFILEWStream writer(path.c_str()); | 186 SkFILEWStream writer(path.c_str()); |
187 if (!writer.isValid()) { | 187 if (!writer.isValid()) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 SkData* tmp = SkData::NewSubset(r1, strlen(str), 10); | 225 SkData* tmp = SkData::NewSubset(r1, strlen(str), 10); |
226 assert_len(reporter, tmp, 0); | 226 assert_len(reporter, tmp, 0); |
227 tmp->unref(); | 227 tmp->unref(); |
228 tmp = SkData::NewSubset(r1, 0, 0); | 228 tmp = SkData::NewSubset(r1, 0, 0); |
229 assert_len(reporter, tmp, 0); | 229 assert_len(reporter, tmp, 0); |
230 tmp->unref(); | 230 tmp->unref(); |
231 | 231 |
232 test_cstring(reporter); | 232 test_cstring(reporter); |
233 test_files(reporter); | 233 test_files(reporter); |
234 } | 234 } |
OLD | NEW |