aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/FontHostTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/FontHostTest.cpp')
-rw-r--r--tests/FontHostTest.cpp28
1 files changed, 8 insertions, 20 deletions
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp
index 249fe7b1fb..ff275e2ad5 100644
--- a/tests/FontHostTest.cpp
+++ b/tests/FontHostTest.cpp
@@ -111,8 +111,7 @@ static void test_charsToGlyphs(skiatest::Reporter* reporter, SkTypeface* face) {
}
}
-static void test_fontstream(skiatest::Reporter* reporter,
- SkStream* stream, int ttcIndex) {
+static void test_fontstream(skiatest::Reporter* reporter, SkStream* stream, int ttcIndex) {
int n = SkFontStream::GetTableTags(stream, ttcIndex, NULL);
SkAutoTArray<SkFontTableTag> array(n);
@@ -138,7 +137,13 @@ static void test_fontstream(skiatest::Reporter* reporter,
}
}
-static void test_fontstream(skiatest::Reporter* reporter, SkStream* stream) {
+static void test_fontstream(skiatest::Reporter* reporter) {
+ SkAutoTDelete<SkStreamAsset> stream(GetResourceAsStream("/fonts/test.ttc"));
+ if (!stream) {
+ SkDebugf("Skipping FontHostTest::test_fontstream\n");
+ return;
+ }
+
int count = SkFontStream::CountTTCEntries(stream);
#ifdef DUMP_TTC_TABLES
SkDebugf("CountTTCEntries %d\n", count);
@@ -148,23 +153,6 @@ static void test_fontstream(skiatest::Reporter* reporter, SkStream* stream) {
}
}
-static void test_fontstream(skiatest::Reporter* reporter) {
- // This test cannot run if there is no resource path.
- SkString resourcePath = GetResourcePath();
- if (resourcePath.isEmpty()) {
- SkDebugf("Could not run fontstream test because resourcePath not specified.");
- return;
- }
- SkString filename = SkOSPath::Join(resourcePath.c_str(), "test.ttc");
-
- SkFILEStream stream(filename.c_str());
- if (stream.isValid()) {
- test_fontstream(reporter, &stream);
- } else {
- SkDebugf("Could not run fontstream test because test.ttc not found.");
- }
-}
-
static void test_tables(skiatest::Reporter* reporter, SkTypeface* face) {
if (false) { // avoid bit rot, suppress warning
SkFontID fontID = face->uniqueID();