Skip to content

Commit 22cb51a

Browse files
committed
add test
1 parent 0b1befd commit 22cb51a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/model/test-model-component-filter.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <geode/basic/logger.hpp>
2626

2727
#include <geode/model/helpers/model_component_filter.hpp>
28+
#include <geode/model/representation/builder/brep_builder.hpp>
2829
#include <geode/model/representation/core/brep.hpp>
2930
#include <geode/model/representation/io/brep_input.hpp>
3031

@@ -62,6 +63,32 @@ void check_brep_dangling( const geode::BRep& brep )
6263
" Blocks, should have 1 Block" );
6364
}
6465

66+
void check_brep_dangling_with_inactive_surface( const geode::BRep& brep )
67+
{
68+
OPENGEODE_EXCEPTION( brep.nb_corners() == 8,
69+
"[Test] Filtered dangling model has ", brep.nb_corners(),
70+
" Corners, should have 8 Corners" );
71+
OPENGEODE_EXCEPTION( brep.nb_lines() == 12,
72+
"[Test] Filtered dangling model has ", brep.nb_lines(),
73+
" Lines, should have 12 Lines" );
74+
OPENGEODE_EXCEPTION( brep.nb_surfaces() == 7,
75+
"[Test] Filtered dangling model with inactive surface has ",
76+
brep.nb_surfaces(), " Surfaces, should have 7 Surfaces" );
77+
OPENGEODE_EXCEPTION( brep.nb_active_surfaces() == 6,
78+
"[Test] Filtered dangling model with inactive surface has ",
79+
brep.nb_active_surfaces(), " Surfaces, should have 6 Surfaces" );
80+
OPENGEODE_EXCEPTION( brep.nb_blocks() == 1,
81+
"[Test] Filtered dangling model has ", brep.nb_blocks(),
82+
" Blocks, should have 1 Block" );
83+
}
84+
85+
void add_inactive_surface( geode::BRep& brep )
86+
{
87+
geode::BRepBuilder builder{ brep };
88+
const auto new_surface_id = builder.add_surface();
89+
builder.set_surface_active( new_surface_id, false );
90+
}
91+
6592
void test()
6693
{
6794
geode::OpenGeodeModelLibrary::initialize();
@@ -74,6 +101,9 @@ void test()
74101
absl::StrCat( geode::DATA_PATH, "dangling.og_brep" ) );
75102
geode::filter_brep_components_with_regards_to_blocks( brep2 );
76103
check_brep_dangling( brep2 );
104+
add_inactive_surface( brep2 );
105+
geode::filter_brep_components_with_regards_to_blocks( brep2 );
106+
check_brep_dangling_with_inactive_surface( brep2 );
77107
}
78108

79109
OPENGEODE_TEST( "model-filter" )

0 commit comments

Comments
 (0)