Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-01-03 10:04:37 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-01-03 10:05:18 +0300
commit6b8b3badf58942356d4cc8aa64214f94272a7958 (patch)
tree07cc664f022cf075050e070a97da354bb9ce1d3d /tests
parent0d7e8cc869794d83474b5a9bde7d1bb9bc07adf5 (diff)
GTest: test beautify with polyfill
Diffstat (limited to 'tests')
-rw-r--r--tests/gtests/blenlib/BLI_polyfill2d_test.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/gtests/blenlib/BLI_polyfill2d_test.cc b/tests/gtests/blenlib/BLI_polyfill2d_test.cc
index 785274757aa..fac5c6f7674 100644
--- a/tests/gtests/blenlib/BLI_polyfill2d_test.cc
+++ b/tests/gtests/blenlib/BLI_polyfill2d_test.cc
@@ -7,6 +7,7 @@
/* test every possible offset and reverse */
#define USE_COMBINATIONS_ALL
+#define USE_BEAUTIFY
extern "C" {
#include "BLI_array.h"
@@ -18,6 +19,12 @@ extern "C" {
#ifdef USE_OBJ_PREVIEW
# include "BLI_string.h"
#endif
+
+#ifdef USE_BEAUTIFY
+#include "BLI_polyfill2d_beautify.h"
+#include "BLI_memarena.h"
+#include "BLI_heap.h"
+#endif
}
static void polyfill_to_obj(
@@ -179,6 +186,25 @@ static void test_polyfill_template(
/* check all went well */
test_polyfill_template_check(id, is_degenerate, poly, poly_tot, tris, tris_tot);
+
+#ifdef USE_BEAUTIFY
+ /* check beautify gives good results too */
+ {
+ MemArena *pf_arena = BLI_memarena_new(BLI_POLYFILL_ARENA_SIZE, __func__);
+ Heap *pf_heap = BLI_heap_new_ex(BLI_POLYFILL_ALLOC_NGON_RESERVE);
+ EdgeHash *pf_ehash = BLI_edgehash_new_ex(__func__, BLI_POLYFILL_ALLOC_NGON_RESERVE);
+
+ BLI_polyfill_beautify(
+ poly, poly_tot, tris,
+ pf_arena, pf_heap, pf_ehash);
+
+ test_polyfill_template_check(id, is_degenerate, poly, poly_tot, tris, tris_tot);
+
+ BLI_memarena_free(pf_arena);
+ BLI_heap_free(pf_heap, NULL);
+ BLI_edgehash_free(pf_ehash, NULL);
+ }
+#endif
}
#ifdef USE_COMBINATIONS_ALL