QGIS API Documentation  3.20.0-Odense (decaadbb31)
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 "qgis.h"
21 
22 #include <QDir>
23 #include <QString>
24 class QImage;
25 
32 class CORE_EXPORT QgsRasterChecker
33 {
34  public:
35 
37 
38  QString report() { return mReport; }
39 
47  bool runTest( const QString &verifiedKey, QString verifiedUri,
48  const QString &expectedKey, QString expectedUri );
49  private:
50  QString mReport;
51  QString mExpectedUri;
52  QString mCheckedUri;
53  QString mTabStyle;
54  QString mCellStyle;
55  QString mOkStyle;
56  QString mErrStyle;
57  QString mErrMsgStyle;
58 
59  // Log error in html
60  void error( const QString &message, QString &report );
61  // compare values and add table row in html report, set ok to false if not equal
62  QString compareHead();
63  bool compare( double verifiedVal, double expectedVal, double tolerance );
64  void compare( const QString &paramName, int verifiedVal, int expectedVal, QString &report, bool &ok );
65 
66 #ifndef SIP_RUN
67 
73  void compare( const QString &paramName, Qgis::DataType verifiedVal, Qgis::DataType expectedVal, QString &report, bool &ok );
74 #endif
75 
76  void compare( const QString &paramName, double verifiedVal, double expectedVal, QString &report, bool &ok, double tolerance = 0 );
77  void compareRow( const QString &paramName, const QString &verifiedVal, const QString &expectedVal, QString &report, bool ok, const QString &difference = QString(), const QString &tolerance = QString() );
78  double tolerance( double val, int places = 6 );
79 }; // class QgsRasterChecker
80 
81 // clazy:excludeall=qstring-allocations
82 
83 #endif
DataType
Raster data types.
Definition: qgis.h:119
This is a helper class for unit tests that need to write an image and compare it to an expected resul...