mirror of https://github.com/CGAL/cgal
NOT WORKING
This commit is contained in:
parent
d00c494e89
commit
c8c41a54d3
|
|
@ -121,7 +121,13 @@ void test_bgl_OFF(const char* filename)
|
|||
bool ok = CGAL::read_OFF(is, fg);
|
||||
assert(ok);
|
||||
assert(num_vertices(fg) != 0 && num_faces(fg) != 0);
|
||||
is.close();
|
||||
fg.clear();
|
||||
|
||||
is.open(filename, std::ios::binary);
|
||||
ok = CGAL::read_OFF(is, fg);
|
||||
assert(ok);
|
||||
assert(num_vertices(fg) != 0 && num_faces(fg) != 0);
|
||||
// write with OFF
|
||||
{
|
||||
std::ofstream os("tmp.off");
|
||||
|
|
@ -281,6 +287,17 @@ void test_bgl_OFF(const char* filename)
|
|||
|
||||
for(const auto f : faces(fg))
|
||||
assert(get(fcm, f) != CGAL::Color());
|
||||
fg.clear();
|
||||
is.close();
|
||||
is.open("data/full.off", std::ios::binary);
|
||||
VertexNormalMap vnm2 = get(CGAL::dynamic_vertex_property_t<Vector>(), fg);
|
||||
VertexColorMap vcm2 = get(CGAL::dynamic_vertex_property_t<CGAL::Color>(), fg);
|
||||
VertexTextureMap vtm2 = get(CGAL::dynamic_vertex_property_t<Point_2>(), fg);
|
||||
FaceColorMap fcm2 = get(CGAL::dynamic_face_property_t<CGAL::Color>(), fg);
|
||||
ok = CGAL::read_OFF(is, fg, CGAL::parameters::vertex_normal_map(vnm2)
|
||||
.vertex_color_map(vcm2)
|
||||
.vertex_texture_map(vtm2)
|
||||
.face_color_map(fcm2));
|
||||
|
||||
// write with OFF
|
||||
{
|
||||
|
|
@ -451,8 +468,18 @@ void test_bgl_PLY(const std::string filename,
|
|||
Mesh fg;
|
||||
std::ifstream is(filename);
|
||||
bool ok = CGAL::read_PLY(is, fg, CGAL::parameters::use_binary_mode(false));
|
||||
is.close();
|
||||
assert(ok);
|
||||
assert(filename != "data/colored_tetra.ply" || (num_vertices(fg) == 4 && num_faces(fg) == 4));
|
||||
if(!binary)
|
||||
{
|
||||
fg.clear();
|
||||
is.open(filename, std::ios::binary);
|
||||
bool ok = CGAL::read_PLY(is, fg, CGAL::parameters::use_binary_mode(false));
|
||||
is.close();
|
||||
assert(ok);
|
||||
assert(filename != "data/colored_tetra.ply" || (num_vertices(fg) == 4 && num_faces(fg) == 4));
|
||||
}
|
||||
|
||||
// write with PLY
|
||||
{
|
||||
|
|
@ -643,6 +670,18 @@ void test_bgl_STL(const std::string filename)
|
|||
assert(num_vertices(fg) == num_vertices(fg2) && num_faces(fg) == num_faces(fg2));
|
||||
}
|
||||
|
||||
// write with ASCII in binary mode
|
||||
{
|
||||
ok = CGAL::write_polygon_mesh("ascii.stl", fg, CGAL::parameters::use_binary_mode(false));
|
||||
assert(ok);
|
||||
std::ifstream test_ascii("ascii.stl", std::ios::binary);
|
||||
Mesh fg2;
|
||||
ok = CGAL::read_STL(test_ascii, fg2, CGAL::parameters::use_binary_mode(false));
|
||||
test_ascii.close();
|
||||
assert(ok);
|
||||
assert(num_vertices(fg) == num_vertices(fg2) && num_faces(fg) == num_faces(fg2));
|
||||
}
|
||||
|
||||
std::cerr << " ########### Error text is expected to follow." << std::endl;
|
||||
ok = CGAL::read_STL("data/mesh_that_doesnt_exist.stl", fg);
|
||||
assert(!ok);
|
||||
|
|
@ -861,13 +900,13 @@ int main(int argc, char** argv)
|
|||
{
|
||||
// OFF
|
||||
const char* off_file = (argc > 1) ? argv[1] : "data/prim.off";
|
||||
test_bgl_OFF<Polyhedron, Kernel>(off_file);
|
||||
Polyhedron fg;
|
||||
bool ok = CGAL::read_OFF("data/invalid_header.off", fg); // wrong header (NOFF but no normals)
|
||||
assert(ok);
|
||||
//test_bgl_OFF<Polyhedron, Kernel>(off_file);
|
||||
//Polyhedron fg;
|
||||
//bool ok = CGAL::read_OFF("data/invalid_header.off", fg); // wrong header (NOFF but no normals)
|
||||
//assert(ok);
|
||||
test_bgl_OFF<SM, Kernel>(off_file);
|
||||
SM sm;
|
||||
ok = CGAL::read_OFF("data/invalid_header.off", sm); // wrong header (NOFF but no normals)
|
||||
bool ok = CGAL::read_OFF("data/invalid_header.off", sm); // wrong header (NOFF but no normals)
|
||||
assert(!ok);
|
||||
test_bgl_OFF<LCC, Kernel>(off_file);
|
||||
LCC lcc;
|
||||
|
|
|
|||
Loading…
Reference in New Issue