testqgswmsprovider17866.cpp
| 1 |
/***************************************************************************
|
|---|---|
| 2 |
testqgswmsprovider.cpp
|
| 3 |
---------------------
|
| 4 |
begin : Jan 2018
|
| 5 |
copyright : (C) 2018 by Alessandro Pasotti
|
| 6 |
email : elpaso at itopen dot it
|
| 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 |
#include <QFile> |
| 16 |
#include <QObject> |
| 17 |
#include <QAbstractNetworkCache> |
| 18 |
|
| 19 |
#include "qgstest.h" |
| 20 |
#include "qgswmsprovider.h" |
| 21 |
#include "qgsapplication.h" |
| 22 |
#include "qgsnetworkaccessmanager.h" |
| 23 |
#include "qgsrasterlayer.h" |
| 24 |
|
| 25 |
/**
|
| 26 |
* \ingroup UnitTests
|
| 27 |
* This is a unit test for the WMS provider.
|
| 28 |
*/
|
| 29 |
class TestQgsWmsProvider17866: public QObject |
| 30 |
{
|
| 31 |
Q_OBJECT |
| 32 |
private slots:
|
| 33 |
|
| 34 |
void initTestCase()
|
| 35 |
{
|
| 36 |
QgsApplication::initQgis(); |
| 37 |
QgsNetworkAccessManager::instance()->cache()->clear(); |
| 38 |
} |
| 39 |
|
| 40 |
//runs after all tests
|
| 41 |
void cleanupTestCase()
|
| 42 |
{
|
| 43 |
QgsApplication::exitQgis(); |
| 44 |
} |
| 45 |
|
| 46 |
void testGetCapabilities()
|
| 47 |
{
|
| 48 |
QgsRasterLayer layer( QStringLiteral( "contextualWMSLegend=0&crs=EPSG:4326&dpiMode=7&featureCount=10&format=image/jpeg"
|
| 49 |
"&layers=s2cloudless&styles&tileMatrixSet=s2cloudless-wmsc-14"
|
| 50 |
"&url=http://tiles.maps.eox.at/wms?" ),
|
| 51 |
QStringLiteral( "mywms" ),
|
| 52 |
QStringLiteral( "wms" ));
|
| 53 |
QVERIFY(layer.isValid()); |
| 54 |
} |
| 55 |
|
| 56 |
}; |
| 57 |
|
| 58 |
QGSTEST_MAIN( TestQgsWmsProvider17866 ) |
| 59 |
#include "testqgswmsprovider17866.moc" |
| 60 |
|