00001 #include "CallbackUpdateTransform.h"
00002 #include "Logger.h"
00003 #include "MainWindow.h"
00004 #include <QtTest/QtTest>
00005 #include "Test/TestGraphCoords.h"
00006
00007 QTEST_MAIN (TestGraphCoords)
00008
00009 TestGraphCoords::TestGraphCoords(QObject *parent) :
00010 QObject(parent)
00011 {
00012 m_callback = new CallbackUpdateTransform (m_modelCoords,
00013 DOCUMENT_AXES_POINTS_REQUIRED_3);
00014 }
00015
00016 void TestGraphCoords::cleanupTestCase ()
00017 {
00018 }
00019
00020 void TestGraphCoords::initTestCase ()
00021 {
00022 const QString NO_ERROR_REPORT_LOG_FILE;
00023 const QString NO_REGRESSION_OPEN_FILE;
00024 const bool NO_GNUPLOT_LOG_FILES = false;
00025 const bool NO_REGRESSION_IMPORT = false;
00026 const bool DEBUG_FLAG = false;
00027 const QStringList NO_LOAD_STARTUP_FILES;
00028
00029 initializeLogging ("engauge_test",
00030 "engauge_test.log",
00031 DEBUG_FLAG);
00032
00033 MainWindow w (NO_ERROR_REPORT_LOG_FILE,
00034 NO_REGRESSION_OPEN_FILE,
00035 NO_GNUPLOT_LOG_FILES,
00036 NO_REGRESSION_IMPORT,
00037 NO_LOAD_STARTUP_FILES);
00038 w.show ();
00039 }
00040
00041 void TestGraphCoords::testAnyColumnsRepeatNo ()
00042 {
00043 CoordPairVector vector;
00044
00045 vector.push_back (QPointF (100, 100));
00046 vector.push_back (QPointF (300, 100));
00047 vector.push_back (QPointF (200, 200));
00048
00049 QVERIFY (!m_callback->anyPointsRepeatPair (vector));
00050 }
00051
00052 void TestGraphCoords::testAnyColumnsRepeatYes ()
00053 {
00054 CoordPairVector vector;
00055
00056
00057 vector.push_back (QPointF (100, 100));
00058 vector.push_back (QPointF (100, 100));
00059 vector.push_back (QPointF (200, 200));
00060
00061 QVERIFY (m_callback->anyPointsRepeatPair (vector));
00062 }
00063
00064 void TestGraphCoords::testThreeCollinearPointsNo ()
00065 {
00066
00067 QTransform m (100, 300, 200,
00068 100, 150, 200,
00069 1 , 1 , 1 );
00070
00071 QVERIFY (!m_callback->threePointsAreCollinear (m));
00072 }
00073
00074 void TestGraphCoords::testThreeCollinearPointsYes ()
00075 {
00076
00077 QTransform m (100, 150, 200,
00078 100, 150, 200,
00079 1 , 1 , 1 );
00080
00081 QVERIFY (m_callback->threePointsAreCollinear (m));
00082 }