Commit: e00bb4d22c8e23942368e3e7cd980eba2003fdea
Author: Campbell Barton
Date:   Wed Sep 20 03:31:32 2017 +1000
Branches: master
https://developer.blender.org/rBe00bb4d22c8e23942368e3e7cd980eba2003fdea

BLI_polyfill2d_test: Try flipped x/y axis

In T52834 this makes a difference.

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

M       tests/gtests/blenlib/BLI_polyfill2d_test.cc

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

diff --git a/tests/gtests/blenlib/BLI_polyfill2d_test.cc 
b/tests/gtests/blenlib/BLI_polyfill2d_test.cc
index eefcdd6e85e..8855eb9ff8d 100644
--- a/tests/gtests/blenlib/BLI_polyfill2d_test.cc
+++ b/tests/gtests/blenlib/BLI_polyfill2d_test.cc
@@ -210,6 +210,26 @@ static void test_polyfill_template(
 #endif
 }
 
+static void test_polyfill_template_flip_sign(
+        const char *id, bool is_degenerate,
+        const float poly[][2], const unsigned int poly_tot,
+        unsigned int tris[][3], const unsigned int tris_tot)
+{
+       float (*poly_copy)[2] = (float (*)[2])MEM_mallocN(sizeof(float[2]) * 
poly_tot, id);
+       for (int flip_x = 0; flip_x < 2; flip_x++) {
+               for (int flip_y = 0; flip_y < 2; flip_y++) {
+                       float sign_x = flip_x ? -1.0f : 1.0f;
+                       float sign_y = flip_y ? -1.0f : 1.0f;
+                       for (int i = 0; i < poly_tot; i++) {
+                               poly_copy[i][0] = poly[i][0] * sign_x;
+                               poly_copy[i][1] = poly[i][1] * sign_y;
+                       }
+                       test_polyfill_template(id, is_degenerate, poly_copy, 
poly_tot, tris, tris_tot);
+               }
+       }
+       MEM_freeN(poly_copy);
+}
+
 #ifdef USE_COMBINATIONS_ALL
 static void test_polyfill_template_main(
         const char *id, bool is_degenerate,
@@ -232,7 +252,7 @@ static void test_polyfill_template_main(
 
                for (poly_cycle = 0; poly_cycle < poly_tot; poly_cycle++) {
                        // printf("polytest %s ofs=%d, reverse=%d\n", id, 
poly_cycle, poly_reverse);
-                       test_polyfill_template(id, is_degenerate, poly, 
poly_tot, tris, tris_tot);
+                       test_polyfill_template_flip_sign(id, is_degenerate, 
poly, poly_tot, tris, tris_tot);
 
                        /* cycle */
                        copy_v2_v2(tmp, poly_copy[0]);
@@ -249,7 +269,7 @@ static void test_polyfill_template_main(
         const float poly[][2], const unsigned int poly_tot,
         unsigned int tris[][3], const unsigned int tris_tot)
 {
-       test_polyfill_template(id, is_degenerate, poly, poly_tot, tris, 
tris_tot);
+       test_polyfill_template_flip_sign(id, is_degenerate, poly, poly_tot, 
tris, tris_tot);
 }
 #endif  /* USE_COMBINATIONS_ALL */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to