Engauge Digitizer 2
Loading...
Searching...
No Matches
TestGraphCoords.cpp
1#include "CallbackUpdateTransform.h"
2#include "Logger.h"
3#include "MainWindow.h"
4#include <QtTest/QtTest>
5#include "Test/TestGraphCoords.h"
6
7QTEST_MAIN (TestGraphCoords)
8
10 QObject(parent)
11{
12 m_callback = new CallbackUpdateTransform (m_modelCoords,
13 DOCUMENT_AXES_POINTS_REQUIRED_3);
14}
15
16void TestGraphCoords::cleanupTestCase ()
17{
18}
19
20void TestGraphCoords::initTestCase ()
21{
22 const QString NO_ERROR_REPORT_LOG_FILE;
23 const QString NO_REGRESSION_OPEN_FILE;
24 const bool NO_GNUPLOT_LOG_FILES = false;
25 const bool NO_REGRESSION_IMPORT = false;
26 const bool DEBUG_FLAG = false;
27 const QStringList NO_LOAD_STARTUP_FILES;
28
29 initializeLogging ("engauge_test",
30 "engauge_test.log",
31 DEBUG_FLAG);
32
33 MainWindow w (NO_ERROR_REPORT_LOG_FILE,
34 NO_REGRESSION_OPEN_FILE,
35 NO_GNUPLOT_LOG_FILES,
36 NO_REGRESSION_IMPORT,
37 NO_LOAD_STARTUP_FILES);
38 w.show ();
39}
40
41void TestGraphCoords::testAnyColumnsRepeatNo ()
42{
43 CoordPairVector vector;
44
45 vector.push_back (QPointF (100, 100));
46 vector.push_back (QPointF (300, 100));
47 vector.push_back (QPointF (200, 200));
48
49 QVERIFY (!m_callback->anyPointsRepeatPair (vector));
50}
51
52void TestGraphCoords::testAnyColumnsRepeatYes ()
53{
54 CoordPairVector vector;
55
56 // First two points repeat
57 vector.push_back (QPointF (100, 100));
58 vector.push_back (QPointF (100, 100));
59 vector.push_back (QPointF (200, 200));
60
61 QVERIFY (m_callback->anyPointsRepeatPair (vector));
62}
63
64void TestGraphCoords::testThreeCollinearPointsNo ()
65{
66 // Points are not collinear
67 QTransform m (100, 300, 200,
68 100, 150, 200,
69 1 , 1 , 1 );
70
71 QVERIFY (!m_callback->threePointsAreCollinear (m));
72}
73
74void TestGraphCoords::testThreeCollinearPointsYes ()
75{
76 // Points are collinear
77 QTransform m (100, 150, 200,
78 100, 150, 200,
79 1 , 1 , 1 );
80
81 QVERIFY (m_callback->threePointsAreCollinear (m));
82}
Callback for collecting axis points and then calculating the current transform from those axis points...
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:78
Unit tests of graph coordinate sanity checking.