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 18 matching lines...) Expand all Loading... |
29 static void test_datatable_flatten(skiatest::Reporter* reporter, | 29 static void test_datatable_flatten(skiatest::Reporter* reporter, |
30 SkDataTable* table) { | 30 SkDataTable* table) { |
31 SkOrderedWriteBuffer wb(1024); | 31 SkOrderedWriteBuffer wb(1024); |
32 wb.writeFlattenable(table); | 32 wb.writeFlattenable(table); |
33 | 33 |
34 size_t wsize = wb.size(); | 34 size_t wsize = wb.size(); |
35 SkAutoMalloc storage(wsize); | 35 SkAutoMalloc storage(wsize); |
36 wb.writeToMemory(storage.get()); | 36 wb.writeToMemory(storage.get()); |
37 | 37 |
38 SkOrderedReadBuffer rb(storage.get(), wsize); | 38 SkOrderedReadBuffer rb(storage.get(), wsize); |
39 SkAutoTUnref<SkDataTable> newTable((SkDataTable*)rb.readFlattenable()); | 39 SkAutoTUnref<SkDataTable> newTable(rb.readFlattenableT<SkDataTable>()); |
40 | 40 |
41 test_is_equal(reporter, table, newTable); | 41 test_is_equal(reporter, table, newTable); |
42 } | 42 } |
43 | 43 |
44 static void test_datatable_is_empty(skiatest::Reporter* reporter, | 44 static void test_datatable_is_empty(skiatest::Reporter* reporter, |
45 SkDataTable* table) { | 45 SkDataTable* table) { |
46 REPORTER_ASSERT(reporter, table->isEmpty()); | 46 REPORTER_ASSERT(reporter, table->isEmpty()); |
47 REPORTER_ASSERT(reporter, 0 == table->count()); | 47 REPORTER_ASSERT(reporter, 0 == table->count()); |
48 test_datatable_flatten(reporter, table); | 48 test_datatable_flatten(reporter, table); |
49 } | 49 } |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 tmp->unref(); | 318 tmp->unref(); |
319 | 319 |
320 test_cstring(reporter); | 320 test_cstring(reporter); |
321 test_dataset(reporter); | 321 test_dataset(reporter); |
322 test_files(reporter); | 322 test_files(reporter); |
323 } | 323 } |
324 | 324 |
325 #include "TestClassDef.h" | 325 #include "TestClassDef.h" |
326 DEFINE_TESTCLASS("Data", DataTestClass, TestData) | 326 DEFINE_TESTCLASS("Data", DataTestClass, TestData) |
327 DEFINE_TESTCLASS("DataTable", DataTableTestClass, TestDataTable) | 327 DEFINE_TESTCLASS("DataTable", DataTableTestClass, TestDataTable) |
OLD | NEW |