aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Test.h
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2015-08-11 13:35:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-11 13:35:12 -0700
commit2ccdb636e8618db77be8e05cdacd82c249c6898c (patch)
tree2cf6f3fc1e2dc9cdc15645415a415cf7481244cd /tests/Test.h
parentfcaaadee711a93d601ccc9f0b47d744e22c35205 (diff)
SkPDF: clean up overuse of SK_SUPPORT_PDF
When possible use run-time checks (via SkDocument::CreatePDF) When PDF is disabled, do not compile tests/PDF*.cpp Review URL: https://codereview.chromium.org/1278403006
Diffstat (limited to 'tests/Test.h')
-rw-r--r--tests/Test.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/Test.h b/tests/Test.h
index ed5de0f860..c1e0c528fb 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -102,4 +102,16 @@ typedef SkTRegistry<Test> TestRegistry;
skiatest::Test(#name, true, test_##name)); \
void test_##name(skiatest::Reporter* reporter, GrContextFactory* factory)
+#define REQUIRE_PDF_DOCUMENT(TEST_NAME, REPORTER) \
+ do { \
+ SkDynamicMemoryWStream testStream; \
+ SkAutoTUnref<SkDocument> testDoc(SkDocument::CreatePDF(&testStream)); \
+ if (!testDoc) { \
+ if ((REPORTER) && (REPORTER)->verbose()) { \
+ SkDebugf("PDF disabled; %s test skipped.", #TEST_NAME); \
+ } \
+ return; \
+ } \
+ } while (false)
+
#endif