summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtessellator
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtessellator')
-rw-r--r--tests/auto/qtessellator/dataparser.cpp8
-rw-r--r--tests/auto/qtessellator/oldtessellator.cpp19
-rw-r--r--tests/auto/qtessellator/testtessellator.cpp4
3 files changed, 13 insertions, 18 deletions
diff --git a/tests/auto/qtessellator/dataparser.cpp b/tests/auto/qtessellator/dataparser.cpp
index bd17ee2835..d6566cb2f9 100644
--- a/tests/auto/qtessellator/dataparser.cpp
+++ b/tests/auto/qtessellator/dataparser.cpp
@@ -98,8 +98,12 @@ static QList<QPointF> parsePoints(const QByteArray &line)
QList<qreal> nums = parseNumbersList(it);
QList<qreal>::const_iterator nitr;
for (nitr = nums.begin(); nitr != nums.end(); ++nitr) {
- qreal x = *nitr; ++nitr;
- Q_ASSERT(nitr != nums.end());
+ qreal x = *nitr;
+ ++nitr;
+ if (nitr == nums.end()) {
+ qWarning() << "parsePoints: Even number of co-ordinates required, odd number found: skipping last point";
+ break;
+ }
qreal y = *nitr;
res.append(QPointF(x, y));
}
diff --git a/tests/auto/qtessellator/oldtessellator.cpp b/tests/auto/qtessellator/oldtessellator.cpp
index 78f117f3e3..bc24d7e69e 100644
--- a/tests/auto/qtessellator/oldtessellator.cpp
+++ b/tests/auto/qtessellator/oldtessellator.cpp
@@ -80,19 +80,6 @@ struct QEdge {
horizontal = p1.y == p2.y;
}
- inline qreal xAt(const qreal &y) const
- {
- Q_ASSERT(p1.y != p2.y);
- XFixed yf = XDoubleToFixed(y);
-
- if (yf == p1.y)
- return XFixedToDouble(p1.x);
- else if (yf == p2.y)
- return XFixedToDouble(p2.x);
-
- return (!vertical) ? (((y - b)*im)) : pf1.x();
- }
-
QPointF pf1, pf2;
XPointFixed p1, p2;
qreal m;
@@ -218,7 +205,8 @@ void old_tesselate_polygon(QVector<XTrapezoid> *traps, const QPointF *pg, int pg
qreal ymax(INT_MIN/256);
//painter.begin(pg, pgSize);
- Q_ASSERT(pg[0] == pg[pgSize-1]);
+ if (pg[0] != pg[pgSize-1])
+ qWarning() << Q_FUNC_INFO << "Malformed polygon (first and last points must be identical)";
// generate edge table
// qDebug() << "POINTS:";
for (int x = 0; x < pgSize-1; ++x) {
@@ -383,7 +371,8 @@ void old_tesselate_polygon(QVector<XTrapezoid> *traps, const QPointF *pg, int pg
isects[i].edge = edge;
}
- Q_ASSERT(isects.size()%2 == 1);
+ if (isects.size()%2 != 1)
+ qFatal("%s: number of intersection points must be odd", Q_FUNC_INFO);
// sort intersection points
qSort(&isects[0], &isects[isects.size()-1], compareIntersections);
diff --git a/tests/auto/qtessellator/testtessellator.cpp b/tests/auto/qtessellator/testtessellator.cpp
index 339f05ff16..d8d6f6f5af 100644
--- a/tests/auto/qtessellator/testtessellator.cpp
+++ b/tests/auto/qtessellator/testtessellator.cpp
@@ -42,6 +42,7 @@
#include <private/qtessellator_p.h>
#include "math.h"
+#include <QtCore/QDebug>
class TestTessellator : public QTessellator
{
@@ -91,7 +92,8 @@ void test_tessellate_polygon_rect(QVector<XTrapezoid> *traps, const QPointF *poi
bool winding)
{
// 5 points per rect
- Q_ASSERT(nPoints % 5 == 0);
+ if (nPoints % 5 != 0)
+ qWarning() << Q_FUNC_INFO << "multiples of 5 points expected";
TestTessellator t;
t.traps = traps;