ok, plumb in GrContextFactory
authorMike Klein <mtklein@chromium.org>
Tue, 28 Mar 2017 02:51:23 +0000 (22:51 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Tue, 28 Mar 2017 12:40:44 +0000 (12:40 +0000)
Didn't know what options would be useful here (path renderers?), so I've
left them default.  Obviously we can thread them through TestSrc options.

I now have "841 ok" and no failures on my Linux laptop, though I imagine
the GPU tests are all just no-op'd by the TODO at the bottom of the file.

Change-Id: Id934c0bdb5de96d96f2a391106b5d20116f41979
Reviewed-on: https://skia-review.googlesource.com/10213
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>

tools/ok_test.cpp

index dcb18a132253da5693ca0c1025a9a33c155965aa..3fa943f7269a0c3b719fb477ea0441888e2e748f 100644 (file)
@@ -8,6 +8,10 @@
 #include "ok.h"
 #include "Test.h"
 
+#if SK_SUPPORT_GPU
+    #include "GrContextFactory.h"
+#endif
+
 struct TestStream : Stream {
     const skiatest::TestRegistry* registry = skiatest::TestRegistry::Head();
     bool extended = false, verbose = false;
@@ -28,7 +32,6 @@ struct TestStream : Stream {
         SkISize     size() override { return {0,0}; }
 
         bool draw(SkCanvas*) override {
-            // TODO(mtklein): GrContext
 
             struct : public skiatest::Reporter {
                 bool ok = true;
@@ -46,7 +49,14 @@ struct TestStream : Stream {
             reporter.extended = extended;
             reporter.verbose_ = verbose;
 
-            test.proc(&reporter, nullptr);
+            sk_gpu_test::GrContextFactory* factory = nullptr;
+        #if SK_SUPPORT_GPU
+            GrContextOptions options;
+            sk_gpu_test::GrContextFactory a_real_factory(options);
+            factory = &a_real_factory;
+        #endif
+
+            test.proc(&reporter, factory);
             return reporter.ok;
         }
     };