00001 #include "Logger.h"
00002 #include "MainWindow.h"
00003 #include <QtTest/QtTest>
00004 #include "Test/TestZoomTransition.h"
00005 #include "ZoomTransition.h"
00006
00007 QTEST_MAIN (TestZoomTransition)
00008
00009 using namespace std;
00010
00011 const bool FILL_CHECKED = true;
00012 const bool FILL_UNCHECKED = false;
00013 const double M11 = 1.9;
00014 const double M22 = 1.49;
00015
00016 TestZoomTransition::TestZoomTransition(QObject *parent) :
00017 QObject(parent)
00018 {
00019 }
00020
00021 void TestZoomTransition::cleanupTestCase ()
00022 {
00023
00024 }
00025
00026 void TestZoomTransition::initTestCase ()
00027 {
00028 const QString NO_ERROR_REPORT_LOG_FILE;
00029 const QString NO_REGRESSION_OPEN_FILE;
00030 const bool NO_GNUPLOT_LOG_FILES = false;
00031 const bool NO_REGRESSION_IMPORT = false;
00032 const bool NO_RESET = false;
00033 const bool DEBUG_FLAG = false;
00034 const QStringList NO_LOAD_STARTUP_FILES;
00035
00036 initializeLogging ("engauge_test",
00037 "engauge_test.log",
00038 DEBUG_FLAG);
00039
00040 MainWindow w (NO_ERROR_REPORT_LOG_FILE,
00041 NO_REGRESSION_OPEN_FILE,
00042 NO_GNUPLOT_LOG_FILES,
00043 NO_RESET,
00044 NO_REGRESSION_IMPORT,
00045 NO_LOAD_STARTUP_FILES);
00046 w.show ();
00047 }
00048
00049 void TestZoomTransition::testInAtClosestEnum ()
00050 {
00051 ZoomTransition zoomTransition;
00052 ZoomFactor zoomFactorNew = zoomTransition.zoomIn (ZOOM_16_TO_1,
00053 M11,
00054 M22,
00055 FILL_UNCHECKED);
00056
00057
00058 QVERIFY (zoomFactorNew == ZOOM_16_TO_1);
00059 }
00060
00061 void TestZoomTransition::testInBeforeClosestFromEnum ()
00062 {
00063 ZoomTransition zoomTransition;
00064 ZoomFactor zoomFactorNew = zoomTransition.zoomIn (ZOOM_1_TO_1,
00065 M11,
00066 M22,
00067 FILL_UNCHECKED);
00068
00069 QVERIFY (zoomFactorNew == ZOOM_1_TO_1_CLOSER);
00070 }
00071
00072 void TestZoomTransition::testInBeforeClosestFromFill ()
00073 {
00074 ZoomTransition zoomTransition;
00075 ZoomFactor zoomFactorNew = zoomTransition.zoomIn (ZOOM_FILL,
00076 M11,
00077 M22,
00078 FILL_CHECKED);
00079
00080 QVERIFY (zoomFactorNew == ZOOM_2_TO_1);
00081 }
00082
00083 void TestZoomTransition::testOutAtFarthestEnum ()
00084 {
00085 ZoomTransition zoomTransition;
00086 ZoomFactor zoomFactorNew = zoomTransition.zoomOut (ZOOM_1_TO_16,
00087 M11,
00088 M22,
00089 FILL_UNCHECKED);
00090
00091
00092 QVERIFY (zoomFactorNew == ZOOM_1_TO_16);
00093 }
00094
00095 void TestZoomTransition::testOutBeforeFarthestFromEnum ()
00096 {
00097 ZoomTransition zoomTransition;
00098 ZoomFactor zoomFactorNew = zoomTransition.zoomOut (ZOOM_1_TO_1,
00099 M11,
00100 M22,
00101 FILL_UNCHECKED);
00102
00103 QVERIFY (zoomFactorNew == ZOOM_1_TO_1_FARTHER);
00104 }
00105
00106 void TestZoomTransition::testOutBeforeFarthestFromFill ()
00107 {
00108 ZoomTransition zoomTransition;
00109 ZoomFactor zoomFactorNew = zoomTransition.zoomOut (ZOOM_FILL,
00110 M11,
00111 M22,
00112 FILL_CHECKED);
00113
00114 QVERIFY (zoomFactorNew == ZOOM_1_TO_1_CLOSER);
00115 }