-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial unit test for raster layer class
Includes a simple 10x10 raster supplied by Enrico Chiaradia git-svn-id: http://svn.osgeo.org/qgis/trunk@7649 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
timlinux
committed
Nov 23, 2007
1 parent
00e26fd
commit bbde2c7
Showing
4 changed files
with
123 additions
and
1 deletion.
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
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,77 @@ | ||
/*************************************************************************** | ||
testqgsvectorfilewriter.cpp | ||
-------------------------------------- | ||
Date : Sun Sep 16 12:22:54 AKDT 2007 | ||
Copyright : (C) 2007 by Gary E. Sherman | ||
Email : sherman at mrcc dot 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 <QStringList> | ||
#include <QObject> | ||
#include <iostream> | ||
#include <QApplication> | ||
#include <QFileInfo> | ||
#include <QDir> | ||
|
||
//qgis includes... | ||
#include <qgsrasterlayer.h> | ||
#include <qgsapplication.h> | ||
|
||
/** \ingroup UnitTests | ||
* This is a unit test for the QgsRasterLayer class. | ||
*/ | ||
class TestQgsRasterLayer: public QObject | ||
{ | ||
Q_OBJECT; | ||
private slots: | ||
void initTestCase();// will be called before the first testfunction is executed. | ||
void cleanupTestCase(){};// will be called after the last testfunction was executed. | ||
void init(){};// will be called before each testfunction is executed. | ||
void cleanup(){};// will be called after every testfunction. | ||
|
||
void isValid(); | ||
|
||
private: | ||
QgsRasterLayer * mpLayer; | ||
}; | ||
|
||
void TestQgsRasterLayer::initTestCase() | ||
{ | ||
// init QGIS's paths - true means that all path will be inited from prefix | ||
QString qgisPath = QCoreApplication::applicationDirPath (); | ||
QgsApplication::setPrefixPath(qgisPath, TRUE); | ||
#ifdef Q_OS_LINUX | ||
QgsApplication::setPkgDataPath(qgisPath + "/../share/qgis"); | ||
#endif | ||
//create some objects that will be used in all tests... | ||
|
||
std::cout << "Prefix PATH: " << QgsApplication::prefixPath().toLocal8Bit().data() << std::endl; | ||
std::cout << "Plugin PATH: " << QgsApplication::pluginPath().toLocal8Bit().data() << std::endl; | ||
std::cout << "PkgData PATH: " << QgsApplication::pkgDataPath().toLocal8Bit().data() << std::endl; | ||
std::cout << "User DB PATH: " << QgsApplication::qgisUserDbFilePath().toLocal8Bit().data() << std::endl; | ||
|
||
//create a raster layer that will be used in all tests... | ||
QString myFileName (TEST_DATA_DIR); //defined in CmakeLists.txt | ||
myFileName = myFileName + QDir::separator() + "tenbytenraster.asc"; | ||
QFileInfo myRasterFileInfo ( myFileName ); | ||
mpLayer = new QgsRasterLayer ( myRasterFileInfo.filePath(), | ||
myRasterFileInfo.completeBaseName() ); | ||
} | ||
|
||
void TestQgsRasterLayer::isValid() | ||
{ | ||
QVERIFY ( mpLayer->isValid() ); | ||
} | ||
|
||
QTEST_MAIN(TestQgsRasterLayer) | ||
#include "moc_testqgsrasterlayer.cxx" | ||
|
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,19 @@ | ||
NCOLS 10 | ||
NROWS 10 | ||
XLLCENTER 1535380.000000 | ||
YLLCENTER 5083260.000000 | ||
DX 10 | ||
DY 10 | ||
NODATA_VALUE -9999 | ||
0 1 2 3 4 5 6 7 8 9 | ||
0 1 2 3 4 5 6 7 8 9 | ||
0 1 2 3 4 5 6 7 8 9 | ||
0 1 2 3 4 5 6 7 8 9 | ||
0 1 2 3 4 5 6 7 8 9 | ||
0 1 2 3 4 5 6 7 8 9 | ||
0 1 2 3 4 5 6 7 8 9 | ||
0 1 2 3 4 5 6 7 8 9 | ||
0 1 2 3 4 5 6 7 8 9 | ||
0 1 2 3 4 5 6 7 8 9 | ||
PROJECTION | ||
NOTES |