aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/GrPorterDuffTest.cpp
diff options
context:
space:
mode:
authorGravatar kkinnunen <kkinnunen@nvidia.com>2015-12-01 04:35:26 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-01 04:35:26 -0800
commit1530283c483cb88aa725bce50a6d193dd00ee570 (patch)
treec34d73ac28d83690a4cbf1196854176677e07366 /tests/GrPorterDuffTest.cpp
parent362c900625dc2ece854678455776b711c1e44c04 (diff)
Generate list of GPU contexts outside tests
Use DEF_GPUTEST_FOR_*_CONTEXT macros to obtain the test GPU context. Makes changing the context -related classes easier, since not all tests need to be changed. BUG=skia:2992 Review URL: https://codereview.chromium.org/1448873002
Diffstat (limited to 'tests/GrPorterDuffTest.cpp')
-rw-r--r--tests/GrPorterDuffTest.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index f1c19610f8..5755c81545 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -27,16 +27,9 @@ static void test_color_opaque_with_coverage(skiatest::Reporter* reporter, const
static void test_color_opaque_no_coverage(skiatest::Reporter* reporter, const GrCaps& caps);
static void test_lcd_coverage(skiatest::Reporter* reporter, const GrCaps& caps);
static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const GrCaps& caps);
-static void test_no_dual_source_blending(skiatest::Reporter* reporter);
-DEF_GPUTEST(GrPorterDuff, reporter, factory) {
- GrContext* ctx = factory->get(GrContextFactory::kNull_GLContextType);
- if (!ctx) {
- SkFAIL("Failed to create null context.");
- return;
- }
-
- const GrCaps& caps = *ctx->getGpu()->caps();
+DEF_GPUTEST_FOR_NULL_CONTEXT(GrPorterDuff, reporter, context) {
+ const GrCaps& caps = *context->getGpu()->caps();
if (!caps.shaderCaps()->dualSourceBlendingSupport()) {
SkFAIL("Null context does not support dual source blending.");
return;
@@ -48,7 +41,6 @@ DEF_GPUTEST(GrPorterDuff, reporter, factory) {
test_color_opaque_no_coverage(reporter, caps);
test_lcd_coverage(reporter, caps);
test_lcd_coverage_fallback_case(reporter, caps);
- test_no_dual_source_blending(reporter);
}
////////////////////////////////////////////////////////////////////////////////
@@ -1154,12 +1146,11 @@ static void test_lcd_coverage_fallback_case(skiatest::Reporter* reporter, const
TEST_ASSERT(blendInfo.fWriteColor);
}
-static void test_no_dual_source_blending(skiatest::Reporter* reporter) {
+DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, /*factory*/) {
GrContextOptions opts;
opts.fSuppressDualSourceBlending = true;
- GrContextFactory factory(opts);
- factory.get(GrContextFactory::kNull_GLContextType);
- GrContext* ctx = factory.get(GrContextFactory::kNull_GLContextType);
+ GrContextFactory mockFactory(opts);
+ GrContext* ctx = mockFactory.get(GrContextFactory::kNull_GLContextType);
if (!ctx) {
SkFAIL("Failed to create null context without ARB_blend_func_extended.");
return;
@@ -1172,7 +1163,8 @@ static void test_no_dual_source_blending(skiatest::Reporter* reporter) {
}
GrBackendObject backendTex =
- ctx->getGpu()->createTestingOnlyBackendTexture(nullptr, 100, 100, kRGBA_8888_GrPixelConfig);
+ ctx->getGpu()->createTestingOnlyBackendTexture(nullptr, 100, 100,
+ kRGBA_8888_GrPixelConfig);
GrBackendTextureDesc fakeDesc;
fakeDesc.fConfig = kRGBA_8888_GrPixelConfig;
fakeDesc.fWidth = fakeDesc.fHeight = 100;