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 NO_RESET = false;
00027 const bool DEBUG_FLAG = false;
00028 const QStringList NO_LOAD_STARTUP_FILES;
00029
00030 initializeLogging ("engauge_test",
00031 "engauge_test.log",
00032 DEBUG_FLAG);
00033
00034 MainWindow w (NO_ERROR_REPORT_LOG_FILE,
00035 NO_REGRESSION_OPEN_FILE,
00036 NO_GNUPLOT_LOG_FILES,
00037 NO_RESET,
00038 NO_REGRESSION_IMPORT,
00039 NO_LOAD_STARTUP_FILES);
00040 w.show ();
00041 }
00042
00043 void TestGraphCoords::testAnyColumnsRepeatNo ()
00044 {
00045 CoordPairVector vector;
00046
00047 vector.push_back (QPointF (100, 100));
00048 vector.push_back (QPointF (300, 100));
00049 vector.push_back (QPointF (200, 200));
00050
00051 QVERIFY (!m_callback->anyPointsRepeatPair (vector));
00052 }
00053
00054 void TestGraphCoords::testAnyColumnsRepeatYes ()
00055 {
00056 CoordPairVector vector;
00057
00058
00059 vector.push_back (QPointF (100, 100));
00060 vector.push_back (QPointF (100, 100));
00061 vector.push_back (QPointF (200, 200));
00062
00063 QVERIFY (m_callback->anyPointsRepeatPair (vector));
00064 }
00065
00066 void TestGraphCoords::testThreeCollinearPointsNo ()
00067 {
00068
00069 QTransform m (100, 300, 200,
00070 100, 150, 200,
00071 1 , 1 , 1 );
00072
00073 QVERIFY (!m_callback->threePointsAreCollinear (m));
00074 }
00075
00076 void TestGraphCoords::testThreeCollinearPointsYes ()
00077 {
00078
00079 QTransform m (100, 150, 200,
00080 100, 150, 200,
00081 1 , 1 , 1 );
00082
00083 QVERIFY (m_callback->threePointsAreCollinear (m));
00084 }