Skip to content

Commit

Permalink
Condense qgstestutils.h and qgstest.h into a single file
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 4, 2017
1 parent 2286710 commit 700f9b2
Show file tree
Hide file tree
Showing 36 changed files with 36 additions and 97 deletions.
1 change: 0 additions & 1 deletion src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,6 @@ SET(QGIS_CORE_HDRS
qgsstatisticalsummary.h
qgsstringstatisticalsummary.h
qgsstringutils.h
qgstestutils.h
qgstextlabelfeature.h
qgstextrenderer.h
qgstextrenderer_p.h
Expand Down
63 changes: 0 additions & 63 deletions src/core/qgstestutils.h

This file was deleted.

36 changes: 36 additions & 0 deletions src/test/qgstest.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,42 @@
return QTest::qExec(&tc, argc, argv); \
}


#define QGSCOMPARENEAR(value,expected,epsilon) { \
bool _xxxresult = qgsDoubleNear( value, expected, epsilon ); \
if ( !_xxxresult ) \
{ \
qDebug( "Expecting %f got %f (diff %f > %f)", static_cast< double >( expected ), static_cast< double >( value ), std::fabs( static_cast< double >( expected ) - value ), static_cast< double >( epsilon ) ); \
} \
QVERIFY( qgsDoubleNear( value, expected, epsilon ) ); \
}

#define QGSCOMPARENOTNEAR(value,not_expected,epsilon) { \
bool _xxxresult = qgsDoubleNear( value, not_expected, epsilon ); \
if ( _xxxresult ) \
{ \
qDebug( "Expecting %f to be differerent from %f (diff %f > %f)", static_cast< double >( value ), static_cast< double >( not_expected ), std::fabs( static_cast< double >( not_expected ) - value ), static_cast< double >( epsilon ) ); \
} \
QVERIFY( !qgsDoubleNear( value, not_expected, epsilon ) ); \
}

#define QGSCOMPARENEARPOINT(point1,point2,epsilon) { \
QGSCOMPARENEAR( point1.x(), point2.x(), epsilon ); \
QGSCOMPARENEAR( point1.y(), point2.y(), epsilon ); \
}

#define QGSCOMPARENEARRECTANGLE(rectangle1,rectangle2,epsilon) { \
QGSCOMPARENEAR( rectangle1.xMinimum(), rectangle2.xMinimum(), epsilon ); \
QGSCOMPARENEAR( rectangle1.xMaximum(), rectangle2.xMaximum(), epsilon ); \
QGSCOMPARENEAR( rectangle1.yMinimum(), rectangle2.yMinimum(), epsilon ); \
QGSCOMPARENEAR( rectangle1.yMaximum(), rectangle2.yMaximum(), epsilon ); \
}

//sometimes GML attributes are in a different order - but that's ok
#define QGSCOMPAREGML(result,expected) { \
QCOMPARE( result.replace( QStringLiteral("ts=\" \" cs=\",\""), QStringLiteral("cs=\",\" ts=\" \"") ), expected ); \
}

/**
* QGIS unit test utilities.
* \since QGIS 3.0
Expand Down
1 change: 0 additions & 1 deletion tests/src/analysis/testqgsalignraster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "qgsapplication.h"
#include "qgscoordinatereferencesystem.h"
#include "qgsrectangle.h"
#include "qgstestutils.h"

#include <QDir>

Expand Down
1 change: 0 additions & 1 deletion tests/src/analysis/testqgsrastercalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Email : nyall dot dawson at gmail dot com
#include "qgsrastermatrix.h"
#include "qgsapplication.h"
#include "qgsproject.h"
#include "qgstestutils.h"

Q_DECLARE_METATYPE( QgsRasterCalcNode::Operator )

Expand Down
1 change: 0 additions & 1 deletion tests/src/app/testqgsattributetable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "qgsvectorfilewriter.h"

#include "qgstest.h"
#include "qgstestutils.h"

/** \ingroup UnitTests
* This is a unit test for the attribute table dialog
Expand Down
1 change: 0 additions & 1 deletion tests/src/app/testqgsfieldcalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "qgsproject.h"
#include "qgsmapcanvas.h"
#include "qgsunittypes.h"
#include "qgstestutils.h"

/** \ingroup UnitTests
* This is a unit test for the field calculator
Expand Down
1 change: 0 additions & 1 deletion tests/src/app/testqgsmaptoolidentifyaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "qgsunittypes.h"
#include "qgsmaptoolidentifyaction.h"
#include "qgssettings.h"
#include "qgstestutils.h"

#include "cpl_conv.h"

Expand Down
1 change: 0 additions & 1 deletion tests/src/app/testqgsmeasuretool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "qgsproject.h"
#include "qgsmapcanvas.h"
#include "qgsunittypes.h"
#include "qgstestutils.h"

/** \ingroup UnitTests
* This is a unit test for the measure tool
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "qgsproperty.h"
#include <QObject>
#include "qgstest.h"
#include "qgstestutils.h"

class TestQgsComposerMap : public QObject
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgscomposerutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "qgsmultirenderchecker.h"
#include "qgsfontutils.h"
#include "qgsproject.h"
#include "qgstestutils.h"
#include "qgsproperty.h"
#include <QObject>
#include "qgstest.h"
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgscomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

#include <QObject>
#include "qgstest.h"
#include "qgstestutils.h"

class TestQgsComposition : public QObject
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgscoordinatetransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "qgsrectangle.h"
#include <QObject>
#include "qgstest.h"
#include "qgstestutils.h"

class TestQgsCoordinateTransform: public QObject
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgscurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "qgslinestring.h"
#include "qgspoint.h"
#include "qgstest.h"
#include "qgstestutils.h"

/** \ingroup UnitTests
* This is a unit test for the operations on curve geometries
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsdistancearea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "qgsgeometryfactory.h"
#include "qgsgeometry.h"
#include "qgis.h"
#include "qgstestutils.h"
#include <memory>

class TestQgsDistanceArea: public QObject
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "qgsrasterlayer.h"
#include "qgsproject.h"
#include "qgsexpressionnodeimpl.h"
#include "qgstestutils.h"

static void _parseAndEvalExpr( int arg )
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsgeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include "qgscircularstring.h"
#include "qgsgeometrycollection.h"
#include "qgsgeometryfactory.h"
#include "qgstestutils.h"

//qgs unit test utility class
#include "qgsrenderchecker.h"
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsgeometryimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@


#include "qgstest.h"
#include "qgstestutils.h"

#include <QObject>

Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsgeometryutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "qgslinestring.h"
#include "qgspolygon.h"
#include "qgsmultipolygon.h"
#include "qgstestutils.h"

class TestQgsGeometryUtils: public QObject
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgshistogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "qgsvectorlayer.h"
#include "qgsvectordataprovider.h"
#include "qgshistogram.h"
#include "qgstestutils.h"

/** \ingroup UnitTests
* This is a unit test for QgsHistogram
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgslayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "qgsproject.h"
#include "qgslayoutitemmap.h"
#include "qgslayoutitemshape.h"
#include "qgstestutils.h"

class TestQgsLayout: public QObject
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgslayoutitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "qgstest.h"
#include "qgsproject.h"
#include "qgsreadwritecontext.h"
#include "qgstestutils.h"
#include <QObject>
#include <QPainter>
#include <QImage>
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgslayoutunits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "qgslayoutsize.h"
#include "qgslayoutmeasurementconverter.h"
#include "qgis.h"
#include "qgstestutils.h"

class TestQgsLayoutUnits : public QObject
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgslayoututils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "qgslayout.h"
#include "qgstest.h"
#include "qgslayoututils.h"
#include "qgstestutils.h"
#include "qgsproject.h"
#include "qgslayoutitemmap.h"

Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsmaptopixel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <qgsmaptopixel.h>
#include <qgspoint.h>
#include "qgslogger.h"
#include "qgstestutils.h"

class TestQgsMapToPixel: public QObject
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgspoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <qgsgeometry.h>
//header for class being tested
#include <qgspoint.h>
#include "qgstestutils.h"

class TestQgsPointXY: public QObject
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsprocessing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <QtTest/QSignalSpy>
#include "qgis.h"
#include "qgstest.h"
#include "qgstestutils.h"
#include "qgsrasterlayer.h"
#include "qgsproject.h"
#include "qgspoint.h"
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsproperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
***************************************************************************/

#include "qgstest.h"
#include "qgstestutils.h"
#include "qgsproperty.h"
#include "qgspropertycollection.h"
#include "qgsvectorlayer.h"
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

//qgis unit test includes
#include <qgsrenderchecker.h>
#include "qgstestutils.h"

/** \ingroup UnitTests
* This is a unit test for the QgsRasterLayer class.
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsrastersublayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

//qgis unit test includes
#include <qgsrenderchecker.h>
#include "qgstestutils.h"

/** \ingroup UnitTests
* This is a unit test for raster sublayers
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgsstatisticalsummary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "qgsstatisticalsummary.h"
#include "qgis.h"
#include "qgstestutils.h"

class TestQgsStatisticSummary: public QObject
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/core/testqgstracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

#include <qgsapplication.h>
#include <qgsgeometry.h>
#include <qgstestutils.h>
#include <qgstracer.h>
#include <qgsvectorlayer.h>

Expand Down
1 change: 0 additions & 1 deletion tests/src/gui/testprojectionissues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "qgsrasterlayer.h"
#include <QObject>
#include "qgstest.h"
#include "qgstestutils.h"

class TestProjectionIssues : public QObject
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/gui/testqgslayoutview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "qgslayoutitemregistry.h"
#include "qgslayoutitemguiregistry.h"
#include "qgslayoutitemwidget.h"
#include "qgstestutils.h"
#include "qgsproject.h"
#include "qgsgui.h"
#include <QtTest/QSignalSpy>
Expand Down
1 change: 0 additions & 1 deletion tests/src/gui/testqgsmapcanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <qgsrenderchecker.h>
#include <qgsvectordataprovider.h>
#include <qgsmaptoolpan.h>
#include "qgstestutils.h"

namespace QTest
{
Expand Down
1 change: 0 additions & 1 deletion tests/src/providers/testqgsgdalprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <qgsproviderregistry.h>
#include <qgsrasterdataprovider.h>
#include <qgsrectangle.h>
#include "qgstestutils.h"

/** \ingroup UnitTests
* This is a unit test for the gdal provider
Expand Down

0 comments on commit 700f9b2

Please sign in to comment.