-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2517b56
commit c42f162
Showing
5 changed files
with
246 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
tests/src/core/testqgsrasterdataprovidertemporalcapabilities.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
/*************************************************************************** | ||
testqgsrasterdataprovidertemporalcapabilities.cpp | ||
--------------- | ||
begin : February 2020 | ||
copyright : (C) 2020 by Samweli Mwakisambwe | ||
email : samweli at kartoza dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgstest.h" | ||
#include <QObject> | ||
|
||
//qgis includes... | ||
#include <qgsrasterdataprovidertemporalcapabilities.h> | ||
|
||
/** | ||
* \ingroup UnitTests | ||
* This is a unit test for the QgsRasterDataProviderTemporalCapabilities class. | ||
*/ | ||
class TestQgsRasterDataProviderTemporalCapabilities : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
TestQgsRasterDataProviderTemporalCapabilities() = default; | ||
|
||
private slots: | ||
void initTestCase();// will be called before the first testfunction is executed. | ||
void cleanupTestCase();// will be called after the last testfunction was executed. | ||
void init(); // will be called before each testfunction is executed. | ||
void cleanup(); // will be called after every testfunction. | ||
|
||
void checkActiveStatus(); | ||
void checkTemporalRange(); | ||
void checkReferenceTemporalRange(); | ||
|
||
private: | ||
QgsRasterDataProviderTemporalCapabilities *temporalCapabilities = nullptr; | ||
}; | ||
|
||
void TestQgsRasterDataProviderTemporalCapabilities::initTestCase() | ||
{ | ||
// | ||
// Runs once before any tests are run | ||
// | ||
// init QGIS's paths - true means that all path will be inited from prefix | ||
QgsApplication::init(); | ||
QgsApplication::initQgis(); | ||
QgsApplication::showSettings(); | ||
|
||
} | ||
|
||
void TestQgsRasterDataProviderTemporalCapabilities::init() | ||
{ | ||
//create some objects that will be used in all tests... | ||
//create a temporal object that will be used in all tests... | ||
|
||
temporalCapabilities = new QgsRasterDataProviderTemporalCapabilities( true ); | ||
} | ||
|
||
void TestQgsRasterDataProviderTemporalCapabilities::cleanup() | ||
{ | ||
} | ||
|
||
void TestQgsRasterDataProviderTemporalCapabilities::cleanupTestCase() | ||
{ | ||
QgsApplication::exitQgis(); | ||
} | ||
|
||
void TestQgsRasterDataProviderTemporalCapabilities::checkActiveStatus() | ||
{ | ||
temporalCapabilities->setIsActive( false ); | ||
QCOMPARE( temporalCapabilities->isActive(), false ); | ||
} | ||
|
||
void TestQgsRasterDataProviderTemporalCapabilities::checkTemporalRange() | ||
{ | ||
QgsDateTimeRange fixedDateTimeRange = QgsDateTimeRange( QDateTime( QDate( 2020, 1, 1 ) ), | ||
QDateTime( QDate( 2020, 12, 31 ) ) ); | ||
QgsDateTimeRange dateTimeRange = QgsDateTimeRange( QDateTime( QDate( 2020, 1, 1 ) ), | ||
QDateTime( QDate( 2020, 3, 1 ) ) ); | ||
|
||
temporalCapabilities->setTemporalRange( dateTimeRange ); | ||
temporalCapabilities->setFixedTemporalRange( fixedDateTimeRange ); | ||
|
||
QCOMPARE( temporalCapabilities->temporalRange(), dateTimeRange ); | ||
QCOMPARE( temporalCapabilities->fixedTemporalRange(), fixedDateTimeRange ); | ||
} | ||
|
||
void TestQgsRasterDataProviderTemporalCapabilities::checkReferenceTemporalRange() | ||
{ | ||
QgsDateTimeRange fixedDateTimeRange = QgsDateTimeRange( QDateTime( QDate( 2020, 1, 1 ) ), | ||
QDateTime( QDate( 2020, 12, 31 ) ) ); | ||
QgsDateTimeRange dateTimeRange = QgsDateTimeRange( QDateTime( QDate( 2020, 1, 1 ) ), | ||
QDateTime( QDate( 2020, 3, 1 ) ) ); | ||
|
||
temporalCapabilities->setReferenceTemporalRange( dateTimeRange ); | ||
temporalCapabilities->setFixedReferenceTemporalRange( fixedDateTimeRange ); | ||
|
||
QCOMPARE( temporalCapabilities->referenceTemporalRange(), dateTimeRange ); | ||
QCOMPARE( temporalCapabilities->fixedReferenceTemporalRange(), fixedDateTimeRange ); | ||
} | ||
|
||
QGSTEST_MAIN( TestQgsRasterDataProviderTemporalCapabilities ) | ||
#include "testqgsrasterdataprovidertemporalcapabilities.moc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters