Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkInteractionEventTest.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3  The Medical Imaging Interaction Toolkit (MITK)
4 
5  Copyright (c) German Cancer Research Center,
6  Division of Medical and Biological Informatics.
7  All rights reserved.
8 
9  This software is distributed WITHOUT ANY WARRANTY; without
10  even the implied warranty of MERCHANTABILITY or FITNESS FOR
11  A PARTICULAR PURPOSE.
12 
13  See LICENSE.txt or http://www.mitk.org for details.
14 
15  ===================================================================*/
16 
18 #include "mitkMouseMoveEvent.h"
19 #include "mitkMousePressEvent.h"
20 #include "mitkMouseReleaseEvent.h"
21 #include "mitkTestingMacros.h"
22 #include "mitkVtkPropRenderer.h"
23 
24 int mitkInteractionEventTest(int /*argc*/, char * /*argv*/ [])
25 {
26  /*
27  * Create different Events, fill them with data.
28  * And check if isEqual method is implemented properly.
29  */
30  MITK_TEST_BEGIN("InteractionEvent")
31 
32  mitk::VtkPropRenderer::Pointer renderer = NULL;
33 
38 
39  mitk::Point2D point;
40  point[0] = 17;
41  point[1] = 170;
42 
43  mitk::Point3D worldPos;
44  worldPos[0] = 0.5;
45  worldPos[1] = 10.609;
46  worldPos[2] = 5.0;
47 
48  // MousePress Events
50  mitk::MousePressEvent::New(renderer, point, buttonStates, modifiers, eventButton);
52  mitk::MousePressEvent::New(renderer, point, buttonStates, modifiers, eventButton);
53  point[0] = 178;
54  point[1] = 170;
56  mitk::MousePressEvent::New(renderer, point, buttonStates, modifiers, eventButton);
59  mitk::MousePressEvent::New(renderer, point, buttonStates, modifiers, eventButton);
60 
61  MITK_TEST_CONDITION_REQUIRED(*me1 == *me2 && *me1 == *me3 && *me2 == *me3 && *me3 != *me4,
62  "Checking isEqual and Constructors of mitk::InteractionEvent, mitk::MousePressEvent");
63 
64  // MouseReleaseEvents
66  mitk::MouseReleaseEvent::New(renderer, point, buttonStates, modifiers, eventButton);
68  mitk::MouseReleaseEvent::New(renderer, point, buttonStates, modifiers, eventButton);
69  point[0] = 178;
70  point[1] = 170;
72  mitk::MouseReleaseEvent::New(renderer, point, buttonStates, modifiers, eventButton);
75  mitk::MouseReleaseEvent::New(renderer, point, buttonStates, modifiers, eventButton);
76 
77  MITK_TEST_CONDITION_REQUIRED(*mr1 == *mr2 && *mr1 == *mr3 && *mr2 == *mr3 && *mr3 != *mr4,
78  "Checking isEqual and Constructors of mitk::InteractionEvent, mitk::MouseReleaseEvent");
79 
80  // MouseMoveEvents
81  mitk::MouseMoveEvent::Pointer mm1 = mitk::MouseMoveEvent::New(renderer, point, buttonStates, modifiers);
82  point[0] = 178;
83  point[1] = 170;
84  mitk::MouseMoveEvent::Pointer mm3 = mitk::MouseMoveEvent::New(renderer, point, buttonStates, modifiers);
86  mitk::MouseMoveEvent::Pointer mm4 = mitk::MouseMoveEvent::New(renderer, point, buttonStates, modifiers);
87 
88  MITK_TEST_CONDITION_REQUIRED(*mm1 == *mm3 && *mm3 != *mm4,
89  "Checking isEqual and Constructors of mitk::InteractionEvent, mitk::MouseMoveEvent");
90 
91  // always end with this!
93 }
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG)
section GeneralTestsDeprecatedOldTestingStyle Deprecated macros All tests with MITK_TEST_BEGIN()
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd)
static Pointer New(BaseRenderer *_arga, const Point2D &_argb, MouseButtons _argc, ModifierKeys _argd, MouseButtons _arge)
int mitkInteractionEventTest(int, char *[])
and MITK_TEST_END()