mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
Fix problem with analyzer test
This commit is contained in:
parent
2b8487b942
commit
d13fb2586b
@ -149,12 +149,14 @@ bool QgsGeometryAnalyzer::centroids( QgsVectorLayer* layer, const QString& shape
|
|||||||
{
|
{
|
||||||
if ( !layer )
|
if ( !layer )
|
||||||
{
|
{
|
||||||
|
QgsDebugMsg( "No layer passed to centroids" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QgsVectorDataProvider* dp = layer->dataProvider();
|
QgsVectorDataProvider* dp = layer->dataProvider();
|
||||||
if ( !dp )
|
if ( !dp )
|
||||||
{
|
{
|
||||||
|
QgsDebugMsg( "No data provider for layer passed to centroids" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,10 @@ class CORE_EXPORT QgsApplication: public QApplication
|
|||||||
virtual ~QgsApplication();
|
virtual ~QgsApplication();
|
||||||
|
|
||||||
/** This method initialises paths etc for QGIS. Called by the ctor or call it manually
|
/** 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() );
|
static void init( QString customConfigPath = QString() );
|
||||||
|
|
||||||
//! Watch for QFileOpenEvent.
|
//! Watch for QFileOpenEvent.
|
||||||
|
@ -51,28 +51,30 @@ void TestQgsVectorAnalyzer::initTestCase()
|
|||||||
//
|
//
|
||||||
// init QGIS's paths - true means that all path will be inited from prefix
|
// init QGIS's paths - true means that all path will be inited from prefix
|
||||||
QString qgisPath = QCoreApplication::applicationDirPath ();
|
QString qgisPath = QCoreApplication::applicationDirPath ();
|
||||||
QgsApplication::setPrefixPath(INSTALL_PREFIX, true);
|
QgsApplication::init( INSTALL_PREFIX );
|
||||||
|
QgsApplication::initQgis( );
|
||||||
QgsApplication::showSettings();
|
QgsApplication::showSettings();
|
||||||
// Instantiate the plugin directory so that providers are loaded
|
// Instantiate the plugin directory so that providers are loaded
|
||||||
QgsProviderRegistry::instance(QgsApplication::pluginPath());
|
QgsProviderRegistry::instance(QgsApplication::pluginPath());
|
||||||
|
|
||||||
//create some objects that will be used in all tests...
|
//create some objects that will be used in all tests...
|
||||||
//create a map layer 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";
|
QString myEndName = "lines.shp";
|
||||||
myFileName = myFileName + QDir::separator() + myEndName;
|
QString myFileName = myBaseFileName + QDir::separator() + myEndName;
|
||||||
|
qDebug() << myFileName;
|
||||||
QFileInfo myLineInfo ( myFileName );
|
QFileInfo myLineInfo ( myFileName );
|
||||||
mpLineLayer = new QgsVectorLayer ( myLineInfo.filePath(),
|
mpLineLayer = new QgsVectorLayer ( myLineInfo.filePath(),
|
||||||
myLineInfo.completeBaseName(), "ogr" );
|
myLineInfo.completeBaseName(), "ogr" );
|
||||||
|
|
||||||
myEndName = "polys.shp";
|
myEndName = "polys.shp";
|
||||||
myFileName = myFileName + QDir::separator() + myEndName;
|
myFileName = myBaseFileName + QDir::separator() + myEndName;
|
||||||
QFileInfo myPolyInfo ( myFileName );
|
QFileInfo myPolyInfo ( myFileName );
|
||||||
mpPolyLayer = new QgsVectorLayer ( myPolyInfo.filePath(),
|
mpPolyLayer = new QgsVectorLayer ( myPolyInfo.filePath(),
|
||||||
myPolyInfo.completeBaseName(), "ogr" );
|
myPolyInfo.completeBaseName(), "ogr" );
|
||||||
|
|
||||||
myEndName = "points.shp";
|
myEndName = "points.shp";
|
||||||
myFileName = myFileName + QDir::separator() + myEndName;
|
myFileName = myBaseFileName + QDir::separator() + myEndName;
|
||||||
QFileInfo myPointInfo ( myFileName );
|
QFileInfo myPointInfo ( myFileName );
|
||||||
mpPointLayer = new QgsVectorLayer ( myPointInfo.filePath(),
|
mpPointLayer = new QgsVectorLayer ( myPointInfo.filePath(),
|
||||||
myPointInfo.completeBaseName(), "ogr" );
|
myPointInfo.completeBaseName(), "ogr" );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user