Add a vertex to the contour and see if size changed
| 14 | |
| 15 | // Add a vertex to the contour and see if size changed |
| 16 | static void TestAddVertex() |
| 17 | { |
| 18 | mitk::ContourModel::Pointer contour = mitk::ContourModel::New(); |
| 19 | |
| 20 | mitk::Point3D p; |
| 21 | p[0] = p[1] = p[2] = 0; |
| 22 | |
| 23 | contour->AddVertex(p); |
| 24 | |
| 25 | MITK_TEST_CONDITION(contour->GetNumberOfVertices() == 1, "Add a Vertex, size increased"); |
| 26 | MITK_TEST_CONDITION(contour->GetVertexAt(0)->Coordinates == p, "Added vertex has the correct value."); |
| 27 | |
| 28 | mitk::Point3D outOfTimeBoundPoint; |
| 29 | outOfTimeBoundPoint[0] = outOfTimeBoundPoint[1] = outOfTimeBoundPoint[2] = 1; |
| 30 | |
| 31 | contour->AddVertex(outOfTimeBoundPoint, mitk::TimeStepType(1)); |
| 32 | |
| 33 | MITK_TEST_CONDITION(contour->GetTimeSteps() == 1, "Add a vertex to an unsupported time step has not changed geometry."); |
| 34 | MITK_TEST_CONDITION(contour->IsEmptyTimeStep(1), "Add a vertex to an unsupported time step has not added an contour element."); |
| 35 | MITK_TEST_CONDITION(contour->GetNumberOfVertices(1) == -1, "Add a vertex to an unsupported time step has not added an contour element."); |
| 36 | |
| 37 | contour->Expand(3); |
| 38 | |
| 39 | mitk::Point3D p2; |
| 40 | p2[0] = p2[1] = p2[2] = 2; |
| 41 | mitk::Point3D p3; |
| 42 | p3[0] = p3[1] = p3[2] = 3; |
| 43 | |
| 44 | contour->AddVertex(p2, mitk::TimeStepType(1)); |
| 45 | contour->AddVertex(mitk::ContourModel::VertexType(p3), mitk::TimeStepType(1)); |
| 46 | |
| 47 | MITK_TEST_CONDITION(!contour->IsEmptyTimeStep(1), "Add a vertex to an unsupported time step has not added an contour element."); |
| 48 | MITK_TEST_CONDITION(contour->GetVertexAt(0,1)->Coordinates == p2, "Add a vertex to the 2nd time step (as Point)."); |
| 49 | MITK_TEST_CONDITION(contour->GetVertexAt(1,1)->Coordinates == p3, "Add a vertex to the 2nd time step via overload (as vertex type)."); |
| 50 | MITK_TEST_CONDITION(contour->GetNumberOfVertices(1) == 2, "Add a vertex to an unsupported time step has not added an contour element."); |
| 51 | } |
| 52 | |
| 53 | // Select a vertex by index. successful if the selected vertex member of the contour is no longer set to null |
| 54 | static void TestSelectVertexAtIndex() |
no test coverage detected