2 #include <gtest/gtest.h> 3 #include <Unittests/unittests_common.hh> 12 virtual void SetUp() {
18 virtual void TearDown() {
35 TEST_F(OpenMeshProperties, VertexPropertyCheckDouble) {
48 std::vector<Mesh::VertexHandle> face_vhandles;
50 face_vhandles.push_back(vhandle[2]);
51 face_vhandles.push_back(vhandle[1]);
52 face_vhandles.push_back(vhandle[0]);
53 mesh_.add_face(face_vhandles);
55 face_vhandles.clear();
57 face_vhandles.push_back(vhandle[2]);
58 face_vhandles.push_back(vhandle[0]);
59 face_vhandles.push_back(vhandle[3]);
60 mesh_.add_face(face_vhandles);
70 EXPECT_EQ(4u, mesh_.n_vertices() ) <<
"Wrong number of vertices";
71 EXPECT_EQ(2u, mesh_.n_faces() ) <<
"Wrong number of faces";
76 EXPECT_FALSE( mesh_.get_property_handle(doubleHandle,
"doubleProp") );
78 mesh_.add_property(doubleHandle,
"doubleProp");
80 EXPECT_TRUE(mesh_.get_property_handle(doubleHandle,
"doubleProp"));
86 for ( Mesh::VertexIter v_it = mesh_.vertices_begin() ; v_it != mesh_.vertices_end(); ++v_it ) {
87 mesh_.property(doubleHandle,*v_it) = index;
92 Mesh::VertexIter v_it = mesh_.vertices_begin();
93 EXPECT_EQ( mesh_.property(doubleHandle,*v_it) , 0.0 ) <<
"Invalid double value for vertex 0";
96 EXPECT_EQ( mesh_.property(doubleHandle,*v_it) , 1.0 ) <<
"Invalid double value for vertex 1";
99 EXPECT_EQ( mesh_.property(doubleHandle,*v_it) , 2.0 ) <<
"Invalid double value for vertex 2";
102 EXPECT_EQ( mesh_.property(doubleHandle,*v_it) , 3.0 ) <<
"Invalid double value for vertex 3";
105 std::vector<double>::iterator it=mesh_.property(doubleHandle).data_vector().begin();
106 std::vector<double>::iterator end=mesh_.property(doubleHandle).data_vector().end();
108 EXPECT_EQ( *it , 0.0 ) <<
"Invalid double value for vertex 0";
111 EXPECT_EQ( *it , 1.0 ) <<
"Invalid double value for vertex 1";
114 EXPECT_EQ( *it , 2.0 ) <<
"Invalid double value for vertex 2";
117 EXPECT_EQ( *it , 3.0 ) <<
"Invalid double value for vertex 3";
120 EXPECT_EQ( it, end ) <<
"End iterator not mathing!";
126 TEST_F(OpenMeshProperties, VertexPropertyCheckBool) {
139 std::vector<Mesh::VertexHandle> face_vhandles;
141 face_vhandles.push_back(vhandle[2]);
142 face_vhandles.push_back(vhandle[1]);
143 face_vhandles.push_back(vhandle[0]);
144 mesh_.add_face(face_vhandles);
146 face_vhandles.clear();
148 face_vhandles.push_back(vhandle[2]);
149 face_vhandles.push_back(vhandle[0]);
150 face_vhandles.push_back(vhandle[3]);
151 mesh_.add_face(face_vhandles);
161 EXPECT_EQ(4u, mesh_.n_vertices() ) <<
"Wrong number of vertices";
162 EXPECT_EQ(2u, mesh_.n_faces() ) <<
"Wrong number of faces";
167 EXPECT_FALSE( mesh_.get_property_handle(boolHandle,
"boolProp") );
169 mesh_.add_property(boolHandle,
"boolProp");
171 EXPECT_TRUE(mesh_.get_property_handle(boolHandle,
"boolProp"));
176 for ( Mesh::VertexIter v_it = mesh_.vertices_begin() ; v_it != mesh_.vertices_end(); ++v_it ) {
177 mesh_.property(boolHandle,*v_it) = current;
182 Mesh::VertexIter v_it = mesh_.vertices_begin();
183 EXPECT_TRUE( mesh_.property(boolHandle,*v_it) ) <<
"Invalid bool value for vertex 0";
186 EXPECT_FALSE( mesh_.property(boolHandle,*v_it) ) <<
"Invalid bool value for vertex 1";
189 EXPECT_TRUE( mesh_.property(boolHandle,*v_it) ) <<
"Invalid bool value for vertex 2";
192 EXPECT_FALSE( mesh_.property(boolHandle,*v_it) ) <<
"Invalid bool value for vertex 3";
195 std::vector<bool>::iterator it=mesh_.property(boolHandle).data_vector().begin();
196 std::vector<bool>::iterator end=mesh_.property(boolHandle).data_vector().end();
198 EXPECT_TRUE( *it ) <<
"Invalid bool value for vertex 0";
201 EXPECT_FALSE( *it ) <<
"Invalid bool value for vertex 1";
204 EXPECT_TRUE( *it ) <<
"Invalid bool value for vertex 2";
207 EXPECT_FALSE( *it ) <<
"Invalid bool value for vertex 3";
210 EXPECT_EQ( it, end ) <<
"End iterator not mathing!";
216 TEST_F(OpenMeshProperties, VertexPropertyCopypropertiesInt) {
229 std::vector<Mesh::VertexHandle> face_vhandles;
231 face_vhandles.push_back(vhandle[2]);
232 face_vhandles.push_back(vhandle[1]);
233 face_vhandles.push_back(vhandle[0]);
234 mesh_.add_face(face_vhandles);
236 face_vhandles.clear();
238 face_vhandles.push_back(vhandle[2]);
239 face_vhandles.push_back(vhandle[0]);
240 face_vhandles.push_back(vhandle[3]);
241 mesh_.add_face(face_vhandles);
251 EXPECT_EQ(4u, mesh_.n_vertices() ) <<
"Wrong number of vertices";
252 EXPECT_EQ(2u, mesh_.n_faces() ) <<
"Wrong number of faces";
257 EXPECT_FALSE( mesh_.get_property_handle(intHandle,
"intProp") );
259 mesh_.add_property(intHandle,
"intProp");
261 EXPECT_TRUE(mesh_.get_property_handle(intHandle,
"intProp"));
264 for ( Mesh::VertexIter v_it = mesh_.vertices_begin() ; v_it != mesh_.vertices_end(); ++v_it ) {
265 mesh_.property(intHandle,*v_it) = v_it->idx();
269 Mesh::VertexIter v_it = mesh_.vertices_begin();
270 EXPECT_EQ( 0, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 0";
273 EXPECT_EQ( 1, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 1";
276 EXPECT_EQ( 2, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 2";
279 EXPECT_EQ( 3, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 3";
282 v_it = mesh_.vertices_begin();
284 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 0";
285 EXPECT_EQ( 0, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 0";
286 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 0";
289 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 1";
290 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 1";
291 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 1";
294 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 2";
295 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 2";
296 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 2";
299 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 3";
300 EXPECT_EQ( 0, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 3";
301 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 3";
306 mesh_.copy_all_properties(vhandle[1], vhandle[0]);
309 v_it = mesh_.vertices_begin();
311 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 0 after copy";
312 EXPECT_EQ( 0, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 0 after copy";
313 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 0 after copy";
316 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 1 after copy";
317 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 1 after copy";
318 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 1 after copy";
321 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 2 after copy";
322 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 2 after copy";
323 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 2 after copy";
326 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 3 after copy";
327 EXPECT_EQ( 0, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 3 after copy";
328 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 3 after copy";
330 v_it = mesh_.vertices_begin();
331 EXPECT_EQ( 1, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 0 after copy"; ++v_it;
332 EXPECT_EQ( 1, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 1 after copy"; ++v_it;
333 EXPECT_EQ( 2, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 2 after copy"; ++v_it;
334 EXPECT_EQ( 3, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 3 after copy";
339 mesh_.copy_all_properties(vhandle[2], vhandle[3],
true);
342 v_it = mesh_.vertices_begin();
344 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 0 after copy";
345 EXPECT_EQ( 0, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 0 after copy";
346 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 0 after copy";
349 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 1 after copy";
350 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 1 after copy";
351 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 1 after copy";
354 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 2 after copy";
355 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 2 after copy";
356 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 2 after copy";
359 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 3 after copy";
360 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 3 after copy";
361 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 3 after copy";
363 v_it = mesh_.vertices_begin();
364 EXPECT_EQ( 1, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 0 after copy"; ++v_it;
365 EXPECT_EQ( 1, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 1 after copy"; ++v_it;
366 EXPECT_EQ( 2, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 2 after copy"; ++v_it;
367 EXPECT_EQ( 2, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 3 after copy";
377 TEST_F(OpenMeshProperties, CheckStatusPropertiesHalfedgeEdgeAllDeleted) {
381 mesh_.request_vertex_status();
382 mesh_.request_face_status();
383 mesh_.request_halfedge_status();
384 mesh_.request_edge_status();
399 Mesh::FaceHandle f1 = mesh_.add_face(vh1,vh3,vh2);
400 Mesh::FaceHandle f2 = mesh_.add_face(vh1,vh2,vh4);
401 Mesh::FaceHandle f3 = mesh_.add_face(vh2,vh3,vh4);
402 Mesh::FaceHandle f4 = mesh_.add_face(vh3,vh1,vh4);
405 mesh_.delete_face(f1);
406 mesh_.delete_face(f2);
407 mesh_.delete_face(f3);
408 mesh_.delete_face(f4);
410 for( Mesh::ConstHalfedgeIter he_it = mesh_.halfedges_begin(); he_it != mesh_.halfedges_end(); ++he_it)
412 EXPECT_TRUE( mesh_.status(mesh_.edge_handle(*he_it)).deleted() ) <<
"Edge not deleted";
413 EXPECT_TRUE( mesh_.status(*he_it).deleted() ) <<
"Halfedge not deleted";
422 TEST_F(OpenMeshProperties, CopyAllPropertiesVertexAfterRemoveOfProperty) {
435 std::vector<Mesh::VertexHandle> face_vhandles;
437 face_vhandles.push_back(vhandle[2]);
438 face_vhandles.push_back(vhandle[1]);
439 face_vhandles.push_back(vhandle[0]);
440 mesh_.add_face(face_vhandles);
442 face_vhandles.clear();
444 face_vhandles.push_back(vhandle[2]);
445 face_vhandles.push_back(vhandle[0]);
446 face_vhandles.push_back(vhandle[3]);
447 mesh_.add_face(face_vhandles);
457 EXPECT_EQ(4u, mesh_.n_vertices() ) <<
"Wrong number of vertices";
458 EXPECT_EQ(2u, mesh_.n_faces() ) <<
"Wrong number of faces";
463 EXPECT_FALSE( mesh_.get_property_handle(doubleHandle,
"doubleProp") );
465 mesh_.add_property(doubleHandle,
"doubleProp");
467 EXPECT_TRUE(mesh_.get_property_handle(doubleHandle,
"doubleProp"));
472 EXPECT_FALSE( mesh_.get_property_handle(intHandle,
"intProp") );
474 mesh_.add_property(intHandle,
"intProp");
476 EXPECT_TRUE(mesh_.get_property_handle(intHandle,
"intProp"));
479 mesh_.remove_property(doubleHandle);
482 for ( Mesh::VertexIter v_it = mesh_.vertices_begin() ; v_it != mesh_.vertices_end(); ++v_it ) {
483 mesh_.property(intHandle,*v_it) = v_it->idx();
487 Mesh::VertexIter v_it = mesh_.vertices_begin();
488 EXPECT_EQ( 0, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 0";
491 EXPECT_EQ( 1, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 1";
494 EXPECT_EQ( 2, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 2";
497 EXPECT_EQ( 3, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 3";
500 v_it = mesh_.vertices_begin();
502 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 0";
503 EXPECT_EQ( 0, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 0";
504 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 0";
507 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 1";
508 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 1";
509 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 1";
512 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 2";
513 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 2";
514 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 2";
517 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 3";
518 EXPECT_EQ( 0, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 3";
519 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 3";
524 mesh_.copy_all_properties(vhandle[1], vhandle[0]);
527 v_it = mesh_.vertices_begin();
529 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 0 after copy";
530 EXPECT_EQ( 0, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 0 after copy";
531 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 0 after copy";
534 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 1 after copy";
535 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 1 after copy";
536 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 1 after copy";
539 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 2 after copy";
540 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 2 after copy";
541 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 2 after copy";
544 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 3 after copy";
545 EXPECT_EQ( 0, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 3 after copy";
546 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 3 after copy";
548 v_it = mesh_.vertices_begin();
549 EXPECT_EQ( 1, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 0 after copy"; ++v_it;
550 EXPECT_EQ( 1, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 1 after copy"; ++v_it;
551 EXPECT_EQ( 2, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 2 after copy"; ++v_it;
552 EXPECT_EQ( 3, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 3 after copy";
557 mesh_.copy_all_properties(vhandle[2], vhandle[3],
true);
560 v_it = mesh_.vertices_begin();
562 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 0 after copy";
563 EXPECT_EQ( 0, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 0 after copy";
564 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 0 after copy";
567 EXPECT_EQ( 0, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 1 after copy";
568 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 1 after copy";
569 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 1 after copy";
572 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 2 after copy";
573 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 2 after copy";
574 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 2 after copy";
577 EXPECT_EQ( 1, mesh_.point(*v_it)[0] ) <<
"Invalid x position for vertex 3 after copy";
578 EXPECT_EQ( 1, mesh_.point(*v_it)[1] ) <<
"Invalid y position for vertex 3 after copy";
579 EXPECT_EQ( 0, mesh_.point(*v_it)[2] ) <<
"Invalid z position for vertex 3 after copy";
581 v_it = mesh_.vertices_begin();
582 EXPECT_EQ( 1, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 0 after copy"; ++v_it;
583 EXPECT_EQ( 1, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 1 after copy"; ++v_it;
584 EXPECT_EQ( 2, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 2 after copy"; ++v_it;
585 EXPECT_EQ( 2, mesh_.property(intHandle,*v_it) ) <<
"Invalid int value for vertex 3 after copy";
593 TEST_F(OpenMeshProperties, PropertyIterators ) {
606 std::vector<Mesh::VertexHandle> face_vhandles;
608 face_vhandles.push_back(vhandle[2]);
609 face_vhandles.push_back(vhandle[1]);
610 face_vhandles.push_back(vhandle[0]);
611 mesh_.add_face(face_vhandles);
613 face_vhandles.clear();
615 face_vhandles.push_back(vhandle[2]);
616 face_vhandles.push_back(vhandle[0]);
617 face_vhandles.push_back(vhandle[3]);
618 mesh_.add_face(face_vhandles);
628 EXPECT_EQ(4u, mesh_.n_vertices() ) <<
"Wrong number of vertices";
629 EXPECT_EQ(2u, mesh_.n_faces() ) <<
"Wrong number of faces";
636 EXPECT_FALSE( mesh_.get_property_handle(doubleHandleV,
"doublePropV") );
637 EXPECT_FALSE( mesh_.get_property_handle(intHandleV,
"intPropV") );
639 mesh_.add_property(doubleHandleV,
"doublePropV");
640 mesh_.add_property(intHandleV,
"intPropV");
642 EXPECT_TRUE(mesh_.get_property_handle(doubleHandleV,
"doublePropV"));
643 EXPECT_TRUE(mesh_.get_property_handle(intHandleV,
"intPropV"));
649 EXPECT_FALSE( mesh_.get_property_handle(doubleHandleE,
"doublePropE") );
650 EXPECT_FALSE( mesh_.get_property_handle(intHandleE,
"intPropE") );
652 mesh_.add_property(doubleHandleE,
"doublePropE");
653 mesh_.add_property(intHandleE,
"intPropE");
655 EXPECT_TRUE(mesh_.get_property_handle(doubleHandleE,
"doublePropE"));
656 EXPECT_TRUE(mesh_.get_property_handle(intHandleE,
"intPropE"));
663 EXPECT_FALSE( mesh_.get_property_handle(doubleHandleF,
"doublePropF") );
664 EXPECT_FALSE( mesh_.get_property_handle(intHandleF,
"intPropF") );
666 mesh_.add_property(doubleHandleF,
"doublePropF");
667 mesh_.add_property(intHandleF,
"intPropF");
669 EXPECT_TRUE(mesh_.get_property_handle(doubleHandleF,
"doublePropF"));
670 EXPECT_TRUE(mesh_.get_property_handle(intHandleF,
"intPropF"));
675 unsigned int vertex_props = 0;
676 for (Mesh::prop_iterator vprop_it = mesh_.vprops_begin() ; vprop_it != mesh_.vprops_end(); ++vprop_it) {
677 switch (vertex_props) {
679 EXPECT_EQ (
"v:points",(*vprop_it)->name()) <<
"Wrong Vertex property name";
682 EXPECT_EQ (
"<vprop>",(*vprop_it)->name()) <<
"Wrong Vertex property name";
685 EXPECT_EQ (
"doublePropV",(*vprop_it)->name()) <<
"Wrong Vertex property name";
688 EXPECT_EQ (
"intPropV",(*vprop_it)->name()) <<
"Wrong Vertex property name";
691 EXPECT_EQ (4u , vertex_props);
697 EXPECT_EQ (4u,vertex_props) <<
"Wrong number of vertex properties";
701 unsigned int edge_props = 0;
702 for (Mesh::prop_iterator eprop_it = mesh_.eprops_begin() ; eprop_it != mesh_.eprops_end(); ++eprop_it) {
703 switch (edge_props) {
705 EXPECT_EQ (
"<eprop>",(*eprop_it)->name()) <<
"Wrong Edge property name";
708 EXPECT_EQ (
"doublePropE",(*eprop_it)->name()) <<
"Wrong Edge property name";
711 EXPECT_EQ (
"intPropE",(*eprop_it)->name()) <<
"Wrong Edge property name";
714 EXPECT_EQ (4u , edge_props);
720 EXPECT_EQ (3u,edge_props) <<
"Wrong number of edge properties";
724 unsigned int face_props = 0;
725 for (Mesh::prop_iterator prop_it = mesh_.fprops_begin() ; prop_it != mesh_.fprops_end(); ++prop_it) {
726 switch (face_props) {
728 EXPECT_EQ (
"<fprop>",(*prop_it)->name()) <<
"Wrong Face property name";
731 EXPECT_EQ (
"doublePropF",(*prop_it)->name()) <<
"Wrong Face property name";
734 EXPECT_EQ (
"intPropF",(*prop_it)->name()) <<
"Wrong Face property name";
737 EXPECT_EQ (4u , face_props);
743 EXPECT_EQ (3u,face_props) <<
"Wrong number of face properties";
749 TEST_F(OpenMeshProperties, MeshAssignment ) {
756 copy.request_vertex_status();
757 copy.request_vertex_normals();
758 copy.request_vertex_colors();
759 copy.request_vertex_texcoords1D();
760 copy.request_vertex_texcoords2D();
761 copy.request_vertex_texcoords3D();
762 copy.request_halfedge_status();
763 copy.request_halfedge_texcoords1D();
764 copy.request_halfedge_texcoords2D();
765 copy.request_halfedge_texcoords3D();
766 copy.request_edge_status();
767 copy.request_edge_colors();
768 copy.request_halfedge_normals();
769 copy.request_halfedge_colors();
770 copy.request_face_status();
771 copy.request_face_normals();
772 copy.request_face_colors();
773 copy.request_face_texture_index();
775 EXPECT_TRUE(copy.has_vertex_status());
776 EXPECT_TRUE(copy.has_vertex_normals());
777 EXPECT_TRUE(copy.has_vertex_colors());
778 EXPECT_TRUE(copy.has_vertex_texcoords1D());
779 EXPECT_TRUE(copy.has_vertex_texcoords2D());
780 EXPECT_TRUE(copy.has_vertex_texcoords3D());
781 EXPECT_TRUE(copy.has_halfedge_status());
782 EXPECT_TRUE(copy.has_halfedge_texcoords1D());
783 EXPECT_TRUE(copy.has_halfedge_texcoords2D());
784 EXPECT_TRUE(copy.has_halfedge_texcoords3D());
785 EXPECT_TRUE(copy.has_edge_status());
786 EXPECT_TRUE(copy.has_edge_colors());
787 EXPECT_TRUE(copy.has_halfedge_normals());
788 EXPECT_TRUE(copy.has_halfedge_colors());
789 EXPECT_TRUE(copy.has_face_status());
790 EXPECT_TRUE(copy.has_face_normals());
791 EXPECT_TRUE(copy.has_face_colors());
792 EXPECT_TRUE(copy.has_face_texture_index());
794 copy.assign(mesh_,
true);
796 EXPECT_FALSE(copy.has_vertex_status());
797 EXPECT_FALSE(copy.has_vertex_normals());
798 EXPECT_FALSE(copy.has_vertex_colors());
799 EXPECT_FALSE(copy.has_vertex_texcoords1D());
800 EXPECT_FALSE(copy.has_vertex_texcoords2D());
801 EXPECT_FALSE(copy.has_vertex_texcoords3D());
802 EXPECT_FALSE(copy.has_halfedge_status());
803 EXPECT_FALSE(copy.has_halfedge_texcoords1D());
804 EXPECT_FALSE(copy.has_halfedge_texcoords2D());
805 EXPECT_FALSE(copy.has_halfedge_texcoords3D());
806 EXPECT_FALSE(copy.has_edge_status());
807 EXPECT_FALSE(copy.has_edge_colors());
808 EXPECT_FALSE(copy.has_halfedge_normals());
809 EXPECT_FALSE(copy.has_halfedge_colors());
810 EXPECT_FALSE(copy.has_face_status());
811 EXPECT_FALSE(copy.has_face_normals());
812 EXPECT_FALSE(copy.has_face_colors());
813 EXPECT_FALSE(copy.has_face_texture_index());
815 copy.request_vertex_status();
816 copy.request_vertex_normals();
817 copy.request_vertex_colors();
818 copy.request_vertex_texcoords1D();
819 copy.request_vertex_texcoords2D();
820 copy.request_vertex_texcoords3D();
821 copy.request_halfedge_status();
822 copy.request_halfedge_texcoords1D();
823 copy.request_halfedge_texcoords2D();
824 copy.request_halfedge_texcoords3D();
825 copy.request_edge_status();
826 copy.request_edge_colors();
827 copy.request_halfedge_normals();
828 copy.request_halfedge_colors();
829 copy.request_face_status();
830 copy.request_face_normals();
831 copy.request_face_colors();
832 copy.request_face_texture_index();
834 EXPECT_TRUE(copy.has_vertex_status()) <<
"Mesh has no vertex status even though they have been requested";
835 EXPECT_TRUE(copy.has_vertex_normals()) <<
"Mesh has no vertex normals even though they have been requested";
836 EXPECT_TRUE(copy.has_vertex_colors()) <<
"Mesh has no vertex colors even though they have been requested";
837 EXPECT_TRUE(copy.has_vertex_texcoords1D()) <<
"Mesh has no vertex texcoord1D even though they have been requested";
838 EXPECT_TRUE(copy.has_vertex_texcoords2D()) <<
"Mesh has no vertex texcoord2D even though they have been requested";
839 EXPECT_TRUE(copy.has_vertex_texcoords3D()) <<
"Mesh has no vertex texcoord3D even though they have been requested";
840 EXPECT_TRUE(copy.has_halfedge_status()) <<
"Mesh has no halfedge status even though they have been requested";
841 EXPECT_TRUE(copy.has_halfedge_texcoords1D()) <<
"Mesh has no halfedge texcoords1D even though they have been requested";
842 EXPECT_TRUE(copy.has_halfedge_texcoords2D()) <<
"Mesh has no halfedge texcoords2D even though they have been requested";
843 EXPECT_TRUE(copy.has_halfedge_texcoords3D()) <<
"Mesh has no halfedge texcoords3D even though they have been requested";
844 EXPECT_TRUE(copy.has_edge_status()) <<
"Mesh has no edge status even though they have been requested";
845 EXPECT_TRUE(copy.has_edge_colors()) <<
"Mesh has no edge colors even though they have been requested";
846 EXPECT_TRUE(copy.has_halfedge_normals()) <<
"Mesh has no halfedge normals even though they have been requested";
847 EXPECT_TRUE(copy.has_halfedge_colors()) <<
"Mesh has no halfedge colors even though they have been requested";
848 EXPECT_TRUE(copy.has_face_status()) <<
"Mesh has no face status even though they have been requested";
849 EXPECT_TRUE(copy.has_face_normals()) <<
"Mesh has no face normals even though they have been requested";
850 EXPECT_TRUE(copy.has_face_colors()) <<
"Mesh has no face colors even though they have been requested";
851 EXPECT_TRUE(copy.has_face_texture_index()) <<
"Mesh has no face texture index even though they have been requested";
Kernel::Point Point
Coordinate type.
VertexHandle add_vertex(const Point &_p)
Alias for new_vertex(const Point&).
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.