Skip to content
Permalink
Browse files
Condense qgstestutils.h and qgstest.h into a single file
  • 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.
@@ -868,7 +868,6 @@ SET(QGIS_CORE_HDRS
qgsstatisticalsummary.h
qgsstringstatisticalsummary.h
qgsstringutils.h
qgstestutils.h
qgstextlabelfeature.h
qgstextrenderer.h
qgstextrenderer_p.h

This file was deleted.

@@ -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
@@ -19,7 +19,6 @@
#include "qgsapplication.h"
#include "qgscoordinatereferencesystem.h"
#include "qgsrectangle.h"
#include "qgstestutils.h"

#include <QDir>

@@ -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 )

@@ -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
@@ -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
@@ -26,7 +26,6 @@
#include "qgsunittypes.h"
#include "qgsmaptoolidentifyaction.h"
#include "qgssettings.h"
#include "qgstestutils.h"

#include "cpl_conv.h"

@@ -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
@@ -29,7 +29,6 @@
#include "qgsproperty.h"
#include <QObject>
#include "qgstest.h"
#include "qgstestutils.h"

class TestQgsComposerMap : public QObject
{
@@ -22,7 +22,6 @@
#include "qgsmultirenderchecker.h"
#include "qgsfontutils.h"
#include "qgsproject.h"
#include "qgstestutils.h"
#include "qgsproperty.h"
#include <QObject>
#include "qgstest.h"
@@ -37,7 +37,6 @@

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

class TestQgsComposition : public QObject
{
@@ -19,7 +19,6 @@
#include "qgsrectangle.h"
#include <QObject>
#include "qgstest.h"
#include "qgstestutils.h"

class TestQgsCoordinateTransform: public QObject
{
@@ -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
@@ -26,7 +26,6 @@
#include "qgsgeometryfactory.h"
#include "qgsgeometry.h"
#include "qgis.h"
#include "qgstestutils.h"
#include <memory>

class TestQgsDistanceArea: public QObject
@@ -33,7 +33,6 @@
#include "qgsrasterlayer.h"
#include "qgsproject.h"
#include "qgsexpressionnodeimpl.h"
#include "qgstestutils.h"

static void _parseAndEvalExpr( int arg )
{
@@ -44,7 +44,6 @@
#include "qgscircularstring.h"
#include "qgsgeometrycollection.h"
#include "qgsgeometryfactory.h"
#include "qgstestutils.h"

//qgs unit test utility class
#include "qgsrenderchecker.h"
@@ -21,7 +21,6 @@


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

#include <QObject>

@@ -19,7 +19,6 @@
#include "qgslinestring.h"
#include "qgspolygon.h"
#include "qgsmultipolygon.h"
#include "qgstestutils.h"

class TestQgsGeometryUtils: public QObject
{
@@ -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
@@ -20,7 +20,6 @@
#include "qgsproject.h"
#include "qgslayoutitemmap.h"
#include "qgslayoutitemshape.h"
#include "qgstestutils.h"

class TestQgsLayout: public QObject
{
@@ -22,7 +22,6 @@
#include "qgstest.h"
#include "qgsproject.h"
#include "qgsreadwritecontext.h"
#include "qgstestutils.h"
#include <QObject>
#include <QPainter>
#include <QImage>
@@ -23,7 +23,6 @@
#include "qgslayoutsize.h"
#include "qgslayoutmeasurementconverter.h"
#include "qgis.h"
#include "qgstestutils.h"

class TestQgsLayoutUnits : public QObject
{
@@ -18,7 +18,6 @@
#include "qgslayout.h"
#include "qgstest.h"
#include "qgslayoututils.h"
#include "qgstestutils.h"
#include "qgsproject.h"
#include "qgslayoutitemmap.h"

@@ -20,7 +20,6 @@
#include <qgsmaptopixel.h>
#include <qgspoint.h>
#include "qgslogger.h"
#include "qgstestutils.h"

class TestQgsMapToPixel: public QObject
{
@@ -25,7 +25,6 @@
#include <qgsgeometry.h>
//header for class being tested
#include <qgspoint.h>
#include "qgstestutils.h"

class TestQgsPointXY: public QObject
{
@@ -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"
@@ -16,7 +16,6 @@
***************************************************************************/

#include "qgstest.h"
#include "qgstestutils.h"
#include "qgsproperty.h"
#include "qgspropertycollection.h"
#include "qgsvectorlayer.h"
@@ -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.
@@ -39,7 +39,6 @@

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

/** \ingroup UnitTests
* This is a unit test for raster sublayers
@@ -20,7 +20,6 @@

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

class TestQgsStatisticSummary: public QObject
{
@@ -17,7 +17,6 @@

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

@@ -23,7 +23,6 @@
#include "qgsrasterlayer.h"
#include <QObject>
#include "qgstest.h"
#include "qgstestutils.h"

class TestProjectionIssues : public QObject
{
@@ -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>
@@ -22,7 +22,6 @@
#include <qgsrenderchecker.h>
#include <qgsvectordataprovider.h>
#include <qgsmaptoolpan.h>
#include "qgstestutils.h"

namespace QTest
{
@@ -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

0 comments on commit 700f9b2

Please sign in to comment.