Blender V5.0
draw_testing.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include "gpu_testing.hh"
6
7namespace blender::draw {
8
9/* Base class for draw test cases. It will setup and tear down the GPU part around each test. */
10#ifdef WITH_OPENGL_BACKEND
11class DrawOpenGLTest : public blender::gpu::GPUOpenGLTest {
12 public:
13 void SetUp() override;
14 void TearDown() override;
15};
16
17# define DRAW_OPENGL_TEST(test_name) \
18 TEST_F(DrawOpenGLTest, test_name) \
19 { \
20 test_##test_name(); \
21 }
22#else
23# define DRAW_OPENGL_TEST(test_name)
24#endif
25
26#ifdef WITH_METAL_BACKEND
27class DrawMetalTest : public blender::gpu::GPUMetalTest {
28 public:
29 void SetUp() override;
30 void TearDown() override;
31};
32
33# define DRAW_METAL_TEST(test_name) \
34 TEST_F(DrawMetalTest, test_name) \
35 { \
36 test_##test_name(); \
37 }
38#else
39# define DRAW_METAL_TEST(test_name)
40#endif
41
42#ifdef WITH_VULKAN_BACKEND
43class DrawVulkanTest : public blender::gpu::GPUVulkanTest {
44 public:
45 void SetUp() override;
46 void TearDown() override;
47};
48
49# define DRAW_VULKAN_TEST(test_name) \
50 TEST_F(DrawVulkanTest, test_name) \
51 { \
52 test_##test_name(); \
53 }
54#else
55# define DRAW_VULKAN_TEST(test_name)
56#endif
57
58#define DRAW_TEST(test_name) \
59 DRAW_OPENGL_TEST(test_name) \
60 DRAW_METAL_TEST(test_name) \
61 DRAW_VULKAN_TEST(test_name)
62
63} // namespace blender::draw