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
aac6ecc
commit 240f1fe
Showing
4 changed files
with
129 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ADD_SUBDIRECTORY(wms) |
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,61 @@ | ||
##################################################### | ||
# Don't forget to include output directory, otherwise | ||
# the UI file won't be wrapped! | ||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${CMAKE_SOURCE_DIR}/src/core | ||
${CMAKE_SOURCE_DIR}/src/core/geometry | ||
${CMAKE_SOURCE_DIR}/src/core/expression | ||
${CMAKE_SOURCE_DIR}/src/core/dxf | ||
${CMAKE_SOURCE_DIR}/src/core/symbology | ||
${CMAKE_SOURCE_DIR}/src/core/metadata | ||
${CMAKE_BINARY_DIR}/src/core | ||
${CMAKE_SOURCE_DIR}/src/test | ||
${CMAKE_SOURCE_DIR}/src/server | ||
${CMAKE_BINARY_DIR}/src/server | ||
${CMAKE_SOURCE_DIR}/src/server/services/wms | ||
) | ||
|
||
#note for tests we should not include the moc of our | ||
#qtests in the executable file list as the moc is | ||
#directly included in the sources | ||
#and should not be compiled twice. Trying to include | ||
#them in will cause an error at build time | ||
|
||
#No relinking and full RPATH for the install tree | ||
#See: http://www.cmake.org/Wiki/CMake_RPATH_handling#No_relinking_and_full_RPATH_for_the_install_tree | ||
SET(MODULE_WMS_SRCS | ||
${CMAKE_SOURCE_DIR}/src/server/services/wms/qgswmsparameters.cpp) | ||
|
||
MACRO (ADD_QGIS_TEST TESTSRC) | ||
SET (TESTNAME ${TESTSRC}) | ||
STRING(REPLACE "test" "" TESTNAME ${TESTNAME}) | ||
STRING(REPLACE "qgs" "" TESTNAME ${TESTNAME}) | ||
STRING(REPLACE ".cpp" "" TESTNAME ${TESTNAME}) | ||
SET (TESTNAME "qgis_${TESTNAME}test") | ||
ADD_EXECUTABLE(${TESTNAME} ${TESTSRC} ${MODULE_WMS_SRCS}) | ||
SET_TARGET_PROPERTIES(${TESTNAME} PROPERTIES AUTOMOC TRUE) | ||
TARGET_LINK_LIBRARIES(${TESTNAME} | ||
${Qt5Core_LIBRARIES} | ||
${Qt5Xml_LIBRARIES} | ||
${Qt5Svg_LIBRARIES} | ||
${Qt5Test_LIBRARIES} | ||
${PROJ_LIBRARY} | ||
${GEOS_LIBRARY} | ||
${GDAL_LIBRARY} | ||
qgis_core | ||
qgis_server | ||
) | ||
ADD_TEST(${TESTNAME} ${CMAKE_BINARY_DIR}/output/bin/${TESTNAME} -maxwarnings 10000) | ||
ENDMACRO (ADD_QGIS_TEST) | ||
|
||
############################################################# | ||
# Tests: | ||
|
||
SET(TESTS | ||
testqgswmsparameters.cpp | ||
) | ||
|
||
FOREACH(TESTSRC ${TESTS}) | ||
ADD_QGIS_TEST(${TESTSRC}) | ||
ENDFOREACH(TESTSRC) |
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,64 @@ | ||
/*************************************************************************** | ||
testqgswmsparameters.cpp | ||
-------------------------------------- | ||
Date : 20 Mar 2019 | ||
Copyright : (C) 2019 by Paul Blottiere | ||
Email : paul dot blottiere @ oslandia.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 "qgswmsparameters.h" | ||
|
||
/** | ||
* \ingroup UnitTests | ||
* This is a unit test for the WMS parameters parsing | ||
*/ | ||
class TestQgsWmsParameters : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
private slots: | ||
void initTestCase(); | ||
void cleanupTestCase(); | ||
|
||
// fake | ||
void dxfOptions(); | ||
}; | ||
|
||
void TestQgsWmsParameters::initTestCase() | ||
{ | ||
} | ||
|
||
void TestQgsWmsParameters::cleanupTestCase() | ||
{ | ||
} | ||
|
||
void TestQgsWmsParameters::dxfOptions() | ||
{ | ||
const QString key = "FORMAT_OPTIONS"; | ||
const QString value = "MODE:SYMBOLLAYERSYMBOLOGY;SCALE:250;USE_TITLE_AS_LAYERNAME:TRUE;LAYERATTRIBUTES:pif,paf,pouf"; | ||
|
||
QUrlQuery query; | ||
query.addQueryItem( key, value ); | ||
|
||
QgsWms::QgsWmsParameters parameters( query ); | ||
|
||
QCOMPARE( parameters.dxfScale(), 250 ); | ||
QCOMPARE( parameters.dxfUseLayerTitleAsName(), true ); | ||
QCOMPARE( parameters.dxfMode(), QgsDxfExport::SymbolLayerSymbology ); | ||
QCOMPARE( parameters.dxfLayerAttributes().size(), 3 ); | ||
QCOMPARE( parameters.dxfLayerAttributes()[0], "pif" ); | ||
QCOMPARE( parameters.dxfLayerAttributes()[1], "paf" ); | ||
QCOMPARE( parameters.dxfLayerAttributes()[2], "pouf" ); | ||
} | ||
|
||
QGSTEST_MAIN( TestQgsWmsParameters ) | ||
#include "testqgswmsparameters.moc" |