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:
timlinux 2007-11-23 16:02:02 +00:00
parent 36f261a52a
commit cef0582975
2 changed files with 11 additions and 1 deletions

View File

@ -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
{

View File

@ -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"