Skip to content

Commit 39f23eb

Browse files
committedJul 20, 2018
Fix build on Travis
(cherry-picked from 9259d60)
1 parent 237af60 commit 39f23eb

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed
 

‎tests/src/core/testqgsrasterlayer.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,8 @@ void TestQgsRasterLayer::checkStats()
388388
QCOMPARE( mpRasterLayer->width(), 10 );
389389
QCOMPARE( mpRasterLayer->height(), 10 );
390390
//QCOMPARE( myStatistics.elementCount, 100 );
391-
QCOMPARE( myStatistics.minimumValue, 0 );
392-
QCOMPARE( myStatistics.maximumValue, 9 );
391+
QCOMPARE( myStatistics.minimumValue, 0.0 );
392+
QCOMPARE( myStatistics.maximumValue, 9.0 );
393393
QGSCOMPARENEAR( myStatistics.mean, 4.5, 4 * std::numeric_limits<double>::epsilon() );
394394
double stdDev = 2.87228132326901431;
395395
// TODO: verify why GDAL stdDev is so different from generic (2.88675)
@@ -402,37 +402,37 @@ void TestQgsRasterLayer::checkStats()
402402
QgsRasterBandStats::Min | QgsRasterBandStats::Max |
403403
QgsRasterBandStats::Mean | QgsRasterBandStats::StdDev, QgsRectangle( 1535400, 5083280, 1535450, 5083320 ) );
404404

405-
QCOMPARE( myStatistics.minimumValue, 2 );
406-
QCOMPARE( myStatistics.maximumValue, 7 );
405+
QCOMPARE( myStatistics.minimumValue, 2.0 );
406+
QCOMPARE( myStatistics.maximumValue, 7.0 );
407407
QGSCOMPARENEAR( myStatistics.mean, 4.5, 4 * std::numeric_limits<double>::epsilon() );
408408
QGSCOMPARENEAR( myStatistics.stdDev, 1.507557, 0.00001 );
409409

410410
// with sample size
411411
myStatistics = mpRasterLayer->dataProvider()->bandStatistics( 1,
412412
QgsRasterBandStats::Min | QgsRasterBandStats::Max |
413413
QgsRasterBandStats::Mean | QgsRasterBandStats::StdDev, QgsRectangle( 1535400, 5083280, 1535450, 5083320 ), 10 );
414-
QCOMPARE( myStatistics.minimumValue, 2 );
415-
QCOMPARE( myStatistics.maximumValue, 7 );
416-
QCOMPARE( myStatistics.elementCount, 12 );
414+
QCOMPARE( myStatistics.minimumValue, 2.0 );
415+
QCOMPARE( myStatistics.maximumValue, 7.0 );
416+
QCOMPARE( myStatistics.elementCount, 12ULL );
417417
QGSCOMPARENEAR( myStatistics.mean, 4.5, 4 * std::numeric_limits<double>::epsilon() );
418418
QGSCOMPARENEAR( myStatistics.stdDev, 2.153222, 0.00001 );
419419

420420
// extremely limited extent - ~1 px size
421421
myStatistics = mpRasterLayer->dataProvider()->bandStatistics( 1,
422422
QgsRasterBandStats::Min | QgsRasterBandStats::Max |
423423
QgsRasterBandStats::Mean | QgsRasterBandStats::StdDev, QgsRectangle( 1535400, 5083280, 1535412, 5083288 ) );
424-
QCOMPARE( myStatistics.minimumValue, 2 );
425-
QCOMPARE( myStatistics.maximumValue, 3 );
424+
QCOMPARE( myStatistics.minimumValue, 2.0 );
425+
QCOMPARE( myStatistics.maximumValue, 3.0 );
426426
QGSCOMPARENEAR( myStatistics.mean, 2.600000, 4 * std::numeric_limits<double>::epsilon() );
427427
QGSCOMPARENEAR( myStatistics.stdDev, 0.492366, 0.00001 );
428428

429429
// extremely limited extent - ~1 px size - with sample size
430430
myStatistics = mpRasterLayer->dataProvider()->bandStatistics( 1,
431431
QgsRasterBandStats::Min | QgsRasterBandStats::Max |
432432
QgsRasterBandStats::Mean | QgsRasterBandStats::StdDev, QgsRectangle( 1535400, 5083280, 1535412, 5083288 ), 6 );
433-
QCOMPARE( myStatistics.minimumValue, 2 );
434-
QCOMPARE( myStatistics.maximumValue, 3 );
435-
QCOMPARE( myStatistics.elementCount, 2 );
433+
QCOMPARE( myStatistics.minimumValue, 2.0 );
434+
QCOMPARE( myStatistics.maximumValue, 3.0 );
435+
QCOMPARE( myStatistics.elementCount, 2ULL );
436436
QGSCOMPARENEAR( myStatistics.mean, 2.500000, 4 * std::numeric_limits<double>::epsilon() );
437437
QGSCOMPARENEAR( myStatistics.stdDev, 0.707107, 0.00001 );
438438
}

0 commit comments

Comments
 (0)
Please sign in to comment.