Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
openmesh-python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenMesh
openmesh-python
Commits
ee0b852e
There was a problem fetching the pipeline summary.
Commit
ee0b852e
authored
7 years ago
by
Alexander Dielen
Browse files
Options
Downloads
Patches
Plain Diff
added more property tests
parent
177240cf
No related branches found
No related tags found
No related merge requests found
Pipeline
#
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
tests/test_property.py
+46
-1
46 additions, 1 deletion
tests/test_property.py
tests/test_property_array.py
+40
-0
40 additions, 0 deletions
tests/test_property_array.py
tests/test_property_list.py
+67
-0
67 additions, 0 deletions
tests/test_property_list.py
with
153 additions
and
1 deletion
tests/test_property.py
+
46
−
1
View file @
ee0b852e
...
...
@@ -284,6 +284,51 @@ class Property(unittest.TestCase):
self
.
assertEqual
(
self
.
mesh
.
vertex_property
(
"
intProp
"
,
next
(
v_it
)),
2
)
self
.
assertEqual
(
self
.
mesh
.
vertex_property
(
"
intProp
"
,
next
(
v_it
)),
2
)
def
test_add_remove_property
(
self
):
self
.
assertFalse
(
self
.
mesh
.
has_vertex_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_halfedge_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_edge_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_face_property
(
'
test
'
))
self
.
mesh
.
vertex_property
(
'
test
'
)
# adds the prop implicitly
self
.
assertTrue
(
self
.
mesh
.
has_vertex_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_halfedge_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_edge_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_face_property
(
'
test
'
))
self
.
mesh
.
halfedge_property
(
'
test
'
)
# adds the prop implicitly
self
.
assertTrue
(
self
.
mesh
.
has_vertex_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_halfedge_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_edge_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_face_property
(
'
test
'
))
self
.
mesh
.
edge_property
(
'
test
'
)
# adds the prop implicitly
self
.
assertTrue
(
self
.
mesh
.
has_vertex_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_halfedge_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_edge_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_face_property
(
'
test
'
))
self
.
mesh
.
face_property
(
'
test
'
)
# adds the prop implicitly
self
.
assertTrue
(
self
.
mesh
.
has_vertex_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_halfedge_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_edge_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_face_property
(
'
test
'
))
self
.
mesh
.
remove_vertex_property
(
'
test
'
)
self
.
assertFalse
(
self
.
mesh
.
has_vertex_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_halfedge_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_edge_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_face_property
(
'
test
'
))
self
.
mesh
.
remove_halfedge_property
(
'
test
'
)
self
.
assertFalse
(
self
.
mesh
.
has_vertex_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_halfedge_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_edge_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_face_property
(
'
test
'
))
self
.
mesh
.
remove_edge_property
(
'
test
'
)
self
.
assertFalse
(
self
.
mesh
.
has_vertex_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_halfedge_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_edge_property
(
'
test
'
))
self
.
assertTrue
(
self
.
mesh
.
has_face_property
(
'
test
'
))
self
.
mesh
.
remove_face_property
(
'
test
'
)
self
.
assertFalse
(
self
.
mesh
.
has_vertex_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_halfedge_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_edge_property
(
'
test
'
))
self
.
assertFalse
(
self
.
mesh
.
has_face_property
(
'
test
'
))
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
tests/test_property_array.py
+
40
−
0
View file @
ee0b852e
...
...
@@ -10,6 +10,7 @@ class Python(unittest.TestCase):
openmesh
.
read_mesh
(
self
.
mesh
,
'
TestFiles/cube-minimal.obj
'
)
def
test_vertex_property_array
(
self
):
self
.
assertFalse
(
self
.
mesh
.
has_vertex_property
(
'
random
'
))
# c_contiguous
arr1
=
np
.
random
.
rand
(
self
.
mesh
.
n_vertices
(),
10
)
self
.
mesh
.
set_vertex_property_array
(
'
random
'
,
arr1
)
...
...
@@ -26,8 +27,18 @@ class Python(unittest.TestCase):
for
vh
in
self
.
mesh
.
vertices
():
arr3
=
self
.
mesh
.
vertex_property
(
'
random
'
,
vh
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
[
vh
.
idx
()],
arr3
))
# single columns
arr1
=
np
.
random
.
rand
(
10
,
self
.
mesh
.
n_vertices
())
for
vh
in
self
.
mesh
.
vertices
():
self
.
mesh
.
set_vertex_property
(
'
random
'
,
vh
,
arr1
[:,
vh
.
idx
()])
arr2
=
self
.
mesh
.
vertex_property_array
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
,
arr2
))
for
vh
in
self
.
mesh
.
vertices
():
arr3
=
self
.
mesh
.
vertex_property
(
'
random
'
,
vh
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
[
vh
.
idx
()],
arr3
))
def
test_halfedge_property_array
(
self
):
self
.
assertFalse
(
self
.
mesh
.
has_halfedge_property
(
'
random
'
))
# c_contiguous
arr1
=
np
.
random
.
rand
(
self
.
mesh
.
n_halfedges
(),
10
)
self
.
mesh
.
set_halfedge_property_array
(
'
random
'
,
arr1
)
...
...
@@ -44,8 +55,18 @@ class Python(unittest.TestCase):
for
hh
in
self
.
mesh
.
halfedges
():
arr3
=
self
.
mesh
.
halfedge_property
(
'
random
'
,
hh
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
[
hh
.
idx
()],
arr3
))
# single columns
arr1
=
np
.
random
.
rand
(
10
,
self
.
mesh
.
n_halfedges
())
for
hh
in
self
.
mesh
.
halfedges
():
self
.
mesh
.
set_halfedge_property
(
'
random
'
,
hh
,
arr1
[:,
hh
.
idx
()])
arr2
=
self
.
mesh
.
halfedge_property_array
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
,
arr2
))
for
hh
in
self
.
mesh
.
halfedges
():
arr3
=
self
.
mesh
.
halfedge_property
(
'
random
'
,
hh
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
[
hh
.
idx
()],
arr3
))
def
test_edge_property_array
(
self
):
self
.
assertFalse
(
self
.
mesh
.
has_edge_property
(
'
random
'
))
# c_contiguous
arr1
=
np
.
random
.
rand
(
self
.
mesh
.
n_edges
(),
10
)
self
.
mesh
.
set_edge_property_array
(
'
random
'
,
arr1
)
...
...
@@ -62,8 +83,18 @@ class Python(unittest.TestCase):
for
eh
in
self
.
mesh
.
edges
():
arr3
=
self
.
mesh
.
edge_property
(
'
random
'
,
eh
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
[
eh
.
idx
()],
arr3
))
# single columns
arr1
=
np
.
random
.
rand
(
10
,
self
.
mesh
.
n_edges
())
for
eh
in
self
.
mesh
.
edges
():
self
.
mesh
.
set_edge_property
(
'
random
'
,
eh
,
arr1
[:,
eh
.
idx
()])
arr2
=
self
.
mesh
.
edge_property_array
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
,
arr2
))
for
eh
in
self
.
mesh
.
edges
():
arr3
=
self
.
mesh
.
edge_property
(
'
random
'
,
eh
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
[
eh
.
idx
()],
arr3
))
def
test_face_property_array
(
self
):
self
.
assertFalse
(
self
.
mesh
.
has_face_property
(
'
random
'
))
# c_contiguous
arr1
=
np
.
random
.
rand
(
self
.
mesh
.
n_faces
(),
10
)
self
.
mesh
.
set_face_property_array
(
'
random
'
,
arr1
)
...
...
@@ -80,6 +111,15 @@ class Python(unittest.TestCase):
for
fh
in
self
.
mesh
.
faces
():
arr3
=
self
.
mesh
.
face_property
(
'
random
'
,
fh
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
[
fh
.
idx
()],
arr3
))
# single columns
arr1
=
np
.
random
.
rand
(
10
,
self
.
mesh
.
n_faces
())
for
fh
in
self
.
mesh
.
faces
():
self
.
mesh
.
set_face_property
(
'
random
'
,
fh
,
arr1
[:,
fh
.
idx
()])
arr2
=
self
.
mesh
.
face_property_array
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
,
arr2
))
for
fh
in
self
.
mesh
.
faces
():
arr3
=
self
.
mesh
.
face_property
(
'
random
'
,
fh
)
self
.
assertTrue
(
np
.
allclose
(
arr1
.
T
[
fh
.
idx
()],
arr3
))
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
tests/test_property_list.py
0 → 100644
+
67
−
0
View file @
ee0b852e
import
unittest
import
openmesh
import
numpy
as
np
class
Python
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
mesh
=
openmesh
.
TriMesh
()
openmesh
.
read_mesh
(
self
.
mesh
,
'
TestFiles/cube-minimal.obj
'
)
def
test_vertex_property_list
(
self
):
self
.
assertFalse
(
self
.
mesh
.
has_vertex_property
(
'
random
'
))
res
=
self
.
mesh
.
vertex_property
(
'
random
'
)
self
.
assertTrue
(
all
(
val
is
None
for
val
in
res
))
rnd
=
[
np
.
random
.
rand
(
10
)
for
h
in
self
.
mesh
.
vertices
()]
self
.
mesh
.
set_vertex_property
(
'
random
'
,
rnd
)
res
=
self
.
mesh
.
vertex_property
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
np
.
stack
(
rnd
),
np
.
stack
(
res
)))
for
i
in
range
(
self
.
mesh
.
n_vertices
()):
rnd
[
i
][:]
=
np
.
random
.
rand
(
10
)
res
=
self
.
mesh
.
vertex_property
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
np
.
stack
(
rnd
),
np
.
stack
(
res
)))
def
test_halfedge_property_list
(
self
):
self
.
assertFalse
(
self
.
mesh
.
has_halfedge_property
(
'
random
'
))
res
=
self
.
mesh
.
halfedge_property
(
'
random
'
)
self
.
assertTrue
(
all
(
val
is
None
for
val
in
res
))
rnd
=
[
np
.
random
.
rand
(
10
)
for
h
in
self
.
mesh
.
halfedges
()]
self
.
mesh
.
set_halfedge_property
(
'
random
'
,
rnd
)
res
=
self
.
mesh
.
halfedge_property
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
np
.
stack
(
rnd
),
np
.
stack
(
res
)))
for
i
in
range
(
self
.
mesh
.
n_halfedges
()):
rnd
[
i
][:]
=
np
.
random
.
rand
(
10
)
res
=
self
.
mesh
.
halfedge_property
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
np
.
stack
(
rnd
),
np
.
stack
(
res
)))
def
test_edge_property_list
(
self
):
self
.
assertFalse
(
self
.
mesh
.
has_edge_property
(
'
random
'
))
res
=
self
.
mesh
.
edge_property
(
'
random
'
)
self
.
assertTrue
(
all
(
val
is
None
for
val
in
res
))
rnd
=
[
np
.
random
.
rand
(
10
)
for
h
in
self
.
mesh
.
edges
()]
self
.
mesh
.
set_edge_property
(
'
random
'
,
rnd
)
res
=
self
.
mesh
.
edge_property
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
np
.
stack
(
rnd
),
np
.
stack
(
res
)))
for
i
in
range
(
self
.
mesh
.
n_edges
()):
rnd
[
i
][:]
=
np
.
random
.
rand
(
10
)
res
=
self
.
mesh
.
edge_property
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
np
.
stack
(
rnd
),
np
.
stack
(
res
)))
def
test_face_property_list
(
self
):
self
.
assertFalse
(
self
.
mesh
.
has_face_property
(
'
random
'
))
res
=
self
.
mesh
.
face_property
(
'
random
'
)
self
.
assertTrue
(
all
(
val
is
None
for
val
in
res
))
rnd
=
[
np
.
random
.
rand
(
10
)
for
h
in
self
.
mesh
.
faces
()]
self
.
mesh
.
set_face_property
(
'
random
'
,
rnd
)
res
=
self
.
mesh
.
face_property
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
np
.
stack
(
rnd
),
np
.
stack
(
res
)))
for
i
in
range
(
self
.
mesh
.
n_faces
()):
rnd
[
i
][:]
=
np
.
random
.
rand
(
10
)
res
=
self
.
mesh
.
face_property
(
'
random
'
)
self
.
assertTrue
(
np
.
allclose
(
np
.
stack
(
rnd
),
np
.
stack
(
res
)))
if
__name__
==
'
__main__
'
:
suite
=
unittest
.
TestLoader
().
loadTestsFromTestCase
(
Python
)
unittest
.
TextTestRunner
(
verbosity
=
2
).
run
(
suite
)
This diff is collapsed.
Click to expand it.
Alexander Dielen
@adielen
mentioned in issue
#8 (closed)
·
7 years ago
mentioned in issue
#8 (closed)
mentioned in issue #8
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment