mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Added unit test to verify zip layers can be opened
This commit is contained in:
parent
f77b9932b5
commit
7bd9240efd
@ -93,4 +93,5 @@ ADD_QGIS_TEST(pointtest testqgspoint.cpp)
|
|||||||
ADD_QGIS_TEST(searchstringtest testqgssearchstring.cpp)
|
ADD_QGIS_TEST(searchstringtest testqgssearchstring.cpp)
|
||||||
ADD_QGIS_TEST(vectorlayertest testqgsvectorlayer.cpp)
|
ADD_QGIS_TEST(vectorlayertest testqgsvectorlayer.cpp)
|
||||||
ADD_QGIS_TEST(rulebasedrenderertest testqgsrulebasedrenderer.cpp)
|
ADD_QGIS_TEST(rulebasedrenderertest testqgsrulebasedrenderer.cpp)
|
||||||
|
ADD_QGIS_TEST(ziplayertest testziplayer.cpp)
|
||||||
|
|
||||||
|
64
tests/src/core/testziplayer.cpp
Normal file
64
tests/src/core/testziplayer.cpp
Normal file
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user