QGIS API Documentation  2.17.0-Master (0497e4a)
qgsrasterchecker.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsrasterchecker.h - compare two rasters
3  --------------------------------------
4  Date : 5 Sep 2012
5  Copyright : (C) 2012 by Radim Blazek
6  email : radim dot blazek at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #ifndef QGSRASTERCHECKER_H
17 #define QGSRASTERCHECKER_H
18 
19 #include <QDir>
20 #include <QString>
21 #include <qgsmaprenderer.h>
22 class QImage;
23 
29 class CORE_EXPORT QgsRasterChecker
30 {
31  public:
32 
34 
37 
38  QString report() { return mReport; }
46  bool runTest( const QString& theVerifiedKey, QString theVerifiedUri,
47  const QString& theExpectedKey, QString theExpectedUri );
48  private:
49  QString mReport;
50  QString mExpectedUri;
51  QString mCheckedUri;
52  QString mTabStyle;
53  QString mCellStyle;
54  QString mOkStyle;
55  QString mErrStyle;
56  QString mErrMsgStyle;
57 
58  // Log error in html
59  void error( const QString& theMessage, QString &theReport );
60  // compare values and add table row in html report, set ok to false if not equal
61  QString compareHead();
62  bool compare( double verifiedVal, double expectedVal, double theTolerance );
63  void compare( const QString& theParamName, int verifiedVal, int expectedVal, QString &theReport, bool &theOk );
64  void compare( const QString& theParamName, double verifiedVal, double expectedVal, QString &theReport, bool &theOk, double theTolerance = 0 );
65  void compareRow( const QString& theParamName, const QString& verifiedVal, const QString& expectedVal, QString &theReport, bool theOk, const QString& theDifference = "", const QString& theTolerance = "" );
66  double tolerance( double val, int places = 6 );
67 }; // class QgsRasterChecker
68 
69 #endif
This is a helper class for unit tests that need to write an image and compare it to an expected resul...
~QgsRasterChecker()
Destructor.