Flutter Engine
The Flutter Engine
GrGLExtensionsTest.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2017 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "tests/Test.h"
9
10#ifdef SK_GL
15
16const GrGLubyte* simpleGetString(GrGLenum name) {
17 return (const GrGLubyte*)(name == GR_GL_VERSION ? "3.0" : "");
18}
19
20void simpleGetIntegerv(GrGLenum name, GrGLint* params) {
22 *params = 2;
23 } else {
24 *params = 0;
25 }
26}
27
28const GrGLubyte* simpleGetStringi(GrGLenum name, GrGLuint index) {
29 if (name != GR_GL_EXTENSIONS || index >= 2)
30 return (const GrGLubyte*)"";
31 return (const GrGLubyte*)(index == 0 ? "test_extension_1" : "test_extension_2");
32}
33
34DEF_TEST(GrGLExtensionsTest_remove, reporter) {
37 &simpleGetString,
38 &simpleGetStringi,
39 &simpleGetIntegerv,
40 nullptr,
41 nullptr);
42
43 REPORTER_ASSERT(reporter, ext.isInitialized());
44 REPORTER_ASSERT(reporter, ext.has("test_extension_1"));
45 REPORTER_ASSERT(reporter, ext.has("test_extension_2"));
46 REPORTER_ASSERT(reporter, ext.remove("test_extension_2"));
47 REPORTER_ASSERT(reporter, !ext.has("test_extension_2"));
48 REPORTER_ASSERT(reporter, ext.remove("test_extension_1"));
49 REPORTER_ASSERT(reporter, !ext.has("test_extension_1"));
50}
51
52#endif // SK_GL
reporter
Definition: FontMgrTest.cpp:39
#define GR_GL_NUM_EXTENSIONS
Definition: GrGLDefines.h:606
#define GR_GL_EXTENSIONS
Definition: GrGLDefines.h:603
#define GR_GL_VERSION
Definition: GrGLDefines.h:602
unsigned int GrGLuint
Definition: GrGLTypes.h:113
@ kGL_GrGLStandard
Definition: GrGLTypes.h:21
int GrGLint
Definition: GrGLTypes.h:108
unsigned int GrGLenum
Definition: GrGLTypes.h:102
unsigned char GrGLubyte
Definition: GrGLTypes.h:111
#define DEF_TEST(name, reporter)
Definition: Test.h:312
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
const EmbeddedViewParams * params
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32