Skip to content

Commit

Permalink
fix TestQgsHttpheaders::createQgsOwsConnection to work with QT 5 and 6
Browse files Browse the repository at this point in the history
For different Versions of QT (5, 6) QUrlQuery produces either "url" or "url="
  • Loading branch information
cioddi committed Jan 4, 2025
1 parent 8851665 commit 762ade6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/src/core/testqgshttpheaders.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,13 @@ void TestQgsHttpheaders::createQgsOwsConnection()
QgsHttpHeaders h( QVariantMap( { { QgsHttpHeaders::KEY_REFERER, "http://test.com" }, { "other_http_header", "value" } } ) );
QgsOwsConnection::settingsHeaders->setValue( h.headers(), { "service", "name" } );

// for different Versions of QT (5, 6) QUrlQuery produces either "url" or "url="
QUrlQuery testUrlParam;
testUrlParam.addQueryItem( QStringLiteral( "url" ), "" );

QgsOwsConnection ows( "service", "name" );
QCOMPARE( ows.connectionInfo(), ",authcfg=,referer=http://test.com" );
QCOMPARE( ows.uri().encodedUri(), "url&http-header:other_http_header=value&http-header:referer=http://test.com" );
QCOMPARE( ows.uri().encodedUri(), testUrlParam.toString() + "&http-header:other_http_header=value&http-header:referer=http://test.com" );

QgsDataSourceUri uri( QString( "https://www.ogc.org/?p1=v1" ) );
QgsDataSourceUri uri2 = ows.addWmsWcsConnectionSettings( uri, "service", "name" );
Expand Down

0 comments on commit 762ade6

Please sign in to comment.