QGIS API Documentation  2.99.0-Master (5b186ae)
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 "qgis_core.h"
20 #include <QDir>
21 #include <QString>
22 class QImage;
23 
29 class CORE_EXPORT QgsRasterChecker
30 {
31  public:
32 
34 
35  QString report() { return mReport; }
36 
44  bool runTest( const QString &verifiedKey, QString verifiedUri,
45  const QString &expectedKey, QString expectedUri );
46  private:
47  QString mReport;
48  QString mExpectedUri;
49  QString mCheckedUri;
50  QString mTabStyle;
51  QString mCellStyle;
52  QString mOkStyle;
53  QString mErrStyle;
54  QString mErrMsgStyle;
55 
56  // Log error in html
57  void error( const QString &message, QString &report );
58  // compare values and add table row in html report, set ok to false if not equal
59  QString compareHead();
60  bool compare( double verifiedVal, double expectedVal, double tolerance );
61  void compare( const QString &paramName, int verifiedVal, int expectedVal, QString &report, bool &ok );
62  void compare( const QString &paramName, double verifiedVal, double expectedVal, QString &report, bool &ok, double tolerance = 0 );
63  void compareRow( const QString &paramName, const QString &verifiedVal, const QString &expectedVal, QString &report, bool ok, const QString &difference = "", const QString &tolerance = "" );
64  double tolerance( double val, int places = 6 );
65 }; // class QgsRasterChecker
66 
67 #endif
This is a helper class for unit tests that need to write an image and compare it to an expected resul...