summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtessellator
diff options
context:
space:
mode:
authorJyri Tahtela <jyri.tahtela@nokia.com>2011-05-18 07:41:09 (GMT)
committerJyri Tahtela <jyri.tahtela@nokia.com>2011-05-18 07:41:09 (GMT)
commit9cacde74f7de702689725882633073e60c0a2baa (patch)
tree330d22dadbd28b14a7d8896823d1c33597e9993e /tests/auto/qtessellator
parent006c8e22075112eff6230d8168d716e44a9e29d5 (diff)
parent2c07b5d2cba8d8e499bd0861eefef12d4e00d99a (diff)
downloadQt-9cacde74f7de702689725882633073e60c0a2baa.zip
Qt-9cacde74f7de702689725882633073e60c0a2baa.tar.gz
Qt-9cacde74f7de702689725882633073e60c0a2baa.tar.bz2
Merge remote-tracking branch 'qt/4.8'
Conflicts: doc/src/examples/wheel.qdoc src/gui/util/qflickgesture.cpp src/gui/util/qflickgesture_p.h src/gui/util/qscroller.cpp src/gui/util/qscroller.h src/gui/util/qscroller_p.h src/gui/util/qscrollerproperties.cpp src/gui/util/qscrollerproperties.h tests/auto/qscroller/tst_qscroller.cpp
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 772f925..8ad7ae8 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 7a76900..fd39d20 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 be003b6..c2af1ae 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;