Developer Documentation
Loading...
Searching...
No Matches
unittests_set_positions_directly.cc
1#include <gtest/gtest.h>
2#include <Unittests/unittests_common.hh>
3#include <iostream>
4
5namespace {
6
7class OpenMeshDirectSettingProperties : public OpenMeshBase {
8
9 protected:
10
11 // This function is called before each test is run
12 virtual void SetUp() {
13
14 // Do some initial stuff with the member data here...
15 }
16
17 // This function is called after all tests are through
18 virtual void TearDown() {
19
20 // Do some final stuff with the member data here...
21 }
22
23 // Member already defined in OpenMeshBase
24 //Mesh mesh_;
25};
26
27/*
28 * ====================================================================
29 * Define tests below
30 * ====================================================================
31 */
32
33/* Adds two triangles to a tri mesh
34 */
35TEST_F(OpenMeshDirectSettingProperties, SetVertexPositionsDirectly) {
36
37 mesh_.clear();
38
39 // Add some vertices
40 Mesh::VertexHandle vhandle[4];
41
42 vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 0, 0));
43 vhandle[1] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
44 vhandle[2] = mesh_.add_vertex(Mesh::Point(1, 1, 0));
45 vhandle[3] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
46
47
48 auto pos_pro = mesh_.points_property_handle();
49
50 auto point_vector = mesh_.property(pos_pro).data_vector();
51
52 auto vertex_count = point_vector.size();
53
54 EXPECT_EQ(4u, mesh_.n_vertices() ) << "Wrong number of vertices";
55
56 EXPECT_EQ(4u, vertex_count) << "Wrong number of vertices when counting direct point property vector";
57
58
59}
60
61}
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition PolyMeshT.hh:136
SmartVertexHandle add_vertex(const Point _p)
Definition PolyMeshT.hh:255
Kernel::Point Point
Coordinate type.
Definition PolyMeshT.hh:112