Engauge Digitizer 2
Loading...
Searching...
No Matches
TestGraphCoords.cpp
Go to the documentation of this file.
3#include "Logger.h"
4#include "MainWindow.h"
5#include <QtTest/QtTest>
7
8QTEST_MAIN (TestGraphCoords)
9
10const double EPSILON = 0.0;
11
13 QObject(parent)
14{
15 m_callback = new CallbackUpdateTransform (m_modelCoords,
17}
18
19void TestGraphCoords::cleanupTestCase ()
20{
21}
22
23void TestGraphCoords::initTestCase ()
24{
25 const bool NO_DROP_REGRESSION = false;
26 const QString NO_ERROR_REPORT_LOG_FILE;
27 const QString NO_REGRESSION_OPEN_FILE;
28 const bool NO_GNUPLOT_LOG_FILES = false;
29 const bool NO_REGRESSION_IMPORT = false;
30 const bool NO_RESET = false;
31 const bool NO_EXPORT_ONLY = false;
32 const bool NO_EXTRACT_IMAGE_ONLY = false;
33 const QString NO_EXTRACT_IMAGE_EXTENSION;
34 const bool DEBUG_FLAG = false;
35 const QStringList NO_LOAD_STARTUP_FILES;
36 const QStringList NO_COMMAND_LINE;
37
38 initializeLogging ("engauge_test",
39 "engauge_test.log",
41
42 MainWindow w (NO_ERROR_REPORT_LOG_FILE,
47 NO_RESET,
53 w.show ();
54}
55
56void TestGraphCoords::testAnyColumnsRepeatNo ()
57{
58 CoordPairVector vector;
59
60 vector.push_back (QPointF (100, 100));
61 vector.push_back (QPointF (300, 100));
62 vector.push_back (QPointF (200, 200));
63
64 QVERIFY (!m_callback->anyPointsRepeatPair (vector,
65 EPSILON));
66}
67
68void TestGraphCoords::testAnyColumnsRepeatYes ()
69{
70 CoordPairVector vector;
71
72 // First two points repeat
73 vector.push_back (QPointF (100, 100));
74 vector.push_back (QPointF (100, 100));
75 vector.push_back (QPointF (200, 200));
76
77 QVERIFY (m_callback->anyPointsRepeatPair (vector,
78 EPSILON));
79}
80
81void TestGraphCoords::testThreeCollinearPointsNo ()
82{
83 // Points are not collinear
84 QTransform m (100, 300, 200,
85 100, 150, 200,
86 1 , 1 , 1 );
87
88 QVERIFY (!m_callback->threePointsAreCollinear (m,
89 CallbackAxisPointsAbstract::LinearOrLog::COORD_IS_LINEAR,
90 CallbackAxisPointsAbstract::LinearOrLog::COORD_IS_LINEAR));
91}
92
93void TestGraphCoords::testThreeCollinearPointsYes ()
94{
95 // Points are collinear
96 QTransform m (100, 150, 200,
97 100, 150, 200,
98 1 , 1 , 1 );
99
100 QVERIFY (m_callback->threePointsAreCollinear (m,
101 CallbackAxisPointsAbstract::LinearOrLog::COORD_IS_LINEAR,
102 CallbackAxisPointsAbstract::LinearOrLog::COORD_IS_LINEAR));
103}
QList< QPointF > CoordPairVector
@ DOCUMENT_AXES_POINTS_REQUIRED_3
const double EPSILON
void initializeLogging(const QString &name, const QString &filename, bool isDebug)
Definition Logger.cpp:21
const bool NO_EXPORT_ONLY
const QStringList NO_COMMAND_LINE
const QString NO_EXTRACT_IMAGE_EXTENSION
const QString NO_ERROR_REPORT_LOG_FILE
const bool NO_GNUPLOT_LOG_FILES
const QString NO_REGRESSION_OPEN_FILE
const QStringList NO_LOAD_STARTUP_FILES
const bool NO_REGRESSION_IMPORT
const bool NO_EXTRACT_IMAGE_ONLY
const bool NO_DROP_REGRESSION
const bool DEBUG_FLAG
Callback for collecting axis points and then calculating the current transform from those axis points...
Unit tests of graph coordinate sanity checking.
TestGraphCoords(QObject *parent=0)
Single constructor.