From a8e686eb6cadb74039d3b624ece0d3ccb0684dcc Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Tue, 16 Aug 2011 15:45:58 +0000 Subject: Make program unit test run clean and add it to tests program Review URL: http://codereview.appspot.com/4898049/ git-svn-id: http://skia.googlecode.com/svn/trunk@2121 2bbb7eff-a529-9590-31e7-b0007b416f81 --- tests/Test.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tests/Test.cpp') diff --git a/tests/Test.cpp b/tests/Test.cpp index e1246c34d6..e8a16f4d50 100644 --- a/tests/Test.cpp +++ b/tests/Test.cpp @@ -7,6 +7,10 @@ */ #include "Test.h" +#include "GrContext.h" +#include "SkEGLContext.h" +#include "SkTLazy.h" + using namespace skiatest; Reporter::Reporter() { @@ -70,3 +74,20 @@ bool Test::run() { return fReporter->getCurrSuccess(); } +/////////////////////////////////////////////////////////////////////////////// + + +GrContext* GpuTest::GetContext() { + // preserve this order, we want gGrContext destroyed after gEGLContext + static SkTLazy gEGLContext; + static SkAutoTUnref gGrContext; + + if (NULL == gGrContext.get()) { + gEGLContext.init(); + if (gEGLContext.get()->init(800, 600)) { + gGrContext.reset(GrContext::Create(kOpenGL_Shaders_GrEngine, NULL)); + } + } + return gGrContext.get(); +} + -- cgit v1.2.3