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 "SkRandom.h" | 9 #include "SkRandom.h" |
10 #include "SkStream.h" | 10 #include "SkStream.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } | 148 } |
149 | 149 |
150 { | 150 { |
151 SkData* data = ds.copyToData(); | 151 SkData* data = ds.copyToData(); |
152 REPORTER_ASSERT(reporter, 100 * 26 == data->size()); | 152 REPORTER_ASSERT(reporter, 100 * 26 == data->size()); |
153 REPORTER_ASSERT(reporter, memcmp(dst, data->data(), data->size()) == 0); | 153 REPORTER_ASSERT(reporter, memcmp(dst, data->data(), data->size()) == 0); |
154 data->unref(); | 154 data->unref(); |
155 } | 155 } |
156 delete[] dst; | 156 delete[] dst; |
157 | 157 |
158 if (skiatest::Test::GetTmpDir()) { | 158 if (!skiatest::Test::GetTmpDir().isEmpty()) { |
159 test_filestreams(reporter, skiatest::Test::GetTmpDir()); | 159 test_filestreams(reporter, skiatest::Test::GetTmpDir().c_str()); |
160 } | 160 } |
161 } | 161 } |
162 | 162 |
163 static void TestPackedUInt(skiatest::Reporter* reporter) { | 163 static void TestPackedUInt(skiatest::Reporter* reporter) { |
164 // we know that packeduint tries to write 1, 2 or 4 bytes for the length, | 164 // we know that packeduint tries to write 1, 2 or 4 bytes for the length, |
165 // so we test values around each of those transitions (and a few others) | 165 // so we test values around each of those transitions (and a few others) |
166 const size_t sizes[] = { | 166 const size_t sizes[] = { |
167 0, 1, 2, 0xFC, 0xFD, 0xFE, 0xFF, 0x100, 0x101, 32767, 32768, 32769, | 167 0, 1, 2, 0xFC, 0xFD, 0xFE, 0xFF, 0x100, 0x101, 32767, 32768, 32769, |
168 0xFFFD, 0xFFFE, 0xFFFF, 0x10000, 0x10001, | 168 0xFFFD, 0xFFFE, 0xFFFF, 0x10000, 0x10001, |
169 0xFFFFFD, 0xFFFFFE, 0xFFFFFF, 0x1000000, 0x1000001, | 169 0xFFFFFD, 0xFFFFFE, 0xFFFFFF, 0x1000000, 0x1000001, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 static void TestStreams(skiatest::Reporter* reporter) { | 212 static void TestStreams(skiatest::Reporter* reporter) { |
213 TestRStream(reporter); | 213 TestRStream(reporter); |
214 TestWStream(reporter); | 214 TestWStream(reporter); |
215 TestPackedUInt(reporter); | 215 TestPackedUInt(reporter); |
216 TestNullData(); | 216 TestNullData(); |
217 } | 217 } |
218 | 218 |
219 #include "TestClassDef.h" | 219 #include "TestClassDef.h" |
220 DEFINE_TESTCLASS("Stream", StreamTestClass, TestStreams) | 220 DEFINE_TESTCLASS("Stream", StreamTestClass, TestStreams) |
OLD | NEW |