Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Mar 9, 2021
1 parent f12200d commit 9ce2505
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/src/server/wms/test_qgsserver_wms_request.cpp
Expand Up @@ -29,6 +29,7 @@ class TestQgsServerWmsRequest : public QObject
void cleanupTestCase();

void cst();
void update();
};

void TestQgsServerWmsRequest::initTestCase()
Expand Down Expand Up @@ -56,5 +57,32 @@ void TestQgsServerWmsRequest::cst()
QCOMPARE( wmsRequest.wmsParameters().version(), "1.1.1" );
}

void TestQgsServerWmsRequest::update()
{
// init request with parameters
QgsServerRequest request;
request.setParameter( "PARAM_0", "0" );
request.setParameter( "PARAM_1", "1" );

QgsWms::QgsWmsRequest wmsRequest( request );
QCOMPARE( wmsRequest.wmsParameters().value( "PARAM_0" ), "0" );

wmsRequest.setParameter( "PARAM_3", "3" );
QCOMPARE( wmsRequest.wmsParameters().value( "PARAM_3" ), "3" );

// init request by loading a query
QUrl url( "http://qgisserver?PARAM_0=0&PARAM_1=1" );

QgsServerRequest request2( url );

QCOMPARE( request2.serverParameters().value( "PARAM_0" ), "0" );

QgsWms::QgsWmsRequest wmsRequest2( request2 );
QCOMPARE( wmsRequest2.wmsParameters().value( "PARAM_0" ), "0" );

wmsRequest2.setParameter( "PARAM_3", "3" );
QCOMPARE( wmsRequest2.wmsParameters().value( "PARAM_3" ), "3" );
}

QGSTEST_MAIN( TestQgsServerWmsRequest )
#include "test_qgsserver_wms_request.moc"

0 comments on commit 9ce2505

Please sign in to comment.