Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenMesh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenMesh
OpenMesh
Commits
b25d465b
Commit
b25d465b
authored
Nov 04, 2019
by
Jan Möbius
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'DefaultMeshTypes' into 'master'
actually test double traits See merge request
!231
parents
eb38f6e5
74cd2937
Pipeline
#12646
passed with stages
in 108 minutes and 9 seconds
Changes
5
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
341 additions
and
70 deletions
+341
-70
src/Unittests/unittests_common.hh
src/Unittests/unittests_common.hh
+3
-0
src/Unittests/unittests_read_write_OBJ.cc
src/Unittests/unittests_read_write_OBJ.cc
+44
-0
src/Unittests/unittests_read_write_OFF.cc
src/Unittests/unittests_read_write_OFF.cc
+61
-14
src/Unittests/unittests_read_write_OM.cc
src/Unittests/unittests_read_write_OM.cc
+60
-9
src/Unittests/unittests_read_write_PLY.cc
src/Unittests/unittests_read_write_PLY.cc
+173
-47
No files found.
src/Unittests/unittests_common.hh
View file @
b25d465b
...
...
@@ -9,6 +9,9 @@
#ifdef TEST_CUSTOM_TRAITS
#include <Unittests/unittests_common_customtraits.hh>
#elif defined(TEST_DOUBLE_TRAITS)
struct
CustomTraits
:
public
OpenMesh
::
DefaultTraitsDouble
{
};
#else
struct
CustomTraits
:
public
OpenMesh
::
DefaultTraits
{
};
...
...
src/Unittests/unittests_read_write_OBJ.cc
View file @
b25d465b
...
...
@@ -325,9 +325,16 @@ TEST_F(OpenMeshReadWriteOBJ, LoadObjWithMaterial) {
EXPECT_TRUE
(
fh
.
is_valid
())
<<
"fh should be valid"
;
#ifdef TEST_DOUBLE_TRAITS
EXPECT_FLOAT_EQ
(
128
/
255.0
,
mesh_
.
color
(
fh
)[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_FLOAT_EQ
(
128
/
255.0
,
mesh_
.
color
(
fh
)[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_FLOAT_EQ
(
128
/
255.0
,
mesh_
.
color
(
fh
)[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
fh
)[
3
]
)
<<
"Wrong vertex color at vertex 0 component 3"
;
#else
EXPECT_EQ
(
128
,
mesh_
.
color
(
fh
)[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_EQ
(
128
,
mesh_
.
color
(
fh
)[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_EQ
(
128
,
mesh_
.
color
(
fh
)[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
#endif
mesh_
.
release_face_colors
();
}
...
...
@@ -385,6 +392,24 @@ TEST_F(OpenMeshReadWriteOBJ, LoadSimpleOBJWithVertexColorsAfterVertices) {
EXPECT_EQ
(
18u
,
mesh_
.
n_edges
())
<<
"The number of loaded edges is not correct!"
;
EXPECT_EQ
(
12u
,
mesh_
.
n_faces
())
<<
"The number of loaded faces is not correct!"
;
#ifdef TEST_DOUBLE_TRAITS
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
0
]
)
<<
"Wrong vertex color at vertex 3 component 0"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
2
]
)
<<
"Wrong vertex color at vertex 3 component 2"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
1
]
)
<<
"Wrong vertex color at vertex 4 component 1"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
2
]
)
<<
"Wrong vertex color at vertex 7 component 2"
;
#else
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
...
...
@@ -400,6 +425,7 @@ TEST_F(OpenMeshReadWriteOBJ, LoadSimpleOBJWithVertexColorsAfterVertices) {
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
2
]
)
<<
"Wrong vertex color at vertex 7 component 2"
;
#endif
mesh_
.
release_vertex_colors
();
}
...
...
@@ -424,6 +450,23 @@ TEST_F(OpenMeshReadWriteOBJ, LoadSimpleOBJWithVertexColorsAsVCLines) {
EXPECT_EQ
(
18u
,
mesh_
.
n_edges
())
<<
"The number of loaded edges is not correct!"
;
EXPECT_EQ
(
12u
,
mesh_
.
n_faces
())
<<
"The number of loaded faces is not correct!"
;
#ifdef TEST_DOUBLE_TRAITS
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
0
]
)
<<
"Wrong vertex color at vertex 3 component 0"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
2
]
)
<<
"Wrong vertex color at vertex 3 component 2"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
1
]
)
<<
"Wrong vertex color at vertex 4 component 1"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
2
]
)
<<
"Wrong vertex color at vertex 7 component 2"
;
#else
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
...
...
@@ -439,6 +482,7 @@ TEST_F(OpenMeshReadWriteOBJ, LoadSimpleOBJWithVertexColorsAsVCLines) {
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
2
]
)
<<
"Wrong vertex color at vertex 7 component 2"
;
#endif
mesh_
.
release_vertex_colors
();
...
...
src/Unittests/unittests_read_write_OFF.cc
View file @
b25d465b
...
...
@@ -60,8 +60,13 @@ TEST_F(OpenMeshReadWriteOFF, WriteAndReadVertexColorsToAndFromOFFFile) {
mesh_
.
add_vertex
(
Mesh
::
Point
(
0
,
1
,
1
)
);
mesh_
.
add_vertex
(
Mesh
::
Point
(
1
,
0
,
1
)
);
#ifdef TEST_DOUBLE_TRAITS
// using the default color type Vec4f from DefaultTraitsDouble in Traits.hh
Mesh
::
Color
testColor
(
255
/
255.0
,
128
/
255.0
,
64
/
255.0
,
1.0
);
#else
// using the default color type Vec3uc from DefaultTraits in Traits.hh
Mesh
::
Color
testColor
(
255
,
128
,
64
);
#endif
// setting colors (different from black)
for
(
Mesh
::
VertexIter
vit
=
mesh_
.
vertices_begin
(),
vitend
=
mesh_
.
vertices_end
();
vit
!=
vitend
;
++
vit
)
...
...
@@ -71,7 +76,10 @@ TEST_F(OpenMeshReadWriteOFF, WriteAndReadVertexColorsToAndFromOFFFile) {
int
count
=
0
;
for
(
Mesh
::
VertexIter
vit
=
mesh_
.
vertices_begin
(),
vitend
=
mesh_
.
vertices_end
();
vit
!=
vitend
;
++
vit
)
{
Mesh
::
Color
color
=
mesh_
.
color
(
*
vit
);
if
(
color
[
0
]
!=
testColor
[
0
]
||
color
[
1
]
!=
testColor
[
1
]
||
color
[
2
]
!=
testColor
[
2
]
)
bool
wrong_color
=
false
;
for
(
size_t
i
=
0
;
i
<
color
.
size
();
++
i
)
wrong_color
=
wrong_color
||
(
color
[
i
]
!=
testColor
[
i
]);
if
(
wrong_color
)
++
count
;
}
...
...
@@ -87,7 +95,10 @@ TEST_F(OpenMeshReadWriteOFF, WriteAndReadVertexColorsToAndFromOFFFile) {
count
=
0
;
for
(
Mesh
::
VertexIter
vit
=
mesh_
.
vertices_begin
(),
vitend
=
mesh_
.
vertices_end
();
vit
!=
vitend
;
++
vit
)
{
Mesh
::
Color
color
=
mesh_
.
color
(
*
vit
);
if
(
color
[
0
]
!=
testColor
[
0
]
||
color
[
1
]
!=
testColor
[
1
]
||
color
[
2
]
!=
testColor
[
2
]
)
bool
wrong_color
=
false
;
for
(
size_t
i
=
0
;
i
<
color
.
size
();
++
i
)
wrong_color
=
wrong_color
||
(
color
[
i
]
!=
testColor
[
i
]);
if
(
wrong_color
)
++
count
;
}
...
...
@@ -123,21 +134,39 @@ TEST_F(OpenMeshReadWriteOFF, WriteAndReadFloatVertexColorsToAndFromOFFFile) {
EXPECT_EQ
(
18u
,
mesh_
.
n_edges
())
<<
"The number of loaded edges is not correct!"
;
EXPECT_EQ
(
12u
,
mesh_
.
n_faces
())
<<
"The number of loaded faces is not correct!"
;
#ifdef TEST_DOUBLE_TRAITS
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
0
]
)
<<
"Wrong vertex color at vertex 3 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
2
]
)
<<
"Wrong vertex color at vertex 3 component 2"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
1
]
)
<<
"Wrong vertex color at vertex 4 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
2
]
)
<<
"Wrong vertex color at vertex 7 component 2"
;
#else
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
0
]
)
<<
"Wrong vertex color at vertex 3 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
2
]
)
<<
"Wrong vertex color at vertex 3 component 2"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
1
]
)
<<
"Wrong vertex color at vertex 4 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
2
]
)
<<
"Wrong vertex color at vertex 7 component 2"
;
#endif
EXPECT_FALSE
(
opt
.
vertex_has_normal
())
<<
"Wrong user opt are returned!"
;
EXPECT_FALSE
(
opt
.
vertex_has_texcoord
())
<<
"Wrong user opt are returned!"
;
...
...
@@ -179,21 +208,39 @@ TEST_F(OpenMeshReadWriteOFF, WriteAndReadBinaryFloatVertexColorsToAndFromOFFFile
EXPECT_EQ
(
18u
,
mesh_
.
n_edges
())
<<
"The number of loaded edges is not correct!"
;
EXPECT_EQ
(
12u
,
mesh_
.
n_faces
())
<<
"The number of loaded faces is not correct!"
;
#ifdef TEST_DOUBLE_TRAITS
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
0
]
)
<<
"Wrong vertex color at vertex 3 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
2
]
)
<<
"Wrong vertex color at vertex 3 component 2"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
1
]
)
<<
"Wrong vertex color at vertex 4 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
2
]
)
<<
"Wrong vertex color at vertex 7 component 2"
;
#else
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
0
]
)
<<
"Wrong vertex color at vertex 3 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
2
]
)
<<
"Wrong vertex color at vertex 3 component 2"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
1
]
)
<<
"Wrong vertex color at vertex 4 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
2
]
)
<<
"Wrong vertex color at vertex 7 component 2"
;
#endif
EXPECT_FALSE
(
opt
.
vertex_has_normal
())
<<
"Wrong user opt are returned!"
;
EXPECT_FALSE
(
opt
.
vertex_has_texcoord
())
<<
"Wrong user opt are returned!"
;
...
...
src/Unittests/unittests_read_write_OM.cc
View file @
b25d465b
...
...
@@ -118,21 +118,39 @@ TEST_F(OpenMeshReadWriteOM, LoadSimpleOMWithVertexColors) {
EXPECT_EQ
(
18u
,
mesh_
.
n_edges
())
<<
"The number of loaded edges is not correct!"
;
EXPECT_EQ
(
12u
,
mesh_
.
n_faces
())
<<
"The number of loaded faces is not correct!"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
#ifdef TEST_DOUBLE_TRAITS
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
0
]
)
<<
"Wrong vertex color at vertex 3 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
2
]
)
<<
"Wrong vertex color at vertex 3 component 2"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
1
]
)
<<
"Wrong vertex color at vertex 4 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_FLOAT_EQ
(
0.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_FLOAT_EQ
(
1.0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
2
]
)
<<
"Wrong vertex color at vertex 7 component 2"
;
#else
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
0
]
)
<<
"Wrong vertex color at vertex 0 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
1
]
)
<<
"Wrong vertex color at vertex 0 component 1"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
0
))[
2
]
)
<<
"Wrong vertex color at vertex 0 component 2"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
0
]
)
<<
"Wrong vertex color at vertex 3 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
2
]
)
<<
"Wrong vertex color at vertex 3 component 2"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
0
]
)
<<
"Wrong vertex color at vertex 3 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
1
]
)
<<
"Wrong vertex color at vertex 3 component 1"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
3
))[
2
]
)
<<
"Wrong vertex color at vertex 3 component 2"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
0
]
)
<<
"Wrong vertex color at vertex 4 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
1
]
)
<<
"Wrong vertex color at vertex 4 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
4
))[
2
]
)
<<
"Wrong vertex color at vertex 4 component 2"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
0
]
)
<<
"Wrong vertex color at vertex 7 component 0"
;
EXPECT_EQ
(
0
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
1
]
)
<<
"Wrong vertex color at vertex 7 component 1"
;
EXPECT_EQ
(
255
,
mesh_
.
color
(
mesh_
.
vertex_handle
(
7
))[
2
]
)
<<
"Wrong vertex color at vertex 7 component 2"
;
#endif
EXPECT_FALSE
(
options
.
vertex_has_normal
())
<<
"Wrong user options are returned!"
;
EXPECT_FALSE
(
options
.
vertex_has_texcoord
())
<<
"Wrong user options are returned!"
;
...
...
@@ -203,9 +221,15 @@ TEST_F(OpenMeshReadWriteOM, WriteTriangleVertexIntegerColor) {
Mesh
::
VertexHandle
v3
=
mesh
.
add_vertex
(
Mesh
::
Point
(
0.0
,
0.0
,
1.0
));
mesh
.
add_face
(
v1
,
v2
,
v3
);
#ifdef TEST_DOUBLE_TRAITS
Mesh
::
Color
c1
=
Mesh
::
Color
(
0
,
0
,
123
/
255.0
,
1.0
),
c2
=
Mesh
::
Color
(
21
/
255.0
,
0
,
0
,
1.0
),
c3
=
Mesh
::
Color
(
0
,
222
/
255.0
,
0
,
1.0
);
#else
Mesh
::
Color
c1
=
Mesh
::
Color
(
0
,
0
,
123
),
c2
=
Mesh
::
Color
(
21
,
0
,
0
),
c3
=
Mesh
::
Color
(
0
,
222
,
0
);
#endif
mesh
.
set_color
(
v1
,
c1
);
mesh
.
set_color
(
v2
,
c2
);
...
...
@@ -234,9 +258,20 @@ TEST_F(OpenMeshReadWriteOM, WriteTriangleVertexIntegerColor) {
EXPECT_EQ
(
Mesh
::
Point
(
0.0
,
1.0
,
0.0
)
,
cmpMesh
.
point
(
v2
))
<<
"Wrong coordinates at vertex 1"
;
EXPECT_EQ
(
Mesh
::
Point
(
0.0
,
0.0
,
1.0
)
,
cmpMesh
.
point
(
v3
))
<<
"Wrong coordinates at vertex 2"
;
#ifdef TEST_DOUBLE_TRAITS
// OM file format does not support writing colors as float. They are stored as unsigned character.
// Thus, the values will not be exactly equal.
for
(
size_t
i
=
0
;
i
<
c1
.
size
();
++
i
)
{
EXPECT_FLOAT_EQ
(
c1
[
i
]
,
cmpMesh
.
color
(
v1
)[
i
])
<<
"Wrong colors at coordinate "
<<
i
<<
" of vertex 0"
;
EXPECT_FLOAT_EQ
(
c2
[
i
]
,
cmpMesh
.
color
(
v2
)[
i
])
<<
"Wrong colors at coordinate "
<<
i
<<
" of vertex 1"
;
EXPECT_FLOAT_EQ
(
c3
[
i
]
,
cmpMesh
.
color
(
v3
)[
i
])
<<
"Wrong colors at coordinate "
<<
i
<<
" of vertex 2"
;
}
#else
EXPECT_EQ
(
c1
,
cmpMesh
.
color
(
v1
))
<<
"Wrong colors at vertex 0"
;
EXPECT_EQ
(
c2
,
cmpMesh
.
color
(
v2
))
<<
"Wrong colors at vertex 1"
;
EXPECT_EQ
(
c3
,
cmpMesh
.
color
(
v3
))
<<
"Wrong colors at vertex 2"
;
#endif
//clean up
cmpMesh
.
release_vertex_colors
();
...
...
@@ -570,7 +605,15 @@ TEST_F(OpenMeshReadWriteOM, WriteSplitTriangleEdgeIntProperty) {
EXPECT_EQ
(
Mesh
::
Point
(
1.0
,
0.0
,
0.0
)
,
cmpMesh
.
point
(
v1
))
<<
"Wrong coordinates at vertex 0"
;
EXPECT_EQ
(
Mesh
::
Point
(
0.0
,
1.0
,
0.0
)
,
cmpMesh
.
point
(
v2
))
<<
"Wrong coordinates at vertex 1"
;
EXPECT_EQ
(
Mesh
::
Point
(
0.0
,
0.0
,
1.0
)
,
cmpMesh
.
point
(
v3
))
<<
"Wrong coordinates at vertex 2"
;
EXPECT_EQ
(
c
,
cmpMesh
.
point
(
v4
))
<<
"Wrong coordinates at vertex 3"
;
#ifdef TEST_DOUBLE_TRAITS
// TODO: should it be possible to read and write double precision exactly?
EXPECT_FLOAT_EQ
(
c
[
0
]
,
cmpMesh
.
point
(
v4
)[
0
])
<<
"Wrong coordinate 0 at vertex 4"
;
EXPECT_FLOAT_EQ
(
c
[
1
]
,
cmpMesh
.
point
(
v4
)[
1
])
<<
"Wrong coordinate 1 at vertex 4"
;
EXPECT_FLOAT_EQ
(
c
[
2
]
,
cmpMesh
.
point
(
v4
)[
2
])
<<
"Wrong coordinate 2 at vertex 4"
;
#else
EXPECT_EQ
(
c
,
cmpMesh
.
point
(
v4
))
<<
"Wrong coordinates at vertex 4"
;
#endif
EXPECT_EQ
(
value1
,
cmpMesh
.
property
(
prop
,
e1
))
<<
"Wrong property at edge 0"
;
EXPECT_EQ
(
value2
,
cmpMesh
.
property
(
prop
,
e2
))
<<
"Wrong property at edge 1"
;
...
...
@@ -746,7 +789,15 @@ TEST_F(OpenMeshReadWriteOM, WriteSplitTriangleStatusProperties) {
EXPECT_EQ
(
Mesh
::
Point
(
1.0
,
0.0
,
0.0
)
,
cmpMesh
.
point
(
v0
))
<<
"Wrong coordinates at vertex 0"
;
EXPECT_EQ
(
Mesh
::
Point
(
0.0
,
1.0
,
0.0
)
,
cmpMesh
.
point
(
v1
))
<<
"Wrong coordinates at vertex 1"
;
EXPECT_EQ
(
Mesh
::
Point
(
0.0
,
0.0
,
1.0
)
,
cmpMesh
.
point
(
v2
))
<<
"Wrong coordinates at vertex 2"
;
#ifdef TEST_DOUBLE_TRAITS
// TODO: should it be possible to read and write double precision exactly?
EXPECT_FLOAT_EQ
(
c
[
0
]
,
cmpMesh
.
point
(
v3
)[
0
])
<<
"Wrong coordinate 0 at vertex 3"
;
EXPECT_FLOAT_EQ
(
c
[
1
]
,
cmpMesh
.
point
(
v3
)[
1
])
<<
"Wrong coordinate 1 at vertex 3"
;
EXPECT_FLOAT_EQ
(
c
[
2
]
,
cmpMesh
.
point
(
v3
)[
2
])
<<
"Wrong coordinate 2 at vertex 3"
;
#else
EXPECT_EQ
(
c
,
cmpMesh
.
point
(
v3
))
<<
"Wrong coordinates at vertex 3"
;
#endif
for
(
auto
vh
:
cmpMesh
.
all_vertices
())
{
...
...
src/Unittests/unittests_read_write_PLY.cc
View file @
b25d465b
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment