skia2/tests/GrGLExtensionsTest.cpp
Brian Osman c7ad40f76f Remove SK_SUPPORT_GPU checks in tool-only code
Most of this is (obviously) not necessary to do, but once
I started, I figured I'd just get it all. Tools (nanobench,
DM, skiaserve), all GMs, benches, and unit tests, plus support
code (command line parsing and config stuff).

This is almost entirely mechanical.

Bug: skia:
Change-Id: I209500f8df8c5bd43f8298ff26440d1c4d7425fb
Reviewed-on: https://skia-review.googlesource.com/131153
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2018-05-31 18:59:44 +00:00

49 lines
1.4 KiB
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkTypes.h"
#include "gl/GrGLDefines.h"
#include "gl/GrGLExtensions.h"
#include "Test.h"
const GrGLubyte* simpleGetString(GrGLenum name) {
return (const GrGLubyte*)(name == GR_GL_VERSION ? "3.0" : "");
}
void simpleGetIntegerv(GrGLenum name, GrGLint* params) {
if (name == GR_GL_NUM_EXTENSIONS) {
*params = 2;
} else {
*params = 0;
}
}
const GrGLubyte* simpleGetStringi(GrGLenum name, GrGLuint index) {
if (name != GR_GL_EXTENSIONS || index >= 2)
return (const GrGLubyte*)"";
return (const GrGLubyte*)(index == 0 ? "test_extension_1" : "test_extension_2");
}
DEF_TEST(GrGLExtensionsTest_remove, reporter) {
GrGLExtensions ext;
ext.init(kNone_GrGLStandard,
&simpleGetString,
&simpleGetStringi,
&simpleGetIntegerv,
nullptr,
nullptr);
REPORTER_ASSERT(reporter, ext.isInitialized());
REPORTER_ASSERT(reporter, ext.has("test_extension_1"));
REPORTER_ASSERT(reporter, ext.has("test_extension_2"));
REPORTER_ASSERT(reporter, ext.remove("test_extension_2"));
REPORTER_ASSERT(reporter, !ext.has("test_extension_2"));
REPORTER_ASSERT(reporter, ext.remove("test_extension_1"));
REPORTER_ASSERT(reporter, !ext.has("test_extension_1"));
}