aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-05-09 15:35:54 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-09 15:36:06 +0000
commit97c1108607584b6050a6880d6ce22846e4913a92 (patch)
treee6cb5bfa22fdd2fba53c9cd49d3beed28fff686b /tests
parent2ed5f69da6f101e60a3cf49c0767212b563552f3 (diff)
Revert "SkAdvancedTypefaceMetrics: factor out GlyphToUnicode"
This reverts commit 1c2bcd8b14e029a70e88b1e81acd29553cab0d1c. Reason for revert: breaking chrome roll Original change's description: > SkAdvancedTypefaceMetrics: factor out GlyphToUnicode > > Change-Id: Iedce8c1ea2c405d5ab64ccac353970d5cd2b9d63 > Reviewed-on: https://skia-review.googlesource.com/126507 > Commit-Queue: Hal Canary <halcanary@google.com> > Reviewed-by: Ben Wagner <bungeman@google.com> TBR=halcanary@google.com,bungeman@google.com,reed@google.com Change-Id: Ib1ff8484ffd09cdb88d461ac00745aa32c191124 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/127000 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/FontMgrTest.cpp1
-rw-r--r--tests/PDFGlyphsToUnicodeTest.cpp18
-rw-r--r--tests/TypefaceTest.cpp11
3 files changed, 10 insertions, 20 deletions
diff --git a/tests/FontMgrTest.cpp b/tests/FontMgrTest.cpp
index 0f035a272f..17a60bbd79 100644
--- a/tests/FontMgrTest.cpp
+++ b/tests/FontMgrTest.cpp
@@ -133,7 +133,6 @@ static void test_matchStyleCSS3(skiatest::Reporter* reporter) {
return nullptr;
}
void onFilterRec(SkScalerContextRec*) const override { }
- void getGlyphToUnicodeMap(SkUnichar*) const override { }
std::unique_ptr<SkAdvancedTypefaceMetrics> onGetAdvancedMetrics() const override {
return nullptr;
}
diff --git a/tests/PDFGlyphsToUnicodeTest.cpp b/tests/PDFGlyphsToUnicodeTest.cpp
index 2aeedf0330..332520bfb0 100644
--- a/tests/PDFGlyphsToUnicodeTest.cpp
+++ b/tests/PDFGlyphsToUnicodeTest.cpp
@@ -74,12 +74,9 @@ DEF_TEST(SkPDF_ToUnicode, reporter) {
glyphsInSubset.push(0x101);
glyphToUnicode.push(0x1013);
- SkGlyphID lastGlyphID = SkToU16(glyphToUnicode.count() - 1);
-
SkDynamicMemoryWStream buffer;
subset.setAll(glyphsInSubset.begin(), glyphsInSubset.count());
- SkPDFAppendCmapSections(&glyphToUnicode[0], &subset, &buffer, true, 0,
- SkTMin<SkGlyphID>(0xFFFF, lastGlyphID));
+ SkPDFAppendCmapSections(glyphToUnicode, &subset, &buffer, true, 0, 0xFFFF);
char expectedResult[] =
"4 beginbfchar\n\
@@ -101,8 +98,7 @@ endbfrange\n";
// Remove characters and ranges.
buffer.reset();
- SkPDFAppendCmapSections(&glyphToUnicode[0], &subset, &buffer, true, 8,
- SkTMin<SkGlyphID>(0x00FF, lastGlyphID));
+ SkPDFAppendCmapSections(glyphToUnicode, &subset, &buffer, true, 8, 0x00FF);
char expectedResultChop1[] =
"2 beginbfchar\n\
@@ -120,8 +116,7 @@ endbfrange\n";
// Remove characters from range to downdrade it to one char.
buffer.reset();
- SkPDFAppendCmapSections(&glyphToUnicode[0], &subset, &buffer, true, 0x00D,
- SkTMin<SkGlyphID>(0x00FE, lastGlyphID));
+ SkPDFAppendCmapSections(glyphToUnicode, &subset, &buffer, true, 0x00D, 0x00FE);
char expectedResultChop2[] =
"2 beginbfchar\n\
@@ -134,8 +129,7 @@ endbfchar\n";
buffer.reset();
- SkPDFAppendCmapSections(&glyphToUnicode[0], nullptr, &buffer, false, 0xFC,
- SkTMin<SkGlyphID>(0x110, lastGlyphID));
+ SkPDFAppendCmapSections(glyphToUnicode, nullptr, &buffer, false, 0xFC, 0x110);
char expectedResultSingleBytes[] =
"2 beginbfchar\n\
@@ -161,7 +155,6 @@ endbfrange\n";
for (SkUnichar i = 0; i < 100; ++i) {
glyphToUnicode.push(i + 29);
}
- lastGlyphID = SkToU16(glyphToUnicode.count() - 1);
glyphsInSubset.push(0x2C);
glyphsInSubset.push(0x44);
@@ -172,8 +165,7 @@ endbfrange\n";
SkDynamicMemoryWStream buffer2;
subset2.setAll(glyphsInSubset.begin(), glyphsInSubset.count());
- SkPDFAppendCmapSections(&glyphToUnicode[0], &subset2, &buffer2, true, 0,
- SkTMin<SkGlyphID>(0xFFFF, lastGlyphID));
+ SkPDFAppendCmapSections(glyphToUnicode, &subset2, &buffer2, true, 0, 0xffff);
char expectedResult2[] =
"4 beginbfchar\n\
diff --git a/tests/TypefaceTest.cpp b/tests/TypefaceTest.cpp
index d791f750ec..b6b71aeb8c 100644
--- a/tests/TypefaceTest.cpp
+++ b/tests/TypefaceTest.cpp
@@ -203,11 +203,11 @@ DEF_TEST(Typeface, reporter) {
namespace {
-class EmptyTypeface : public SkTypeface {
+class SkEmptyTypeface : public SkTypeface {
public:
- static sk_sp<SkTypeface> Create() { return sk_sp<SkTypeface>(new EmptyTypeface()); }
+ static sk_sp<SkTypeface> Create() { return sk_sp<SkTypeface>(new SkEmptyTypeface()); }
protected:
- EmptyTypeface() : SkTypeface(SkFontStyle(), true) { }
+ SkEmptyTypeface() : SkTypeface(SkFontStyle(), true) { }
SkStreamAsset* onOpenStream(int* ttcIndex) const override { return nullptr; }
SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&,
@@ -215,7 +215,6 @@ protected:
return nullptr;
}
void onFilterRec(SkScalerContextRec*) const override { }
- void getGlyphToUnicodeMap(SkUnichar*) const override { }
std::unique_ptr<SkAdvancedTypefaceMetrics> onGetAdvancedMetrics() const override {
return nullptr;
}
@@ -256,12 +255,12 @@ static int count(skiatest::Reporter* reporter, const SkTypefaceCache& cache) {
}
DEF_TEST(TypefaceCache, reporter) {
- sk_sp<SkTypeface> t1(EmptyTypeface::Create());
+ sk_sp<SkTypeface> t1(SkEmptyTypeface::Create());
{
SkTypefaceCache cache;
REPORTER_ASSERT(reporter, count(reporter, cache) == 0);
{
- sk_sp<SkTypeface> t0(EmptyTypeface::Create());
+ sk_sp<SkTypeface> t0(SkEmptyTypeface::Create());
cache.add(t0.get());
REPORTER_ASSERT(reporter, count(reporter, cache) == 1);
cache.add(t1.get());