OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "Resources.h" |
8 #include "SkEndian.h" | 9 #include "SkEndian.h" |
9 #include "SkFontStream.h" | 10 #include "SkFontStream.h" |
10 #include "SkOSFile.h" | 11 #include "SkOSFile.h" |
11 #include "SkPaint.h" | 12 #include "SkPaint.h" |
12 #include "SkStream.h" | 13 #include "SkStream.h" |
13 #include "SkTypeface.h" | 14 #include "SkTypeface.h" |
14 #include "Test.h" | 15 #include "Test.h" |
15 | 16 |
16 //#define DUMP_TABLES | 17 //#define DUMP_TABLES |
17 //#define DUMP_TTC_TABLES | 18 //#define DUMP_TTC_TABLES |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 #ifdef DUMP_TTC_TABLES | 143 #ifdef DUMP_TTC_TABLES |
143 SkDebugf("CountTTCEntries %d\n", count); | 144 SkDebugf("CountTTCEntries %d\n", count); |
144 #endif | 145 #endif |
145 for (int i = 0; i < count; ++i) { | 146 for (int i = 0; i < count; ++i) { |
146 test_fontstream(reporter, stream, i); | 147 test_fontstream(reporter, stream, i); |
147 } | 148 } |
148 } | 149 } |
149 | 150 |
150 static void test_fontstream(skiatest::Reporter* reporter) { | 151 static void test_fontstream(skiatest::Reporter* reporter) { |
151 // This test cannot run if there is no resource path. | 152 // This test cannot run if there is no resource path. |
152 SkString resourcePath = skiatest::Test::GetResourcePath(); | 153 SkString resourcePath = GetResourcePath(); |
153 if (resourcePath.isEmpty()) { | 154 if (resourcePath.isEmpty()) { |
154 SkDebugf("Could not run fontstream test because resourcePath not specifi
ed."); | 155 SkDebugf("Could not run fontstream test because resourcePath not specifi
ed."); |
155 return; | 156 return; |
156 } | 157 } |
157 SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), "test.ttc"); | 158 SkString filename = SkOSPath::SkPathJoin(resourcePath.c_str(), "test.ttc"); |
158 | 159 |
159 SkFILEStream stream(filename.c_str()); | 160 SkFILEStream stream(filename.c_str()); |
160 if (stream.isValid()) { | 161 if (stream.isValid()) { |
161 test_fontstream(reporter, &stream); | 162 test_fontstream(reporter, &stream); |
162 } else { | 163 } else { |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 } | 300 } |
300 } | 301 } |
301 | 302 |
302 DEF_TEST(FontHost, reporter) { | 303 DEF_TEST(FontHost, reporter) { |
303 test_tables(reporter); | 304 test_tables(reporter); |
304 test_fontstream(reporter); | 305 test_fontstream(reporter); |
305 test_advances(reporter); | 306 test_advances(reporter); |
306 } | 307 } |
307 | 308 |
308 // need tests for SkStrSearch | 309 // need tests for SkStrSearch |
OLD | NEW |