-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added unit test to verify zip layers can be opened
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/*************************************************************************** | ||
testziplayer.cpp | ||
-------------------------------------- | ||
Date : Sun Sep 16 12:22:23 AKDT 2007 | ||
Copyright : (C) 2012 Tim Sutton | ||
Email : tim@linfiniti.com | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
#include <QtTest> | ||
#include <QObject> | ||
#include <QString> | ||
#include <QObject> | ||
#include <QApplication> | ||
#include <QFileInfo> | ||
|
||
//qgis includes... | ||
#include <qgsvectorlayer.h> | ||
#include <qgsapplication.h> | ||
#include <qgsproviderregistry.h> | ||
|
||
/** \ingroup UnitTests | ||
* This is a unit test to verify that zip vector layers work | ||
*/ | ||
class TestZipLayer: public QObject | ||
{ | ||
Q_OBJECT; | ||
|
||
private slots: | ||
|
||
void testZipLayer() | ||
{ | ||
// init QGIS's paths - true means that all path will be inited from prefix | ||
QString qgisPath = QCoreApplication::applicationDirPath(); | ||
QgsApplication::setPrefixPath( INSTALL_PREFIX, true ); | ||
// Instantiate the plugin directory so that providers are loaded | ||
QgsProviderRegistry::instance( QgsApplication::pluginPath() ); | ||
// | ||
//create a point layer that will be used in all tests... | ||
// | ||
QString myDataDir( TEST_DATA_DIR ); | ||
myDataDir += QDir::separator(); | ||
QString myPointsFileName = myDataDir + "points.zip"; | ||
QFileInfo myPointFileInfo( myPointsFileName ); | ||
QgsVectorLayer * mypPointsLayer; | ||
mypPointsLayer = new QgsVectorLayer( myPointFileInfo.filePath(), | ||
myPointFileInfo.completeBaseName(), "ogr" ); | ||
QVERIFY( mypPointsLayer->isValid() ); | ||
delete mypPointsLayer; | ||
} | ||
|
||
}; | ||
|
||
QTEST_MAIN( TestZipLayer ) | ||
#include "moc_testziplayer.cxx" | ||
|
||
|
||
|
||
|