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-python
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenMesh
openmesh-python
Commits
033e7b5e
Commit
033e7b5e
authored
Mar 26, 2018
by
Alexander Dielen
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
throw exception if read_mesh() fails
parent
9b40bddc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
1 deletion
+36
-1
src/InputOutput.cc
src/InputOutput.cc
+6
-1
tests/test_read_write_obj.py
tests/test_read_write_obj.py
+6
-0
tests/test_read_write_off.py
tests/test_read_write_off.py
+6
-0
tests/test_read_write_om.py
tests/test_read_write_om.py
+6
-0
tests/test_read_write_ply.py
tests/test_read_write_ply.py
+6
-0
tests/test_read_write_stl.py
tests/test_read_write_stl.py
+6
-0
No files found.
src/InputOutput.cc
View file @
033e7b5e
...
...
@@ -70,8 +70,13 @@ void def_read_mesh(py::module& m, const char *_name) {
if
(
_color_alpha
)
options
+=
OM
::
IO
::
Options
::
ColorAlpha
;
if
(
_color_float
)
options
+=
OM
::
IO
::
Options
::
ColorFloat
;
OM
::
IO
::
read_mesh
(
mesh
,
_filename
,
options
);
const
bool
ok
=
OM
::
IO
::
read_mesh
(
mesh
,
_filename
,
options
);
if
(
!
ok
)
{
const
std
::
string
msg
=
"File could not be read: "
+
_filename
;
PyErr_SetString
(
PyExc_RuntimeError
,
msg
.
c_str
());
throw
py
::
error_already_set
();
}
if
(
_vertex_normal
&&
!
options
.
vertex_has_normal
())
{
PyErr_SetString
(
PyExc_RuntimeError
,
"Vertex normals could not be read."
);
throw
py
::
error_already_set
();
...
...
tests/test_read_write_obj.py
View file @
033e7b5e
...
...
@@ -135,6 +135,12 @@ class ReadWriteOBJ(unittest.TestCase):
self
.
mesh
.
release_vertex_colors
()
def
test_read_nonexistent_obj
(
self
):
with
self
.
assertRaises
(
RuntimeError
):
self
.
mesh
=
openmesh
.
read_trimesh
(
"TestFiles/nonexistent.obj"
)
with
self
.
assertRaises
(
RuntimeError
):
self
.
mesh
=
openmesh
.
read_polymesh
(
"TestFiles/nonexistent.obj"
)
if
__name__
==
'__main__'
:
suite
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
ReadWriteOBJ
)
...
...
tests/test_read_write_off.py
View file @
033e7b5e
...
...
@@ -133,6 +133,12 @@ class ReadWriteOFF(unittest.TestCase):
self
.
mesh
.
release_vertex_colors
()
def
test_read_nonexistent_off
(
self
):
with
self
.
assertRaises
(
RuntimeError
):
self
.
mesh
=
openmesh
.
read_trimesh
(
"TestFiles/nonexistent.off"
)
with
self
.
assertRaises
(
RuntimeError
):
self
.
mesh
=
openmesh
.
read_polymesh
(
"TestFiles/nonexistent.off"
)
if
__name__
==
'__main__'
:
suite
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
ReadWriteOFF
)
...
...
tests/test_read_write_om.py
View file @
033e7b5e
...
...
@@ -158,6 +158,12 @@ class ReadWriteOM(unittest.TestCase):
# TODO property tests
def
test_read_nonexistent_om
(
self
):
with
self
.
assertRaises
(
RuntimeError
):
self
.
mesh
=
openmesh
.
read_trimesh
(
"TestFiles/nonexistent.om"
)
with
self
.
assertRaises
(
RuntimeError
):
self
.
mesh
=
openmesh
.
read_polymesh
(
"TestFiles/nonexistent.om"
)
if
__name__
==
'__main__'
:
suite
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
ReadWriteOM
)
...
...
tests/test_read_write_ply.py
View file @
033e7b5e
...
...
@@ -249,6 +249,12 @@ class ReadWritePLY(unittest.TestCase):
self
.
mesh
.
release_vertex_normals
()
def
test_read_nonexistent_ply
(
self
):
with
self
.
assertRaises
(
RuntimeError
):
self
.
mesh
=
openmesh
.
read_trimesh
(
"TestFiles/nonexistent.ply"
)
with
self
.
assertRaises
(
RuntimeError
):
self
.
mesh
=
openmesh
.
read_polymesh
(
"TestFiles/nonexistent.ply"
)
if
__name__
==
'__main__'
:
suite
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
ReadWritePLY
)
...
...
tests/test_read_write_stl.py
View file @
033e7b5e
...
...
@@ -44,6 +44,12 @@ class ReadWriteSTL(unittest.TestCase):
self
.
mesh
.
release_face_normals
()
def
test_read_nonexistent_stl
(
self
):
with
self
.
assertRaises
(
RuntimeError
):
self
.
mesh
=
openmesh
.
read_trimesh
(
"TestFiles/nonexistent.stl"
)
with
self
.
assertRaises
(
RuntimeError
):
self
.
mesh
=
openmesh
.
read_polymesh
(
"TestFiles/nonexistent.stl"
)
if
__name__
==
'__main__'
:
suite
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
ReadWriteSTL
)
...
...
Alexander Dielen
@adielen
mentioned in issue
#14 (closed)
·
Mar 26, 2018
mentioned in issue
#14 (closed)
mentioned in issue #14
Toggle commit list
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