skia2/tests/GrDrawTargetTest.cpp
commit-bot@chromium.org 8b656c6db4 Avoid printing draw target info to stderr while running unit tests
Change draw target dump function to return a SkString. Clients can do
whatever they want with the string.

BUG=skia:1837
R=caryclark@google.com, bsalomon@google.com

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/72353003

git-svn-id: http://skia.googlecode.com/svn/trunk@12340 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-11-21 15:23:15 +00:00

40 lines
1.0 KiB
C++

/*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextFactory.h"
#include "GrGpu.h"
#include "GrDrawTargetCaps.h"
#include "Test.h"
static void test_print(skiatest::Reporter*, const GrDrawTargetCaps* caps) {
// This used to assert.
SkString result = caps->dump();
SkASSERT(!result.isEmpty());
}
static void TestGrDrawTarget(skiatest::Reporter* reporter, GrContextFactory* factory) {
for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
GrContextFactory::GLContextType glType = static_cast<GrContextFactory::GLContextType>(type);
GrContext* grContext = factory->get(glType);
if (NULL == grContext) {
continue;
}
test_print(reporter, grContext->getGpu()->caps());
}
}
#include "TestClassDef.h"
DEFINE_GPUTESTCLASS("GrDrawTarget", TestGrDrawTargetClass, TestGrDrawTarget)
#endif