8 #include <QtTest/QtTest>
21 void TestGridLineLimiter::cleanupTestCase ()
25 void TestGridLineLimiter::initTestCase ()
32 const bool NO_RESET =
false;
45 NO_REGRESSION_OPEN_FILE,
51 NO_EXTRACT_IMAGE_ONLY,
52 NO_EXTRACT_IMAGE_EXTENSION,
53 NO_LOAD_STARTUP_FILES,
58 void TestGridLineLimiter::testBadStepLinearX ()
60 bool success = testLinearX (0,
70 void TestGridLineLimiter::testBadStepLinearY ()
72 bool success = testLinearY (0,
82 void TestGridLineLimiter::testBadStepLogX ()
84 bool success = testLogX (0,
94 void TestGridLineLimiter::testBadStepLogY ()
96 bool success = testLogY (0,
106 bool TestGridLineLimiter::testLinearX (
double start,
109 double x1,
double y1,
110 double x2,
double y2,
111 double x3,
double y3)
120 double startX, stepX, stopX;
127 document.addPointAxisWithSpecifiedIdentifier (QPointF (0 , 0), QPointF (x1, y1), QString (
"axis1"), 0.0,
false);
128 document.addPointAxisWithSpecifiedIdentifier (QPointF (100, 0), QPointF (x2, y2), QString (
"axis2"), 0.0,
false);
129 document.addPointAxisWithSpecifiedIdentifier (QPointF (0 , 100), QPointF (x3, y3), QString (
"axis3"), 0.0,
false);
144 int gridLineCount = 1 + (stopX - startX) / stepX;
145 success = (gridLineCount <= 20);
149 success = (startX == stopX);
156 bool TestGridLineLimiter::testLinearY (
double start,
159 double x1,
double y1,
160 double x2,
double y2,
161 double x3,
double y3)
170 double startY, stepY, stopY;
177 document.addPointAxisWithSpecifiedIdentifier (QPointF (0 , 0), QPointF (x1, y1), QString (
"axis1"), 0.0,
false);
178 document.addPointAxisWithSpecifiedIdentifier (QPointF (100, 0), QPointF (x2, y2), QString (
"axis2"), 0.0,
false);
179 document.addPointAxisWithSpecifiedIdentifier (QPointF (0 , 100), QPointF (x3, y3), QString (
"axis3"), 0.0,
false);
194 int gridLineCount = 1 + (stopY - startY) / stepY;
195 success = (gridLineCount <= 20);
199 success = (startY == stopY);
206 bool TestGridLineLimiter::testLogX (
double start,
209 double x1,
double y1,
210 double x2,
double y2,
211 double x3,
double y3)
220 double startX, stepX, stopX;
227 document.addPointAxisWithSpecifiedIdentifier (QPointF (0 , 0), QPointF (x1, y1), QString (
"axis1"), 0.0,
false);
228 document.addPointAxisWithSpecifiedIdentifier (QPointF (100, 0), QPointF (x2, y2), QString (
"axis2"), 0.0,
false);
229 document.addPointAxisWithSpecifiedIdentifier (QPointF (0 , 100), QPointF (x3, y3), QString (
"axis3"), 0.0,
false);
240 bool success = (startX > 0) && (stepX > 0);
244 int gridLineCount = 1 + (qLn (stopX) - qLn (startX)) / qLn (stepX);
245 success = (gridLineCount <= 20);
252 bool TestGridLineLimiter::testLogY (
double start,
255 double x1,
double y1,
256 double x2,
double y2,
257 double x3,
double y3)
266 double startY, stepY, stopY;
273 document.addPointAxisWithSpecifiedIdentifier (QPointF (0 , 0), QPointF (x1, y1), QString (
"axis1"), 0.0,
false);
274 document.addPointAxisWithSpecifiedIdentifier (QPointF (100, 0), QPointF (x2, y2), QString (
"axis2"), 0.0,
false);
275 document.addPointAxisWithSpecifiedIdentifier (QPointF (0 , 100), QPointF (x3, y3), QString (
"axis3"), 0.0,
false);
286 bool success = (startY > 0) && (stepY > 0);
290 int gridLineCount = 1 + (qLn (stopY) - qLn (startY)) / qLn (stepY);
291 success = (gridLineCount <= 20);
298 void TestGridLineLimiter::testTransitionLinearToLogX ()
300 bool success = testLogX (0,
310 void TestGridLineLimiter::testTransitionLinearToLogY ()
312 bool success = testLogY (0,
void limitForXTheta(const Document &document, const Transformation &transformation, const DocumentModelCoords &modelCoords, const MainWindowModel &modelMainWindow, const DocumentModelGridDisplay &modelGrid, double &startX, double &stepX, double &stopX) const
Limit step value for x/theta coordinate. This is a noop if the maximum grid line limit in MainWindowM...
void limitForYRadius(const Document &document, const Transformation &transformation, const DocumentModelCoords &modelCoords, const MainWindowModel &modelMainWindow, const DocumentModelGridDisplay &modelGrid, double &startY, double &stepY, double &stopY) const
Limit step value for y/range coordinate. This is a noop if the maximum grid line limit in MainWindowM...
void setStartX(double startX)
Set method for x grid line lower bound (inclusive).
Model for DlgSettingsGridDisplay and CmdSettingsGridDisplay.
void setStepX(double stepX)
Set method for x grid line increment.
const bool NO_GNUPLOT_LOG_FILES
void setCoordScaleYRadius(CoordScale coordScale)
Set method for linear/log scale on y/radius.
void setStepY(double yStep)
Set method for y grid line increment.
const bool NO_REGRESSION_IMPORT
const QString NO_EXTRACT_IMAGE_EXTENSION
void initializeLogging(const QString &name, const QString &filename, bool isDebug)
const QStringList NO_LOAD_STARTUP_FILES
void setStopX(double stopX)
Set method for x grid line upper bound (inclusive).
Model for DlgSettingsMainWindow.
const QString NO_REGRESSION_OPEN_FILE
const bool NO_EXPORT_ONLY
void setStopY(double yStop)
Set method for y grid line upper bound (inclusive).
Model for DlgSettingsCoords and CmdSettingsCoords.
Storage of one imported image and the data attached to that image.
void setMaximumGridLines(int maximumGridLines)
Set method for maximum number of grid lines.
const QStringList NO_COMMAND_LINE
const bool NO_DROP_REGRESSION
void setStartY(double yStart)
Set method for y grid line lower bound (inclusive).
Unit test of GridLineLimiter class.
const QString NO_ERROR_REPORT_LOG_FILE
Limit the number of grid lines so a bad combination of start/step/stop value will not lead to extreme...
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
void setCoordScaleXTheta(CoordScale coordScale)
Set method for linear/log scale on x/theta.
const bool NO_EXTRACT_IMAGE_ONLY