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