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 700f9b2ef856418199a73b564ef617b916f5f22a
Showing with 36 additions and 97 deletions.
  1. +0 −1 src/core/CMakeLists.txt
  2. +0 −63 src/core/qgstestutils.h
  3. +36 −0 src/test/qgstest.h
  4. +0 −1 tests/src/analysis/testqgsalignraster.cpp
  5. +0 −1 tests/src/analysis/testqgsrastercalculator.cpp
  6. +0 −1 tests/src/app/testqgsattributetable.cpp
  7. +0 −1 tests/src/app/testqgsfieldcalculator.cpp
  8. +0 −1 tests/src/app/testqgsmaptoolidentifyaction.cpp
  9. +0 −1 tests/src/app/testqgsmeasuretool.cpp
  10. +0 −1 tests/src/core/testqgscomposermap.cpp
  11. +0 −1 tests/src/core/testqgscomposerutils.cpp
  12. +0 −1 tests/src/core/testqgscomposition.cpp
  13. +0 −1 tests/src/core/testqgscoordinatetransform.cpp
  14. +0 −1 tests/src/core/testqgscurve.cpp
  15. +0 −1 tests/src/core/testqgsdistancearea.cpp
  16. +0 −1 tests/src/core/testqgsexpression.cpp
  17. +0 −1 tests/src/core/testqgsgeometry.cpp
  18. +0 −1 tests/src/core/testqgsgeometryimport.cpp
  19. +0 −1 tests/src/core/testqgsgeometryutils.cpp
  20. +0 −1 tests/src/core/testqgshistogram.cpp
  21. +0 −1 tests/src/core/testqgslayout.cpp
  22. +0 −1 tests/src/core/testqgslayoutitem.cpp
  23. +0 −1 tests/src/core/testqgslayoutunits.cpp
  24. +0 −1 tests/src/core/testqgslayoututils.cpp
  25. +0 −1 tests/src/core/testqgsmaptopixel.cpp
  26. +0 −1 tests/src/core/testqgspoint.cpp
  27. +0 −1 tests/src/core/testqgsprocessing.cpp
  28. +0 −1 tests/src/core/testqgsproperty.cpp
  29. +0 −1 tests/src/core/testqgsrasterlayer.cpp
  30. +0 −1 tests/src/core/testqgsrastersublayer.cpp
  31. +0 −1 tests/src/core/testqgsstatisticalsummary.cpp
  32. +0 −1 tests/src/core/testqgstracer.cpp
  33. +0 −1 tests/src/gui/testprojectionissues.cpp
  34. +0 −1 tests/src/gui/testqgslayoutview.cpp
  35. +0 −1 tests/src/gui/testqgsmapcanvas.cpp
  36. +0 −1 tests/src/providers/testqgsgdalprovider.cpp
@@ -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.
You can’t perform that action at this time.