2 changes: 2 additions & 0 deletions src/analysis/vector/qgsgeometryanalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,14 @@ bool QgsGeometryAnalyzer::centroids( QgsVectorLayer* layer, const QString& shape
{
if ( !layer )
{
QgsDebugMsg( "No layer passed to centroids" );
return false;
}

QgsVectorDataProvider* dp = layer->dataProvider();
if ( !dp )
{
QgsDebugMsg( "No data provider for layer passed to centroids" );
return false;
}

Expand Down
5 changes: 4 additions & 1 deletion src/core/qgsapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ class CORE_EXPORT QgsApplication: public QApplication
virtual ~QgsApplication();

/** This method initialises paths etc for QGIS. Called by the ctor or call it manually
when your app does not extend the QApplication class. */
when your app does not extend the QApplication class.
@note you will probably want to call initQgis too to load the providers in
the above case.
*/
static void init( QString customConfigPath = QString() );

//! Watch for QFileOpenEvent.
Expand Down
12 changes: 7 additions & 5 deletions tests/src/analysis/testqgsvectoranalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,30 @@ void TestQgsVectorAnalyzer::initTestCase()
//
// init QGIS's paths - true means that all path will be inited from prefix
QString qgisPath = QCoreApplication::applicationDirPath ();
QgsApplication::setPrefixPath(INSTALL_PREFIX, true);
QgsApplication::init( INSTALL_PREFIX );
QgsApplication::initQgis( );
QgsApplication::showSettings();
// Instantiate the plugin directory so that providers are loaded
QgsProviderRegistry::instance(QgsApplication::pluginPath());

//create some objects that will be used in all tests...
//create a map layer that will be used in all tests...
QString myFileName (TEST_DATA_DIR); //defined in CmakeLists.txt
QString myBaseFileName (TEST_DATA_DIR); //defined in CmakeLists.txt
QString myEndName = "lines.shp";
myFileName = myFileName + QDir::separator() + myEndName;
QString myFileName = myBaseFileName + QDir::separator() + myEndName;
qDebug() << myFileName;
QFileInfo myLineInfo ( myFileName );
mpLineLayer = new QgsVectorLayer ( myLineInfo.filePath(),
myLineInfo.completeBaseName(), "ogr" );

myEndName = "polys.shp";
myFileName = myFileName + QDir::separator() + myEndName;
myFileName = myBaseFileName + QDir::separator() + myEndName;
QFileInfo myPolyInfo ( myFileName );
mpPolyLayer = new QgsVectorLayer ( myPolyInfo.filePath(),
myPolyInfo.completeBaseName(), "ogr" );

myEndName = "points.shp";
myFileName = myFileName + QDir::separator() + myEndName;
myFileName = myBaseFileName + QDir::separator() + myEndName;
QFileInfo myPointInfo ( myFileName );
mpPointLayer = new QgsVectorLayer ( myPointInfo.filePath(),
myPointInfo.completeBaseName(), "ogr" );
Expand Down
3 changes: 2 additions & 1 deletion tests/src/core/regression992.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ void Regression992::initTestCase()
{
// init QGIS's paths - true means that all path will be inited from prefix
QString qgisPath = QCoreApplication::applicationDirPath();
QgsApplication::setPrefixPath( INSTALL_PREFIX, true );
QgsApplication::init( INSTALL_PREFIX );
QgsApplication::initQgis();
QgsApplication::showSettings();
//create some objects that will be used in all tests...
//create a raster layer that will be used in all tests...
Expand Down
Binary file modified tests/testdata/expected_rgbwcmyk01_YeGeo.jp2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.