Skip to content

Commit

Permalink
test polygonal surface
Browse files Browse the repository at this point in the history
  • Loading branch information
panquez committed Jan 16, 2020
1 parent 0f789fa commit 3514040
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/mesh/test-polygonal-surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,30 @@ void test_set_polygon_vertex(
"[Test] Edge vertices after set_polygon_vertex is wrong" );
}

void test_replace_vertex( const geode::PolygonalSurface3D& polygonal_surface,
geode::PolygonalSurfaceBuilder3D& builder )
{
const auto new_id = builder.create_vertex();
const auto polygons_around = polygonal_surface.polygons_around_vertex( 1 );
builder.replace_vertex( 1, new_id );
for( const auto& pv : polygons_around )
{
OPENGEODE_EXCEPTION( polygonal_surface.polygon_vertex( pv ) == new_id,
"[Test] PolygonVertex after replace_vertex is wrong" );
}
OPENGEODE_EXCEPTION( polygonal_surface.isolated_vertex( 1 ),
"[Test] Isolated vertex after replace_vertex is wrong" );
builder.replace_vertex( new_id, 1 );
for( const auto& pv : polygons_around )
{
OPENGEODE_EXCEPTION( polygonal_surface.polygon_vertex( pv ) == 1,
"[Test] PolygonVertex after second replace_vertex is wrong" );
}
builder.delete_isolated_vertices();
OPENGEODE_EXCEPTION( polygonal_surface.nb_vertices() == new_id,
"[Test] Revert after replace_vertex is wrong" );
}

void test_delete_all( const geode::PolygonalSurface3D& polygonal_surface,
geode::PolygonalSurfaceBuilder3D& builder )
{
Expand Down Expand Up @@ -442,6 +466,7 @@ void test()
test_io(
*polygonal_surface, "test." + polygonal_surface->native_extension() );

test_replace_vertex( *polygonal_surface, *builder );
test_delete_vertex( *polygonal_surface, *builder );
test_delete_polygon( *polygonal_surface, *builder );
test_clone( *polygonal_surface );
Expand Down

0 comments on commit 3514040

Please sign in to comment.