diff --git a/tests/src/core/testqgscomposerdd.cpp b/tests/src/core/testqgscomposerdd.cpp index 4284820211f..529f600ce1b 100644 --- a/tests/src/core/testqgscomposerdd.cpp +++ b/tests/src/core/testqgscomposerdd.cpp @@ -53,8 +53,8 @@ class TestQgsComposerDD : public QObject void ddEvaluate(); //test setting/evaluating data defined value private: - QgsComposition* mComposition; - QgsMapSettings mMapSettings; + QgsComposition *mComposition; + QgsMapSettings *mMapSettings; QgsVectorLayer* mVectorLayer; QgsComposerMap* mAtlasMap; QgsAtlasComposition* mAtlas; @@ -66,6 +66,8 @@ void TestQgsComposerDD::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); + mMapSettings = new QgsMapSettings(); + //create maplayers from testdata and add to layer registry QFileInfo vectorFileInfo( QString( TEST_DATA_DIR ) + "/france_parts.shp" ); mVectorLayer = new QgsVectorLayer( vectorFileInfo.filePath(), @@ -79,15 +81,15 @@ void TestQgsComposerDD::initTestCase() QgsMapLayerRegistry::instance()->addMapLayers( QList() << mVectorLayer ); //create composition with composer map - mMapSettings.setLayers( QStringList() << mVectorLayer->id() ); - mMapSettings.setCrsTransformEnabled( true ); - mMapSettings.setMapUnits( QGis::Meters ); + mMapSettings->setLayers( QStringList() << mVectorLayer->id() ); + mMapSettings->setCrsTransformEnabled( true ); + mMapSettings->setMapUnits( QGis::Meters ); // select epsg:2154 QgsCoordinateReferenceSystem crs; crs.createFromSrid( 2154 ); - mMapSettings.setDestinationCrs( crs ); - mComposition = new QgsComposition( mMapSettings ); + mMapSettings->setDestinationCrs( crs ); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape // fix the renderer, fill with green @@ -114,6 +116,7 @@ void TestQgsComposerDD::initTestCase() void TestQgsComposerDD::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposereffects.cpp b/tests/src/core/testqgscomposereffects.cpp index 267cda9dbea..2c60e24f9f9 100644 --- a/tests/src/core/testqgscomposereffects.cpp +++ b/tests/src/core/testqgscomposereffects.cpp @@ -34,6 +34,7 @@ class TestQgsComposerEffects : public QObject : mComposition( 0 ) , mComposerRect1( 0 ) , mComposerRect2( 0 ) + , mMapSettings( 0 ) {} private slots: @@ -46,9 +47,9 @@ class TestQgsComposerEffects : public QObject private: QgsComposition* mComposition; - QgsComposerShape* mComposerRect1; - QgsComposerShape* mComposerRect2; - QgsMapSettings mMapSettings; + QgsComposerShape *mComposerRect1; + QgsComposerShape *mComposerRect2; + QgsMapSettings *mMapSettings; QString mReport; }; @@ -57,9 +58,11 @@ void TestQgsComposerEffects::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); + mMapSettings = new QgsMapSettings(); + //create composition with two rectangles - mComposition = new QgsComposition( mMapSettings ); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape mComposerRect1 = new QgsComposerShape( 20, 20, 150, 100, mComposition ); mComposerRect1->setShapeType( QgsComposerShape::Rectangle ); @@ -76,6 +79,7 @@ void TestQgsComposerEffects::initTestCase() void TestQgsComposerEffects::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposergroup.cpp b/tests/src/core/testqgscomposergroup.cpp index b0735742fbb..c80f19fb5ef 100644 --- a/tests/src/core/testqgscomposergroup.cpp +++ b/tests/src/core/testqgscomposergroup.cpp @@ -19,6 +19,8 @@ #include "qgscomposerlabel.h" #include "qgscomposition.h" #include "qgscompositionchecker.h" +#include "qgsapplication.h" + #include #include @@ -45,8 +47,8 @@ class TestQgsComposerGroup : public QObject void undoRedo(); //test that group/ungroup undo/redo commands don't crash private: - QgsComposition* mComposition; - QgsMapSettings mMapSettings; + QgsComposition *mComposition; + QgsMapSettings *mMapSettings; QgsComposerLabel* mItem1; QgsComposerLabel* mItem2; QgsComposerItemGroup* mGroup; @@ -55,7 +57,11 @@ class TestQgsComposerGroup : public QObject void TestQgsComposerGroup::initTestCase() { - mComposition = new QgsComposition( mMapSettings ); + QgsApplication::init(); + QgsApplication::initQgis(); + + mMapSettings = new QgsMapSettings(); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape //create some items @@ -72,6 +78,7 @@ void TestQgsComposerGroup::initTestCase() void TestQgsComposerGroup::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposerhtml.cpp b/tests/src/core/testqgscomposerhtml.cpp index e8deb706902..cd8d907d025 100644 --- a/tests/src/core/testqgscomposerhtml.cpp +++ b/tests/src/core/testqgscomposerhtml.cpp @@ -44,14 +44,15 @@ class TestQgsComposerHtml : public QObject void tableMultiFrame(); //tests multiframe capabilities of composer html void htmlMultiFrameSmartBreak(); //tests smart page breaks in html multi frame private: - QgsComposition* mComposition; - QgsMapSettings mMapSettings; + QgsComposition *mComposition; + QgsMapSettings *mMapSettings; QString mReport; QFont mTestFont; }; TestQgsComposerHtml::TestQgsComposerHtml() - : mComposition( NULL ) + : mComposition( 0 ) + , mMapSettings( 0 ) { } @@ -61,7 +62,8 @@ void TestQgsComposerHtml::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); - mComposition = new QgsComposition( mMapSettings ); + mMapSettings = new QgsMapSettings(); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape mReport = "

Composer HTML Tests

\n"; @@ -73,6 +75,7 @@ void TestQgsComposerHtml::initTestCase() void TestQgsComposerHtml::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposerlabel.cpp b/tests/src/core/testqgscomposerlabel.cpp index 00b437a7487..7aaa73b0c3c 100644 --- a/tests/src/core/testqgscomposerlabel.cpp +++ b/tests/src/core/testqgscomposerlabel.cpp @@ -34,6 +34,7 @@ class TestQgsComposerLabel : public QObject TestQgsComposerLabel() : mComposition( 0 ) , mComposerLabel( 0 ) + , mMapSettings( 0 ) , mVectorLayer( 0 ) {} @@ -55,7 +56,7 @@ class TestQgsComposerLabel : public QObject private: QgsComposition* mComposition; QgsComposerLabel* mComposerLabel; - QgsMapSettings mMapSettings; + QgsMapSettings *mMapSettings; QgsVectorLayer* mVectorLayer; }; @@ -64,6 +65,8 @@ void TestQgsComposerLabel::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); + mMapSettings = new QgsMapSettings(); + //create maplayers from testdata and add to layer registry QFileInfo vectorFileInfo( QString( TEST_DATA_DIR ) + "/" + "france_parts.shp" ); mVectorLayer = new QgsVectorLayer( vectorFileInfo.filePath(), @@ -72,9 +75,9 @@ void TestQgsComposerLabel::initTestCase() QgsMapLayerRegistry::instance()->addMapLayers( QList() << mVectorLayer ); //create composition with composer map - mMapSettings.setLayers( QStringList() << mVectorLayer->id() ); - mMapSettings.setCrsTransformEnabled( false ); - mComposition = new QgsComposition( mMapSettings ); + mMapSettings->setLayers( QStringList() << mVectorLayer->id() ); + mMapSettings->setCrsTransformEnabled( false ); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape mComposerLabel = new QgsComposerLabel( mComposition ); @@ -86,6 +89,7 @@ void TestQgsComposerLabel::initTestCase() void TestQgsComposerLabel::cleanupTestCase() { delete mComposition; + delete mMapSettings; QgsApplication::exitQgis(); } diff --git a/tests/src/core/testqgscomposermap.cpp b/tests/src/core/testqgscomposermap.cpp index faac9e3bdcc..5a00a8174e9 100644 --- a/tests/src/core/testqgscomposermap.cpp +++ b/tests/src/core/testqgscomposermap.cpp @@ -48,9 +48,9 @@ class TestQgsComposerMap : public QObject void mapPolygonVertices(); // test mapPolygon function with no map rotation private: - QgsComposition* mComposition; - QgsComposerMap* mComposerMap; - QgsMapSettings mMapSettings; + QgsComposition *mComposition; + QgsComposerMap *mComposerMap; + QgsMapSettings *mMapSettings; QgsRasterLayer* mRasterLayer; QString mReport; }; @@ -60,6 +60,8 @@ void TestQgsComposerMap::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); + mMapSettings = new QgsMapSettings(); + //create maplayers from testdata and add to layer registry QFileInfo rasterFileInfo( QString( TEST_DATA_DIR ) + "/landsat.tif" ); mRasterLayer = new QgsRasterLayer( rasterFileInfo.filePath(), @@ -70,9 +72,9 @@ void TestQgsComposerMap::initTestCase() QgsMapLayerRegistry::instance()->addMapLayers( QList() << mRasterLayer ); //create composition with composer map - mMapSettings.setLayers( QStringList() << mRasterLayer->id() ); - mMapSettings.setCrsTransformEnabled( false ); - mComposition = new QgsComposition( mMapSettings ); + mMapSettings->setLayers( QStringList() << mRasterLayer->id() ); + mMapSettings->setCrsTransformEnabled( false ); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape mComposerMap = new QgsComposerMap( mComposition, 20, 20, 200, 100 ); mComposerMap->setFrameEnabled( true ); @@ -84,6 +86,7 @@ void TestQgsComposerMap::initTestCase() void TestQgsComposerMap::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposermapgrid.cpp b/tests/src/core/testqgscomposermapgrid.cpp index 09497f56a4c..57ca8dbb927 100644 --- a/tests/src/core/testqgscomposermapgrid.cpp +++ b/tests/src/core/testqgscomposermapgrid.cpp @@ -32,7 +32,6 @@ class TestQgsComposerMapGrid : public QObject public: TestQgsComposerMapGrid(); - ~TestQgsComposerMapGrid(); private slots: void initTestCase();// will be called before the first testfunction is executed. @@ -76,11 +75,6 @@ TestQgsComposerMapGrid::TestQgsComposerMapGrid() mMapSettings = new QgsMapSettings(); } -TestQgsComposerMapGrid::~TestQgsComposerMapGrid() -{ - delete mMapSettings; -} - void TestQgsComposerMapGrid::initTestCase() { mReport = "

Composer Map Grid Tests

\n"; @@ -88,6 +82,8 @@ void TestQgsComposerMapGrid::initTestCase() void TestQgsComposerMapGrid::cleanupTestCase() { + delete mMapSettings; + QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) ) diff --git a/tests/src/core/testqgscomposermapoverview.cpp b/tests/src/core/testqgscomposermapoverview.cpp index c6327444a34..7c5c1a98bdd 100644 --- a/tests/src/core/testqgscomposermapoverview.cpp +++ b/tests/src/core/testqgscomposermapoverview.cpp @@ -54,7 +54,7 @@ class TestQgsComposerMapOverview : public QObject private: QgsComposition* mComposition; QgsComposerMap* mComposerMap; - QgsMapSettings mMapSettings; + QgsMapSettings *mMapSettings; QgsRasterLayer* mRasterLayer; QString mReport; }; @@ -64,6 +64,8 @@ void TestQgsComposerMapOverview::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); + mMapSettings = new QgsMapSettings(); + //create maplayers from testdata and add to layer registry QFileInfo rasterFileInfo( QString( TEST_DATA_DIR ) + "/rgb256x256.png" ); mRasterLayer = new QgsRasterLayer( rasterFileInfo.filePath(), @@ -74,9 +76,9 @@ void TestQgsComposerMapOverview::initTestCase() QgsMapLayerRegistry::instance()->addMapLayers( QList() << mRasterLayer ); //create composition with composer map - mMapSettings.setLayers( QStringList() << mRasterLayer->id() ); - mMapSettings.setCrsTransformEnabled( false ); - mComposition = new QgsComposition( mMapSettings ); + mMapSettings->setLayers( QStringList() << mRasterLayer->id() ); + mMapSettings->setCrsTransformEnabled( false ); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape mComposerMap = new QgsComposerMap( mComposition, 20, 20, 200, 100 ); mComposerMap->setFrameEnabled( true ); @@ -88,6 +90,7 @@ void TestQgsComposerMapOverview::initTestCase() void TestQgsComposerMapOverview::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposermodel.cpp b/tests/src/core/testqgscomposermodel.cpp index 838207bf33d..c9473bc9903 100644 --- a/tests/src/core/testqgscomposermodel.cpp +++ b/tests/src/core/testqgscomposermodel.cpp @@ -62,10 +62,11 @@ class TestQgsComposerModel : public QObject void reorderToBottomWithRemoved(); //test reordering to bottom with removed items private: - QgsComposition* mComposition; - QgsComposerLabel* mItem1; - QgsComposerLabel* mItem2; - QgsComposerLabel* mItem3; + QgsComposition *mComposition; + QgsMapSettings *mMapSettings; + QgsComposerLabel *mItem1; + QgsComposerLabel *mItem2; + QgsComposerLabel *mItem3; }; void TestQgsComposerModel::initTestCase() @@ -73,8 +74,8 @@ void TestQgsComposerModel::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); - QgsMapSettings mapSettings; - mComposition = new QgsComposition( mapSettings ); + mMapSettings = new QgsMapSettings(); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape } @@ -82,6 +83,7 @@ void TestQgsComposerModel::initTestCase() void TestQgsComposerModel::cleanupTestCase() { delete mComposition; + delete mMapSettings; } void TestQgsComposerModel::init() diff --git a/tests/src/core/testqgscomposermultiframe.cpp b/tests/src/core/testqgscomposermultiframe.cpp index 4b767a3797c..59a2f94088f 100644 --- a/tests/src/core/testqgscomposermultiframe.cpp +++ b/tests/src/core/testqgscomposermultiframe.cpp @@ -44,14 +44,15 @@ class TestQgsComposerMultiFrame : public QObject void undoRedoRemovedFrame(); //test that undo doesn't crash with removed frames private: - QgsComposition* mComposition; + QgsComposition *mComposition; + QgsMapSettings *mMapSettings; QString mReport; }; TestQgsComposerMultiFrame::TestQgsComposerMultiFrame() - : mComposition( NULL ) + : mComposition( 0 ) + , mMapSettings( 0 ) { - } void TestQgsComposerMultiFrame::initTestCase() @@ -59,8 +60,8 @@ void TestQgsComposerMultiFrame::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); - QgsMapSettings mapSettings; - mComposition = new QgsComposition( mapSettings ); + mMapSettings = new QgsMapSettings(); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape mReport = "

Composer MultiFrame Tests

\n"; @@ -69,6 +70,7 @@ void TestQgsComposerMultiFrame::initTestCase() void TestQgsComposerMultiFrame::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposerobject.cpp b/tests/src/core/testqgscomposerobject.cpp index d1747058bb4..d532363155b 100644 --- a/tests/src/core/testqgscomposerobject.cpp +++ b/tests/src/core/testqgscomposerobject.cpp @@ -32,6 +32,7 @@ class TestQgsComposerObject : public QObject public: TestQgsComposerObject() : mComposition( 0 ) + , mMapSettings( 0 ) { } @@ -50,6 +51,7 @@ class TestQgsComposerObject : public QObject private: bool renderCheck( QString testName, QImage &image, int mismatchCount = 0 ); QgsComposition *mComposition; + QgsMapSettings *mMapSettings; QString mReport; }; @@ -59,8 +61,8 @@ void TestQgsComposerObject::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); - QgsMapSettings mapSettings; - mComposition = new QgsComposition( mapSettings ); + mMapSettings = new QgsMapSettings(); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape mReport = "

Composer Object Tests

\n"; @@ -69,6 +71,7 @@ void TestQgsComposerObject::initTestCase() void TestQgsComposerObject::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposerpaper.cpp b/tests/src/core/testqgscomposerpaper.cpp index 3fb09995131..191f14d1bcd 100644 --- a/tests/src/core/testqgscomposerpaper.cpp +++ b/tests/src/core/testqgscomposerpaper.cpp @@ -59,7 +59,7 @@ class TestQgsComposerPaper : public QObject QgsMarkerLineSymbolLayerV2* mMarkerLine; QgsFillSymbolV2* mFillSymbol; QgsFillSymbolV2* mMarkerLineSymbol; - QgsMapSettings mMapSettings; + QgsMapSettings *mMapSettings; // QgsSingleSymbolRendererV2* mSymbolRenderer; }; @@ -70,7 +70,8 @@ void TestQgsComposerPaper::initTestCase() QgsApplication::initQgis(); //create empty composition - mComposition = new QgsComposition( mMapSettings ); + mMapSettings = new QgsMapSettings(); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape //setup simple fill @@ -89,6 +90,7 @@ void TestQgsComposerPaper::initTestCase() void TestQgsComposerPaper::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposerpicture.cpp b/tests/src/core/testqgscomposerpicture.cpp index 30d24c5ee1a..1f4878b27aa 100644 --- a/tests/src/core/testqgscomposerpicture.cpp +++ b/tests/src/core/testqgscomposerpicture.cpp @@ -30,7 +30,6 @@ class TestQgsComposerPicture : public QObject public: TestQgsComposerPicture(); - ~TestQgsComposerPicture(); private slots: void initTestCase();// will be called before the first testfunction is executed. @@ -77,11 +76,6 @@ TestQgsComposerPicture::TestQgsComposerPicture() } -TestQgsComposerPicture::~TestQgsComposerPicture() -{ - delete mMapSettings; -} - void TestQgsComposerPicture::initTestCase() { QgsApplication::init(); @@ -106,6 +100,7 @@ void TestQgsComposerPicture::initTestCase() void TestQgsComposerPicture::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposerrotation.cpp b/tests/src/core/testqgscomposerrotation.cpp index 738615fa33a..fb7a056b488 100644 --- a/tests/src/core/testqgscomposerrotation.cpp +++ b/tests/src/core/testqgscomposerrotation.cpp @@ -45,8 +45,6 @@ class TestQgsComposerRotation : public QObject , mRasterLayer( 0 ) {} - ~TestQgsComposerRotation(); - private slots: void initTestCase();// will be called before the first testfunction is executed. void cleanupTestCase();// will be called after the last testfunction was executed. @@ -73,11 +71,6 @@ class TestQgsComposerRotation : public QObject QString mReport; }; -TestQgsComposerRotation::~TestQgsComposerRotation() -{ - delete mMapSettings; -} - void TestQgsComposerRotation::initTestCase() { QgsApplication::init(); @@ -123,6 +116,7 @@ void TestQgsComposerRotation::cleanupTestCase() delete mComposerMap; } delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposerscalebar.cpp b/tests/src/core/testqgscomposerscalebar.cpp index c81042f1913..d12ed16341a 100644 --- a/tests/src/core/testqgscomposerscalebar.cpp +++ b/tests/src/core/testqgscomposerscalebar.cpp @@ -41,11 +41,6 @@ class TestQgsComposerScaleBar : public QObject , mMapSettings( 0 ) {} - ~TestQgsComposerScaleBar() - { - delete mMapSettings; - } - private slots: void initTestCase();// will be called before the first testfunction is executed. void cleanupTestCase();// will be called after the last testfunction was executed. @@ -119,6 +114,7 @@ void TestQgsComposerScaleBar::initTestCase() void TestQgsComposerScaleBar::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposershapes.cpp b/tests/src/core/testqgscomposershapes.cpp index 0c3f3f47103..7f6b7de5eb6 100644 --- a/tests/src/core/testqgscomposershapes.cpp +++ b/tests/src/core/testqgscomposershapes.cpp @@ -54,7 +54,7 @@ class TestQgsComposerShapes : public QObject private: QgsComposition* mComposition; QgsComposerShape* mComposerShape; - QgsMapSettings mMapSettings; + QgsMapSettings *mMapSettings; QgsSimpleFillSymbolLayerV2* mSimpleFill; QgsFillSymbolV2* mFillSymbol; QString mReport; @@ -65,8 +65,10 @@ void TestQgsComposerShapes::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); + mMapSettings = new QgsMapSettings(); + //create composition with two rectangles - mComposition = new QgsComposition( mMapSettings ); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape mComposerShape = new QgsComposerShape( 20, 20, 150, 100, mComposition ); mComposerShape->setBackgroundColor( QColor::fromRgb( 255, 150, 0 ) ); @@ -83,6 +85,7 @@ void TestQgsComposerShapes::initTestCase() void TestQgsComposerShapes::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); diff --git a/tests/src/core/testqgscomposertable.cpp b/tests/src/core/testqgscomposertable.cpp index feaac291f35..ec270c2e39d 100644 --- a/tests/src/core/testqgscomposertable.cpp +++ b/tests/src/core/testqgscomposertable.cpp @@ -41,10 +41,6 @@ class TestQgsComposerTable : public QObject , mVectorLayer( 0 ) , mComposerAttributeTable( 0 ) {} - ~TestQgsComposerTable() - { - delete mMapSettings; - } private slots: void initTestCase();// will be called before the first testfunction is executed. @@ -109,6 +105,7 @@ void TestQgsComposerTable::initTestCase() void TestQgsComposerTable::cleanupTestCase() { delete mComposition; + delete mMapSettings; QgsApplication::exitQgis(); } diff --git a/tests/src/core/testqgscomposertablev2.cpp b/tests/src/core/testqgscomposertablev2.cpp index d588498c7b1..01379f48591 100644 --- a/tests/src/core/testqgscomposertablev2.cpp +++ b/tests/src/core/testqgscomposertablev2.cpp @@ -105,6 +105,8 @@ void TestQgsComposerTableV2::initTestCase() void TestQgsComposerTableV2::cleanupTestCase() { + delete mMapSettings; + QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile ); if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) ) diff --git a/tests/src/core/testqgscomposerutils.cpp b/tests/src/core/testqgscomposerutils.cpp index 3bf1a52af3d..62797892246 100644 --- a/tests/src/core/testqgscomposerutils.cpp +++ b/tests/src/core/testqgscomposerutils.cpp @@ -30,7 +30,6 @@ class TestQgsComposerUtils : public QObject Q_OBJECT public: TestQgsComposerUtils(); - ~TestQgsComposerUtils(); private slots: void initTestCase();// will be called before the first testfunction is executed. @@ -71,21 +70,18 @@ class TestQgsComposerUtils : public QObject }; TestQgsComposerUtils::TestQgsComposerUtils() - : mComposition( NULL ) + : mComposition( 0 ) + , mMapSettings( 0 ) +{ +} + + +void TestQgsComposerUtils::initTestCase() { QgsApplication::init(); QgsApplication::initQgis(); //for access to test font mMapSettings = new QgsMapSettings(); -} - -TestQgsComposerUtils::~TestQgsComposerUtils() -{ - delete mMapSettings; -} - -void TestQgsComposerUtils::initTestCase() -{ mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape @@ -100,6 +96,7 @@ void TestQgsComposerUtils::initTestCase() void TestQgsComposerUtils::cleanupTestCase() { delete mComposition; + delete mMapSettings; QgsApplication::exitQgis(); diff --git a/tests/src/core/testqgscomposition.cpp b/tests/src/core/testqgscomposition.cpp index 84615c1c803..013f91bd76d 100644 --- a/tests/src/core/testqgscomposition.cpp +++ b/tests/src/core/testqgscomposition.cpp @@ -46,11 +46,13 @@ class TestQgsComposition : public QObject private: QgsComposition *mComposition; + QgsMapSettings *mMapSettings; QString mReport; }; TestQgsComposition::TestQgsComposition() : mComposition( 0 ) + , mMapSettings( 0 ) { } @@ -59,12 +61,12 @@ void TestQgsComposition::initTestCase() QgsApplication::init(); QgsApplication::initQgis(); - QgsMapSettings mapSettings; + mMapSettings = new QgsMapSettings(); //create composition - mapSettings.setCrsTransformEnabled( true ); - mapSettings.setMapUnits( QGis::Meters ); - mComposition = new QgsComposition( mapSettings ); + mMapSettings->setCrsTransformEnabled( true ); + mMapSettings->setMapUnits( QGis::Meters ); + mComposition = new QgsComposition( *mMapSettings ); mComposition->setPaperSize( 297, 210 ); //A4 landscape mComposition->setNumPages( 3 ); @@ -75,6 +77,7 @@ void TestQgsComposition::initTestCase() void TestQgsComposition::cleanupTestCase() { delete mComposition; + delete mMapSettings; QString myReportFile = QDir::tempPath() + "/qgistest.html"; QFile myFile( myReportFile );