10#include <QtTest/QtTest>
20void TestCentipedeEndpoints::cleanupTestCase ()
24void TestCentipedeEndpoints::initTestCase ()
34 initTestCaseCommon ();
35 initTestCaseCartesian ();
36 initTestCasePolarLog ();
39void TestCentipedeEndpoints::initTestCaseCartesian ()
47 QPointF posScreen0 = QPointF (m_windowSize.width() / 2,
48 m_windowSize.height() / 2);
49 QPointF posScreen1 = QPointF (m_windowSize.width(),
50 m_windowSize.height() / 2);
51 QPointF posScreen2 = QPointF (m_windowSize.width() / 2,
54 const double RADIUS = 1;
56 DocumentModelGeneral modelGeneral;
57 MainWindowModel mainWindowModel;
58 QTransform matrixScene (posScreen0.x(), posScreen1.x(), posScreen2.x(),
59 posScreen0.y(), posScreen1.y(), posScreen2.y(),
61 QTransform matrixGraph (0, RADIUS, 0,
64 m_transformationCartesian.updateTransformFromMatrices (matrixScene,
66 m_transformationCartesian.setModelCoords (m_modelCoordsPolarLog,
71void TestCentipedeEndpoints::initTestCaseCommon ()
74 m_windowSize = QSize (200, 200);
75 QPointF center (m_windowSize.width () / 2,
76 m_windowSize.height () / 2);
77 m_posClickScreen = QPointF (center.x() + m_windowSize.width() / 4,
78 center.y() - m_windowSize.height() / 4);
81void TestCentipedeEndpoints::initTestCasePolarLog ()
89 QPointF posScreen0 = QPointF (m_windowSize.width() / 2,
90 m_windowSize.height() / 2);
91 QPointF posScreen1 = QPointF (m_windowSize.width(),
92 m_windowSize.height() / 2);
93 QPointF posScreen2 = QPointF (m_windowSize.width() / 2,
96 const double LOG_RADIUS_MIN = 1;
97 const double LOG_RADIUS_MAX = 100;
100 m_modelCoordsPolarLog.setOriginRadius (LOG_RADIUS_MIN);
101 DocumentModelGeneral modelGeneral;
102 MainWindowModel mainWindowModel;
103 QTransform matrixScene (posScreen0.x(), posScreen1.x(), posScreen2.x(),
104 posScreen0.y(), posScreen1.y(), posScreen2.y(),
106 QTransform matrixGraph ( 0, 90, 0,
107 LOG_RADIUS_MIN, LOG_RADIUS_MAX, LOG_RADIUS_MAX,
109 m_transformationPolarLog.updateTransformFromMatrices (matrixScene,
111 m_transformationPolarLog.setModelCoords (m_modelCoordsPolarLog,
116void TestCentipedeEndpoints::testCartesianXPosition ()
120 DocumentModelGuideline modelGuideline;
122 CentipedeEndpointsCartesian endpoints (modelGuideline,
123 m_transformationCartesian,
133void TestCentipedeEndpoints::testCartesianYPosition ()
137 DocumentModelGuideline modelGuideline;
139 CentipedeEndpointsCartesian endpoints (modelGuideline,
140 m_transformationCartesian,
150void TestCentipedeEndpoints::testPolarRPosition ()
154 DocumentModelGuideline modelGuideline;
156 QPointF posOriginScreen (100, 100);
157 CentipedeEndpointsPolar endpoints (m_modelCoordsPolarLog,
159 m_transformationPolarLog,
163 QPointF posLow, posHigh;
172void TestCentipedeEndpoints::testPolarTPosition ()
176 DocumentModelGuideline modelGuideline;
178 QPointF posOriginScreen (100, 100);
179 CentipedeEndpointsPolar endpoints (m_modelCoordsPolarLog,
181 m_transformationPolarLog,
void initializeLogging(const QString &name, const QString &filename, bool isDebug)
double creationCircleRadius() const
Get method for creation circle radius in pixels.
Unit tests of centipede endpoints.
TestCentipedeEndpoints(QObject *parent=0)
Single constructor.
double magnitude(const QPointF &vec)
Norm of vector.