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

Unified Diff: tests/PDFPrimitivesTest.cpp

Issue 2253283004: SkPDF: in-place font subsetting (Closed) Base URL: https://skia.googlesource.com/skia.git@SkPdfCacheMetrics
Patch Set: 2016-08-18 (Thursday) 16:02:16 EDT Created 4 years, 4 months 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 | « tests/PDFGlyphsToUnicodeTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PDFPrimitivesTest.cpp
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 554f1ee720a818503d40b7de31ec72f54c4bcd0c..1faecb516ac88a00480da8d500448bd3ec6c8fb5 100644
--- a/tests/PDFPrimitivesTest.cpp
+++ b/tests/PDFPrimitivesTest.cpp
@@ -31,21 +31,14 @@
#define DUMMY_TEXT "DCT compessed stream."
-namespace {
-struct Catalog {
- SkPDFSubstituteMap substitutes;
- SkPDFObjNumMap numbers;
-};
-} // namespace
-
template <typename T>
-static SkString emit_to_string(T& obj, Catalog* catPtr = nullptr) {
- Catalog catalog;
+static SkString emit_to_string(T& obj, SkPDFObjNumMap* catPtr = nullptr) {
+ SkPDFObjNumMap catalog;
SkDynamicMemoryWStream buffer;
if (!catPtr) {
catPtr = &catalog;
}
- obj.emitObject(&buffer, catPtr->numbers, catPtr->substitutes);
+ obj.emitObject(&buffer, *catPtr);
SkString tmp(buffer.bytesWritten());
buffer.copyTo(tmp.writable_str());
return tmp;
@@ -148,9 +141,9 @@ static void TestObjectRef(skiatest::Reporter* reporter) {
sk_sp<SkPDFArray> a2(new SkPDFArray);
a2->appendObjRef(a1);
- Catalog catalog;
- catalog.numbers.addObject(a1.get());
- REPORTER_ASSERT(reporter, catalog.numbers.getObjectNumber(a1.get()) == 1);
+ SkPDFObjNumMap catalog;
+ catalog.addObject(a1.get());
+ REPORTER_ASSERT(reporter, catalog.getObjectNumber(a1.get()) == 1);
SkString result = emit_to_string(*a2, &catalog);
// If appendObjRef misbehaves, then the result would
@@ -158,22 +151,6 @@ static void TestObjectRef(skiatest::Reporter* reporter) {
assert_eq(reporter, result, "[1 0 R]");
}
-static void TestSubstitute(skiatest::Reporter* reporter) {
- sk_sp<SkPDFDict> proxy(new SkPDFDict());
- sk_sp<SkPDFDict> stub(new SkPDFDict());
-
- proxy->insertInt("Value", 33);
- stub->insertInt("Value", 44);
-
- SkPDFSubstituteMap substituteMap;
- substituteMap.setSubstitute(proxy.get(), stub.get());
- SkPDFObjNumMap catalog;
- catalog.addObject(proxy.get());
-
- REPORTER_ASSERT(reporter, stub.get() == substituteMap.getSubstitute(proxy.get()));
- REPORTER_ASSERT(reporter, proxy.get() != substituteMap.getSubstitute(stub.get()));
-}
-
// This test used to assert without the fix submitted for
// http://code.google.com/p/skia/issues/detail?id=1083.
// SKP files might have invalid glyph ids. This test ensures they are ignored,
@@ -283,9 +260,9 @@ static void TestPDFArray(skiatest::Reporter* reporter) {
"(Another String) [-1]]");
sk_sp<SkPDFArray> referencedArray(new SkPDFArray);
- Catalog catalog;
- catalog.numbers.addObject(referencedArray.get());
- REPORTER_ASSERT(reporter, catalog.numbers.getObjectNumber(
+ SkPDFObjNumMap catalog;
+ catalog.addObject(referencedArray.get());
+ REPORTER_ASSERT(reporter, catalog.getObjectNumber(
referencedArray.get()) == 1);
array->appendObjRef(std::move(referencedArray));
@@ -347,9 +324,9 @@ static void TestPDFDict(skiatest::Reporter* reporter) {
assert_emit_eq(reporter, *dict, "<</Type /DType>>");
sk_sp<SkPDFArray> referencedArray(new SkPDFArray);
- Catalog catalog;
- catalog.numbers.addObject(referencedArray.get());
- REPORTER_ASSERT(reporter, catalog.numbers.getObjectNumber(
+ SkPDFObjNumMap catalog;
+ catalog.addObject(referencedArray.get());
+ REPORTER_ASSERT(reporter, catalog.getObjectNumber(
referencedArray.get()) == 1);
dict->insertObjRef("n1", std::move(referencedArray));
SkString result = emit_to_string(*dict, &catalog);
@@ -363,7 +340,6 @@ DEF_TEST(PDFPrimitives, reporter) {
TestPDFStream(reporter);
TestObjectNumberMap(reporter);
TestObjectRef(reporter);
- TestSubstitute(reporter);
test_issue1083();
}
« no previous file with comments | « tests/PDFGlyphsToUnicodeTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698