Skip to content
Permalink
Browse files

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@7650 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
timlinux
timlinux committed Nov 23, 2007
1 parent bbde2c7 commit d082db630c8dff0aef749c9c03d624919c8cb182
Showing with 11 additions and 1 deletion.
  1. +1 −0 src/core/raster/qgsrasterlayer.cpp
  2. +10 −1 tests/src/core/testqgsrasterlayer.cpp
@@ -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"

0 comments on commit d082db6

Please sign in to comment.
You can’t perform that action at this time.