blob: 55ae2d7825ac47801d54d098f4003cb3b2d523e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/* SPDX-License-Identifier: Apache-2.0 */
#include "testing/testing.h"
#include "GHOST_C-api.h"
struct GPUContext;
namespace blender::gpu {
/* Test class that setups a GPUContext for test cases.
*
* Usage:
* TEST_F(GPUTest, my_gpu_test) {
* ...
* }
*/
class GPUTest : public ::testing::Test {
private:
GHOST_TDrawingContextType draw_context_type = GHOST_kDrawingContextTypeNone;
GHOST_SystemHandle ghost_system;
GHOST_ContextHandle ghost_context;
struct GPUContext *context;
protected:
GPUTest(GHOST_TDrawingContextType draw_context_type) : draw_context_type(draw_context_type)
{
}
void SetUp() override;
void TearDown() override;
};
class GPUOpenGLTest : public GPUTest {
public:
GPUOpenGLTest() : GPUTest(GHOST_kDrawingContextTypeOpenGL)
{
}
};
#define GPU_TEST(test_name) \
TEST_F(GPUOpenGLTest, test_name) \
{ \
test_##test_name(); \
}
} // namespace blender::gpu
|