aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/FontHostTest.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-21 15:20:00 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-03-21 15:20:00 +0000
commita262eea230a69cce309191bfdc8a19fe8737a152 (patch)
tree43c165f68cfdb6f95c93b3afcb293a4be72a40ff /tests/FontHostTest.cpp
parent9dcf4651194d739eaa7b3325b41e3039681a6d38 (diff)
beef-up upem test for fonts
git-svn-id: http://skia.googlecode.com/svn/trunk@8293 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/FontHostTest.cpp')
-rw-r--r--tests/FontHostTest.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/FontHostTest.cpp b/tests/FontHostTest.cpp
index e9961551e1..9a186dd57d 100644
--- a/tests/FontHostTest.cpp
+++ b/tests/FontHostTest.cpp
@@ -28,18 +28,27 @@ static const struct TagSize {
{ kFontTableTag_maxp, 32 },
};
+// Test that getUnitsPerEm() agrees with a direct lookup in the 'head' table
+// (if that table is available.
static void test_unitsPerEm(skiatest::Reporter* reporter, SkTypeface* face) {
- int upem = face->getUnitsPerEm();
- if (0 == upem) return;
+ int nativeUPEM = face->getUnitsPerEm();;
+ int tableUPEM = -1;
size_t size = face->getTableSize(kFontTableTag_head);
if (size) {
SkAutoMalloc storage(size);
char* ptr = (char*)storage.get();
face->getTableData(kFontTableTag_head, 0, size, ptr);
// unitsPerEm is at offset 18 into the 'head' table.
- int upem2 = SkEndian_SwapBE16(*(uint16_t*)&ptr[18]);
- REPORTER_ASSERT(reporter, upem2 == upem);
+ tableUPEM = SkEndian_SwapBE16(*(uint16_t*)&ptr[18]);
+ }
+// SkDebugf("--- typeface returned %d upem [%X]\n", nativeUPEM, face->uniqueID());
+
+ if (tableUPEM >= 0) {
+ REPORTER_ASSERT(reporter, tableUPEM == nativeUPEM);
+ } else {
+ // not sure this is a bug, but lets report it for now as info.
+ SkDebugf("--- typeface returned 0 upem [%X]\n", face->uniqueID());
}
}