aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PDFPrimitivesTest.cpp
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-10-12 13:05:04 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-10-12 13:05:04 -0700
commit66a82f3872abf4ebb98b3915b2a9ecc73ad352c5 (patch)
treee8bafe893fcce8e95d9d8b20f0c7f12d80ea8e0e /tests/PDFPrimitivesTest.cpp
parent88d064d0e481949184305c7b1d6b282dddffac39 (diff)
SkPDF: fall back on paths for unembeddable fonts.
Add GM, SkPDFFont::CanEmbedTypeface BUG=skia:3866 Review URL: https://codereview.chromium.org/1401763002
Diffstat (limited to 'tests/PDFPrimitivesTest.cpp')
-rw-r--r--tests/PDFPrimitivesTest.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/PDFPrimitivesTest.cpp b/tests/PDFPrimitivesTest.cpp
index 3253fcaf71..5fce53ea0a 100644
--- a/tests/PDFPrimitivesTest.cpp
+++ b/tests/PDFPrimitivesTest.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "Resources.h"
#include "SkBitmap.h"
#include "SkCanvas.h"
#include "SkData.h"
@@ -14,6 +15,7 @@
#include "SkMatrix.h"
#include "SkPDFCanon.h"
#include "SkPDFDevice.h"
+#include "SkPDFFont.h"
#include "SkPDFStream.h"
#include "SkPDFTypes.h"
#include "SkReadBuffer.h"
@@ -21,6 +23,7 @@
#include "SkStream.h"
#include "SkTypes.h"
#include "Test.h"
+#include "sk_tool_utils.h"
#define DUMMY_TEXT "DCT compessed stream."
@@ -415,3 +418,20 @@ DEF_TEST(PDFImageFilter, reporter) {
// Filter was used in rendering; should be visited.
REPORTER_ASSERT(reporter, filter->visited());
}
+
+// Check that PDF rendering of image filters successfully falls back to
+// CPU rasterization.
+DEF_TEST(PDFFontCanEmbedTypeface, reporter) {
+ SkPDFCanon canon;
+
+ const char resource[] = "fonts/Roboto2-Regular_NoEmbed.ttf";
+ SkAutoTUnref<SkTypeface> noEmbedTypeface(GetResourceAsTypeface(resource));
+ if (noEmbedTypeface) {
+ REPORTER_ASSERT(reporter,
+ !SkPDFFont::CanEmbedTypeface(noEmbedTypeface, &canon));
+ }
+ SkAutoTUnref<SkTypeface> portableTypeface(
+ sk_tool_utils::create_portable_typeface(NULL, SkTypeface::kNormal));
+ REPORTER_ASSERT(reporter,
+ SkPDFFont::CanEmbedTypeface(portableTypeface, &canon));
+}