Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(298)

Unified Diff: tests/ToUnicode.cpp

Issue 112053005: [PDF] Fix bug in ToUnicode table generation for Type 3 fonts. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ToUnicode.cpp
diff --git a/tests/ToUnicode.cpp b/tests/ToUnicode.cpp
index 69ec614bcf470f8c51a051f2342e33e41eb73b73..d518432b8ad0ef4664dc2a3b0f18aac300d5898e 100644
--- a/tests/ToUnicode.cpp
+++ b/tests/ToUnicode.cpp
@@ -28,6 +28,7 @@ static bool stream_equals(const SkDynamicMemoryWStream& stream, size_t offset,
void append_cmap_sections(const SkTDArray<SkUnichar>& glyphToUnicode,
const SkPDFGlyphSet* subset,
SkDynamicMemoryWStream* cmap,
+ bool multiByteGlyphs,
uint16_t firstGlypthID,
uint16_t lastGlypthID);
@@ -74,7 +75,7 @@ static void TestToUnicode(skiatest::Reporter* reporter) {
SkDynamicMemoryWStream buffer;
subset.set(glyphsInSubset.begin(), glyphsInSubset.count());
- append_cmap_sections(glyphToUnicode, &subset, &buffer, 0, 0xFFFF);
+ append_cmap_sections(glyphToUnicode, &subset, &buffer, true, 0, 0xFFFF);
char expectedResult[] =
"4 beginbfchar\n\
@@ -96,7 +97,7 @@ endbfrange\n";
// Remove characters and ranges.
buffer.reset();
- append_cmap_sections(glyphToUnicode, &subset, &buffer, 8, 0x00FF);
+ append_cmap_sections(glyphToUnicode, &subset, &buffer, true, 8, 0x00FF);
char expectedResultChop1[] =
"2 beginbfchar\n\
@@ -114,7 +115,7 @@ endbfrange\n";
// Remove characters from range to downdrade it to one char.
buffer.reset();
- append_cmap_sections(glyphToUnicode, &subset, &buffer, 0x00D, 0x00FE);
+ append_cmap_sections(glyphToUnicode, &subset, &buffer, true, 0x00D, 0x00FE);
char expectedResultChop2[] =
"2 beginbfchar\n\
@@ -125,6 +126,23 @@ endbfchar\n";
REPORTER_ASSERT(reporter, stream_equals(buffer, 0, expectedResultChop2,
buffer.getOffset()));
+ buffer.reset();
+
+ append_cmap_sections(glyphToUnicode, NULL, &buffer, false, 0xFC, 0x110);
+
+ char expectedResultSingleBytes[] =
+"2 beginbfchar\n\
+<0001> <0000>\n\
+<0002> <0000>\n\
+endbfchar\n\
+1 beginbfrange\n\
+<0003> <0006> <1010>\n\
+endbfrange\n";
+
+ REPORTER_ASSERT(reporter, stream_equals(buffer, 0,
+ expectedResultSingleBytes,
+ buffer.getOffset()));
+
glyphToUnicode.reset();
glyphsInSubset.reset();
SkPDFGlyphSet subset2;
@@ -146,7 +164,7 @@ endbfchar\n";
SkDynamicMemoryWStream buffer2;
subset2.set(glyphsInSubset.begin(), glyphsInSubset.count());
- append_cmap_sections(glyphToUnicode, &subset2, &buffer2, 0, 0xffff);
+ append_cmap_sections(glyphToUnicode, &subset2, &buffer2, true, 0, 0xffff);
char expectedResult2[] =
"4 beginbfchar\n\
« no previous file with comments | « src/pdf/SkPDFFont.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698