mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
fixes ticket #832 Raster cell coount returns incorrect value
Added regression test to raster layer unit test git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@7650 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
36f261a52a
commit
cef0582975
@ -2945,6 +2945,7 @@ const QgsRasterBandStats QgsRasterLayer::getRasterBandStats(int theBandNoInt)
|
||||
myFirstIterationFlag = false;
|
||||
myRasterBandStats.minValDouble = myDouble;
|
||||
myRasterBandStats.maxValDouble = myDouble;
|
||||
++myRasterBandStats.elementCountInt;
|
||||
} //end of true part for first iteration check
|
||||
else
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
|
||||
//qgis includes...
|
||||
#include <qgsrasterlayer.h>
|
||||
#include <qgsrasterbandstats.h>
|
||||
#include <qgsapplication.h>
|
||||
|
||||
/** \ingroup UnitTests
|
||||
@ -39,7 +40,7 @@ class TestQgsRasterLayer: public QObject
|
||||
void cleanup(){};// will be called after every testfunction.
|
||||
|
||||
void isValid();
|
||||
|
||||
void checkDimensions();
|
||||
private:
|
||||
QgsRasterLayer * mpLayer;
|
||||
};
|
||||
@ -71,6 +72,14 @@ void TestQgsRasterLayer::isValid()
|
||||
{
|
||||
QVERIFY ( mpLayer->isValid() );
|
||||
}
|
||||
void TestQgsRasterLayer::checkDimensions()
|
||||
{
|
||||
QVERIFY ( mpLayer->getRasterXDim() == 10 );
|
||||
QVERIFY ( mpLayer->getRasterYDim() == 10 );
|
||||
// regression check for ticket #832
|
||||
// note getRasterBandStats call is base 1
|
||||
QVERIFY ( mpLayer->getRasterBandStats(1).elementCountInt == 100 );
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestQgsRasterLayer)
|
||||
#include "moc_testqgsrasterlayer.cxx"
|
||||
|
Loading…
x
Reference in New Issue
Block a user