skia2/tests/GrGLExtensionsTest.cpp
Robert Phillips 08ba085253 Revert "De-GL-ify tests, gm and tools"
This reverts commit 89fb346d2b.

Reason for revert: Google3 failure

Original change's description:
> De-GL-ify tests, gm and tools
> 
> Change-Id: Id15a3a4b2c8b80b9dc7ecdab1cf1af1f9282f442
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215447
> Reviewed-by: Jim Van Verth <jvanverth@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>

TBR=jvanverth@google.com,robertphillips@google.com

Change-Id: I155b033ac48d9fea15f66b22a090fb34f3bb81fa
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/215521
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
2019-05-22 20:23:56 +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 "include/core/SkTypes.h"
#include "include/gpu/gl/GrGLExtensions.h"
#include "src/gpu/gl/GrGLDefines.h"
#include "tests/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(kGL_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"));
}