diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/FontHostTest.cpp | 28 | ||||
-rw-r--r-- | tests/SerializationTest.cpp | 10 |
2 files changed, 10 insertions, 28 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(); diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp index f6a8a7d5fc..f7e298305f 100644 --- a/tests/SerializationTest.cpp +++ b/tests/SerializationTest.cpp @@ -317,14 +317,8 @@ static void compare_bitmaps(skiatest::Reporter* reporter, } static void TestPictureTypefaceSerialization(skiatest::Reporter* reporter) { - // Load typeface form file. - // 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"); + // Load typeface form file to test CreateFromFile with index. + SkString filename = GetResourcePath("/fonts/test.ttc"); SkTypeface* typeface = SkTypeface::CreateFromFile(filename.c_str(), 1); if (!typeface) { SkDebugf("Could not run fontstream test because test.ttc not found."); |