[Bf-blender-cvs] [55b9b1ff507] master: Draw: Put DrawTest in its own compile unit.

Jeroen Bakker noreply at git.blender.org
Fri May 14 07:55:54 CEST 2021


Commit: 55b9b1ff507c524834ece73908f36ccf14928f63
Author: Jeroen Bakker
Date:   Fri May 14 07:55:01 2021 +0200
Branches: master
https://developer.blender.org/rB55b9b1ff507c524834ece73908f36ccf14928f63

Draw: Put DrawTest in its own compile unit.

DrawTest will be used by other tests as well.

===================================================================

M	source/blender/draw/CMakeLists.txt
A	source/blender/draw/tests/draw_testing.cc
A	source/blender/draw/tests/draw_testing.hh
M	source/blender/draw/tests/shaders_test.cc

===================================================================

diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index 196b46953c4..27167ce839b 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -478,6 +478,7 @@ add_dependencies(bf_draw bf_dna)
 if(WITH_GTESTS)
   if(WITH_OPENGL_DRAW_TESTS)
     set(TEST_SRC
+      tests/draw_testing.cc
       tests/shaders_test.cc
     )
     set(TEST_INC
diff --git a/source/blender/draw/tests/draw_testing.cc b/source/blender/draw/tests/draw_testing.cc
new file mode 100644
index 00000000000..0104437e921
--- /dev/null
+++ b/source/blender/draw/tests/draw_testing.cc
@@ -0,0 +1,18 @@
+/* Apache License, Version 2.0 */
+
+#include "draw_testing.hh"
+
+#include "GPU_shader.h"
+
+#include "draw_manager_testing.h"
+
+namespace blender::draw {
+
+/* Base class for draw test cases. It will setup and tear down the GPU part around each test. */
+void DrawTest::SetUp()
+{
+  GPUTest::SetUp();
+  DRW_draw_state_init_gtests(GPU_SHADER_CFG_DEFAULT);
+}
+
+}  // namespace blender::draw
diff --git a/source/blender/draw/tests/draw_testing.hh b/source/blender/draw/tests/draw_testing.hh
new file mode 100644
index 00000000000..3b91de007a2
--- /dev/null
+++ b/source/blender/draw/tests/draw_testing.hh
@@ -0,0 +1,12 @@
+/* Apache License, Version 2.0 */
+
+#include "gpu_testing.hh"
+
+namespace blender::draw {
+
+/* Base class for draw test cases. It will setup and tear down the GPU part around each test. */
+class DrawTest : public blender::gpu::GPUTest {
+  void SetUp() override;
+};
+
+}  // namespace blender::draw
diff --git a/source/blender/draw/tests/shaders_test.cc b/source/blender/draw/tests/shaders_test.cc
index 96d544fd855..c96f22859ca 100644
--- a/source/blender/draw/tests/shaders_test.cc
+++ b/source/blender/draw/tests/shaders_test.cc
@@ -2,12 +2,12 @@
 
 #include "testing/testing.h"
 
+#include "draw_testing.hh"
 #include "intern/draw_manager_testing.h"
 
 #include "GPU_context.h"
 #include "GPU_init_exit.h"
 #include "GPU_shader.h"
-#include "gpu_testing.hh"
 
 #include "engines/eevee/eevee_private.h"
 #include "engines/gpencil/gpencil_engine.h"
@@ -17,19 +17,9 @@
 
 namespace blender::draw {
 
-/* Base class for draw test cases. It will setup and tear down the GPU part around each test. */
-class DrawTest : public blender::gpu::GPUTest {
-  void SetUp() override
-  {
-    GPUTest::SetUp();
-    DRW_draw_state_init_gtests(GPU_SHADER_CFG_DEFAULT);
-  }
-};
-
 TEST_F(DrawTest, workbench_glsl_shaders)
 {
   workbench_shader_library_ensure();
-  DRW_draw_state_init_gtests(GPU_SHADER_CFG_DEFAULT);
 
   const int MAX_WPD = 6;
   WORKBENCH_PrivateData wpds[MAX_WPD];



More information about the Bf-blender-cvs mailing list