diff --git a/OSMScout2/CMakeLists.txt b/OSMScout2/CMakeLists.txt index b6b0bb9e6..e03262dc9 100644 --- a/OSMScout2/CMakeLists.txt +++ b/OSMScout2/CMakeLists.txt @@ -69,6 +69,8 @@ set_property(SOURCE qrc_res.cpp PROPERTY SKIP_AUTOMOC ON) add_executable(OSMScout2 ${SOURCE_FILES} ${HEADER_FILES} ${RESOURCE_FILES}) +target_include_directories(OSMScout2 PRIVATE "src") + target_sources(OSMScout2 PRIVATE ${TRANSLATION_TS_FILES} ${TRANSLATION_QM_FILES}) target_link_libraries(OSMScout2 @@ -100,7 +102,11 @@ if (QT_QML_DEBUG) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG") endif() -set_target_properties(OSMScout2 PROPERTIES VERSION ${OSMSCOUT_LIBRARY_VERSION} SOVERSION ${OSMSCOUT_LIBRARY_VERSION} FOLDER "Tools") +set_target_properties(OSMScout2 + PROPERTIES + VERSION ${OSMSCOUT_LIBRARY_VERSION} + SOVERSION ${OSMSCOUT_LIBRARY_VERSION} + FOLDER "Tools") if(WIN32) create_win32_tool_resource(OSMScout2) @@ -116,7 +122,10 @@ if(OSMSCOUT_INSTALL_QT_DLL AND TARGET Qt5::windeployqt) ) endif() -install(TARGETS OSMScout2 RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) +install(TARGETS OSMScout2 + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) # install QM files to correct location - QStandardPaths::AppDataLocation / "translations" if(APPLE) diff --git a/OSMScout2/src/AppSettings.cpp b/OSMScout2/src/AppSettings.cpp index 9e446989a..e37496ee8 100644 --- a/OSMScout2/src/AppSettings.cpp +++ b/OSMScout2/src/AppSettings.cpp @@ -22,7 +22,7 @@ #include #include -#include "AppSettings.h" +#include using namespace osmscout; diff --git a/OSMScout2/src/OSMScout.cpp b/OSMScout2/src/OSMScout.cpp index cedbc731f..adfe03244 100644 --- a/OSMScout2/src/OSMScout.cpp +++ b/OSMScout2/src/OSMScout.cpp @@ -32,9 +32,9 @@ #include // Application theming -#include "Theme.h" +#include -#include "AppSettings.h" +#include #include #include diff --git a/OSMScout2/src/Theme.cpp b/OSMScout2/src/Theme.cpp index 1d836fcd1..aeb353da2 100644 --- a/OSMScout2/src/Theme.cpp +++ b/OSMScout2/src/Theme.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "Theme.h" +#include #include #include diff --git a/StyleEditor/CMakeLists.txt b/StyleEditor/CMakeLists.txt index 3be3823e9..ee471fafc 100644 --- a/StyleEditor/CMakeLists.txt +++ b/StyleEditor/CMakeLists.txt @@ -39,6 +39,8 @@ set(RESOURCE_FILES add_executable(StyleEditor ${SOURCE_FILES} ${HEADER_FILES} ${RESOURCE_FILES}) +target_include_directories(StyleEditor PRIVATE "src") + target_link_libraries(StyleEditor OSMScout::OSMScout OSMScout::Map @@ -64,7 +66,11 @@ if (QT_QML_DEBUG) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQT_QML_DEBUG") endif() -set_target_properties(StyleEditor PROPERTIES VERSION ${OSMSCOUT_LIBRARY_VERSION} SOVERSION ${OSMSCOUT_LIBRARY_VERSION} FOLDER "Tools") +set_target_properties(StyleEditor + PROPERTIES + VERSION ${OSMSCOUT_LIBRARY_VERSION} + SOVERSION ${OSMSCOUT_LIBRARY_VERSION} + FOLDER "Tools") if(WIN32) create_win32_tool_resource(StyleEditor) diff --git a/StyleEditor/src/FileIO.cpp b/StyleEditor/src/FileIO.cpp index 94684c95e..0d37b9d92 100644 --- a/StyleEditor/src/FileIO.cpp +++ b/StyleEditor/src/FileIO.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "FileIO.h" +#include #include diff --git a/StyleEditor/src/FileIO.h b/StyleEditor/src/FileIO.h index c217ef000..004d09136 100644 --- a/StyleEditor/src/FileIO.h +++ b/StyleEditor/src/FileIO.h @@ -25,8 +25,8 @@ #include #include -#include "Highlighter.h" -#include "StyleAnalyser.h" +#include +#include #define TMP_SUFFIX ".tmp" diff --git a/StyleEditor/src/Highlighter.cpp b/StyleEditor/src/Highlighter.cpp index 7677d2844..6416853ca 100644 --- a/StyleEditor/src/Highlighter.cpp +++ b/StyleEditor/src/Highlighter.cpp @@ -17,9 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "Highlighter.h" +#include #include -#include Highlighter::Highlighter(QTextDocument *parent) : QSyntaxHighlighter(parent) diff --git a/StyleEditor/src/MainWindow.cpp b/StyleEditor/src/MainWindow.cpp index 120858ee3..6190d4028 100644 --- a/StyleEditor/src/MainWindow.cpp +++ b/StyleEditor/src/MainWindow.cpp @@ -17,12 +17,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "MainWindow.h" +#include #include #include -#include "SettingsDialog.h" +#include using namespace osmscout; diff --git a/StyleEditor/src/SettingsDialog.cpp b/StyleEditor/src/SettingsDialog.cpp index 0591d8aa5..a4cf3a943 100644 --- a/StyleEditor/src/SettingsDialog.cpp +++ b/StyleEditor/src/SettingsDialog.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "SettingsDialog.h" +#include /* #include diff --git a/StyleEditor/src/StyleAnalyser.cpp b/StyleEditor/src/StyleAnalyser.cpp index e633fd773..9eea18db3 100644 --- a/StyleEditor/src/StyleAnalyser.cpp +++ b/StyleEditor/src/StyleAnalyser.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "StyleAnalyser.h" +#include #include #include diff --git a/StyleEditor/src/StyleAnalyser.h b/StyleEditor/src/StyleAnalyser.h index ab48b1721..c3f5beb58 100644 --- a/StyleEditor/src/StyleAnalyser.h +++ b/StyleEditor/src/StyleAnalyser.h @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "Highlighter.h" +#include #include diff --git a/StyleEditor/src/StyleEditor.cpp b/StyleEditor/src/StyleEditor.cpp index 51ea3870b..27d10623b 100644 --- a/StyleEditor/src/StyleEditor.cpp +++ b/StyleEditor/src/StyleEditor.cpp @@ -29,10 +29,10 @@ #include // Main Window -#include "MainWindow.h" +#include // Custom QML objects -#include "FileIO.h" +#include using namespace osmscout; diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5657a799a..1f6e0ba97 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -93,6 +93,10 @@ endif() #---- Geometry osmscout_test_project(NAME Geometry SOURCES src/Geometry.cpp) +#---- HeaderCheck +osmscout_test_project(NAME HeaderCheck SOURCES src/HeaderCheck.cpp) +set_tests_properties(HeaderCheck PROPERTIES ENVIRONMENT "SOURCE_ROOT=${CMAKE_SOURCE_DIR}") + #---- WaterIndex if(${OSMSCOUT_BUILD_IMPORT} AND TARGET OSMScout::Import) osmscout_test_project(NAME WaterIndex SOURCES src/WaterIndex.cpp TARGET OSMScout::Import) diff --git a/Tests/meson.build b/Tests/meson.build index a0bf54318..06c97ec3b 100644 --- a/Tests/meson.build +++ b/Tests/meson.build @@ -10,6 +10,8 @@ AccessParse = executable('AccessParse', install: true, install_dir: testInstallDir) +test('Check parsing of access rights', AccessParse) + AsyncProcessing = executable('AsyncProcessing', 'src/AsyncProcessing.cpp', include_directories: [osmscoutIncDir], @@ -26,6 +28,8 @@ TimeParse = executable('TimeParse', install: true, install_dir: testInstallDir) +test('Check parsing of time string', TimeParse) + Bearing = executable('Bearing', 'src/Bearing.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -34,6 +38,8 @@ Bearing = executable('Bearing', install: true, install_dir: testInstallDir) +test('Check calculation of bearing', Bearing) + BitsAndBytesNeeded = executable('BitsAndBytesNeeded', 'src/BitsAndBytesNeeded.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -42,6 +48,8 @@ BitsAndBytesNeeded = executable('BitsAndBytesNeeded', install: true, install_dir: testInstallDir) +test('Check encoding of numbers', BitsAndBytesNeeded) + ByteTest = executable('ByteTest', 'src/ByteTest.cpp', include_directories: [testIncDir], @@ -49,6 +57,8 @@ ByteTest = executable('ByteTest', install: true, install_dir: testInstallDir) +test('Check std_byte behaviour', ByteTest) + CachePerformance = executable('CachePerformance', 'src/CachePerformance.cpp', include_directories: [osmscoutIncDir], @@ -57,6 +67,8 @@ CachePerformance = executable('CachePerformance', install: true, install_dir: testInstallDir) +test('Check cache functionality with CachePerformance', CachePerformance, args : ['--size', '1000']) + CalculateResolution = executable('CalculateResolution', 'src/CalculateResolution.cpp', include_directories: [osmscoutIncDir], @@ -65,6 +77,8 @@ CalculateResolution = executable('CalculateResolution', install: true, install_dir: testInstallDir) +test('Check position accuracy with coordinate bits', CalculateResolution) + CmdLineParsing = executable('CmdLineParsing', 'src/CmdLineParsing.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -73,6 +87,8 @@ CmdLineParsing = executable('CmdLineParsing', install: true, install_dir: testInstallDir) +test('Check parsing of command line args', CmdLineParsing) + ColorParse = executable('ColorParse', 'src/ColorParse.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -81,6 +97,8 @@ ColorParse = executable('ColorParse', install: true, install_dir: testInstallDir) +test('Check parsing of colors', ColorParse) + CoordinateEncoding = executable('CoordinateEncoding', 'src/CoordinateEncoding.cpp', include_directories: [osmscoutIncDir], @@ -89,6 +107,8 @@ CoordinateEncoding = executable('CoordinateEncoding', install: true, install_dir: testInstallDir) +test('Check parsing of ways.dat', CoordinateEncoding, args : [meson.current_source_dir() + '/data/testregion']) + if buildMapQt if get_option('qtVersion') == 5 drawtextMocs = qt5.preprocess(moc_headers : ['include/DrawWindow.h']) @@ -123,6 +143,8 @@ EncodeNumber = executable('EncodeNumber', install: true, install_dir: testInstallDir) +test('Check encoding of numbers', EncodeNumber) + FeatureLabelTest = executable('FeatureLabelTest', 'src/FeatureLabelTest.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -131,6 +153,8 @@ FeatureLabelTest = executable('FeatureLabelTest', install: true, install_dir: testInstallDir) +test('Check label formatting', FeatureLabelTest) + File = executable('File', 'src/File.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -139,6 +163,8 @@ File = executable('File', install: true, install_dir: testInstallDir) +test('Check File utilities', File) + FileScannerWriter = executable('FileScannerWriter', 'src/FileScannerWriter.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -147,6 +173,8 @@ FileScannerWriter = executable('FileScannerWriter', install: true, install_dir: testInstallDir) +test('Check File access implementation', FileScannerWriter) + GeoBox = executable('GeoBox', 'src/GeoBox.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -155,6 +183,8 @@ GeoBox = executable('GeoBox', install: true, install_dir: testInstallDir) +test('Check handling of geo box intersection', GeoBox) + GeoCoordParse = executable('GeoCoordParse', 'src/GeoCoordParse.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -163,6 +193,8 @@ GeoCoordParse = executable('GeoCoordParse', install: true, install_dir: testInstallDir) +test('Check parsing of geo coordinates', GeoCoordParse) + Geometry = executable('Geometry', 'src/Geometry.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -171,6 +203,21 @@ Geometry = executable('Geometry', install: true, install_dir: testInstallDir) +test('Check impl. of geometric functions', Geometry) + +headerCheckEnv = environment() +headerCheckEnv.set('SOURCE_ROOT', meson.project_source_root()) + +HeaderCheck = executable('HeaderCheck', + 'src/HeaderCheck.cpp', + include_directories: [testIncDir, osmscoutIncDir], + dependencies: [mathDep, openmpDep], + link_with: [osmscout], + install: true, + install_dir: testInstallDir) + +test('Check use of \'<\'...\'>\' for includes', HeaderCheck, env: headerCheckEnv) + if buildImport LocationServiceTest = executable('LocationServiceTest', [ @@ -194,6 +241,12 @@ MapRotate = executable('MapRotate', install: true, install_dir: testInstallDir) +if (compiler.get_id()=='gcc' and target_machine.system()=='windows') + warning('Test "Check rotation of maps" does not run under MSYS because of missing locale support') +else + test('Check rotation of maps', MapRotate) +endif + MercatorProjection = executable('MercatorProjection', 'src/MercatorProjection.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -202,6 +255,8 @@ MercatorProjection = executable('MercatorProjection', install: true, install_dir: testInstallDir) +test('Check MercatorProjection', MercatorProjection) + MultiDBRouting = executable('MultiDBRouting', 'src/MultiDBRouting.cpp', include_directories: [osmscoutIncDir], @@ -210,6 +265,8 @@ MultiDBRouting = executable('MultiDBRouting', install: true, install_dir: testInstallDir) +test('Check routing', MultiDBRouting, args : ['50.412', '14.534', '50.424', '14.6013', meson.current_source_dir() + '/data/testregion']) + NumberSet = executable('NumberSet', 'src/NumberSet.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -218,6 +275,8 @@ NumberSet = executable('NumberSet', install: true, install_dir: testInstallDir) +test('Check correctness of NumberSet class', NumberSet) + NumberSetPerformance = executable('NumberSetPerformance', 'src/NumberSetPerformance.cpp', include_directories: [osmscoutIncDir], @@ -226,6 +285,8 @@ NumberSetPerformance = executable('NumberSetPerformance', install: true, install_dir: testInstallDir) +test('Check number set performance', NumberSetPerformance, timeout: 180) + OpeningHours = executable('OpeningHours', 'src/OpeningHours.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -234,6 +295,8 @@ OpeningHours = executable('OpeningHours', install: true, install_dir: testInstallDir) +test('Check parsing of opening hours', OpeningHours) + OSTAndOSSCheck = executable('OSTAndOSSCheck', 'src/OSTAndOSSCheck.cpp', include_directories: [osmscoutmapIncDir, osmscoutIncDir], @@ -306,6 +369,8 @@ ReaderScannerPerformance = executable('ReaderScannerPerformance', install: true, install_dir: testInstallDir) +test('Check reader scanner performance', ReaderScannerPerformance, args : [meson.current_source_dir() + '/data/testregion']) + ScanConversion = executable('ScanConversion', 'src/ScanConversion.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -314,6 +379,8 @@ ScanConversion = executable('ScanConversion', install: true, install_dir: testInstallDir) +test('Check scan conversion code', ScanConversion) + ScreenBox = executable('ScreenBox', 'src/ScreenBox.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -322,6 +389,8 @@ ScreenBox = executable('ScreenBox', install: true, install_dir: testInstallDir) +test('Check ScreenBox functionality', ScreenBox) + StdByteTest = executable('StdByteTest', 'src/StdByteTest.cpp', include_directories: [testIncDir], @@ -337,6 +406,8 @@ StringUtils = executable('StringUtils', install: true, install_dir: testInstallDir) +test('Check string utils', StringUtils) + ThreadedDatabase = executable('ThreadedDatabase', 'src/ThreadedDatabase.cpp', include_directories: [osmscoutmapIncDir, osmscoutIncDir], @@ -345,6 +416,12 @@ ThreadedDatabase = executable('ThreadedDatabase', install: true, install_dir: testInstallDir) +test('Check threaded database', ThreadedDatabase, args : [ + '--threads', '100', + '--iterations', '1000', + meson.current_source_dir() + '/data/testregion', + meson.current_source_dir() + '/../stylesheets/standard.oss']) + SunriseSunset = executable('SunriseSunset', 'src/SunriseSunsetTest.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -353,6 +430,8 @@ SunriseSunset = executable('SunriseSunset', install: true, install_dir: testInstallDir) +test('Check SunriseSunset utility', SunriseSunset) + PolygonCenter = executable('PolygonCenter', 'src/PolygonCenter.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -361,6 +440,8 @@ PolygonCenter = executable('PolygonCenter', install: true, install_dir: testInstallDir) +test('Check PolygonCenter utility', PolygonCenter) + TilingTest = executable('TilingTest', 'src/TilingTest.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -369,6 +450,8 @@ TilingTest = executable('TilingTest', install: true, install_dir: testInstallDir) +test('Check tiling calculation code', TilingTest) + TransPolygon = executable('TransPolygon', 'src/TransPolygon.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -377,6 +460,8 @@ TransPolygon = executable('TransPolygon', install: true, install_dir: testInstallDir) +test('Check polygon transformation code', TransPolygon) + WaterIndex = executable('WaterIndex', 'src/WaterIndex.cpp', include_directories: [testIncDir, osmscoutIncDir, osmscoutimportIncDir], @@ -385,6 +470,8 @@ WaterIndex = executable('WaterIndex', install: true, install_dir: testInstallDir) +test('Check water index import code', WaterIndex) + WorkQueue = executable('WorkQueue', 'src/WorkQueue.cpp', include_directories: [osmscoutIncDir], @@ -393,6 +480,8 @@ WorkQueue = executable('WorkQueue', install: true, install_dir: testInstallDir) +test('Check implementation of work queue', WorkQueue) + WStringStringConversion = executable('WStringStringConversion', 'src/WStringStringConversion.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -401,6 +490,8 @@ WStringStringConversion = executable('WStringStringConversion', install: true, install_dir: testInstallDir) +test('Check WString<=>String conversion code', WStringStringConversion) + LabelPathTest = executable('LabelPathTest', 'src/LabelPathTest.cpp', include_directories: [testIncDir, osmscoutmapIncDir, osmscoutIncDir], @@ -409,6 +500,8 @@ LabelPathTest = executable('LabelPathTest', install: true, install_dir: testInstallDir) +test('Check LabelPath code', LabelPathTest) + Base64Test = executable('Base64Test', 'src/Base64.cpp', include_directories: [testIncDir, osmscoutIncDir], @@ -417,6 +510,8 @@ Base64Test = executable('Base64Test', install: true, install_dir: testInstallDir) +test('Check Base64 code', Base64Test) + CoordBufferTest = executable('CoordBufferTest', 'src/CoordBufferTest.cpp', include_directories: [testIncDir, osmscoutmapIncDir, osmscoutIncDir], @@ -425,6 +520,8 @@ CoordBufferTest = executable('CoordBufferTest', install: true, install_dir: testInstallDir) +test('Check coordinate buffer conversions', CoordBufferTest) + if marisaDep.found() TextLookupTest = executable('TextLookupTest', 'src/TextLookupTest.cpp', @@ -433,80 +530,26 @@ if marisaDep.found() link_with: [osmscout], install: true, install_dir: testInstallDir) -endif -ostandossEnv = environment() + test('Check text lookup - vysoka', TextLookupTest, args : [ + '--expected-results', '5', + meson.current_source_dir() + '/data/testregion', + 'vysoka']) -ostandossEnv.set('TESTS_TOP_DIR', meson.current_source_dir()) - -test('Check parsing of access rights', AccessParse) -test('Check Base64 code', Base64Test) -test('Check calculation of bearing', Bearing) -test('Check encoding of numbers', BitsAndBytesNeeded) -test('Check std_byte behaviour', ByteTest) -test('Check cache functionality with CachePerformance', CachePerformance, args : ['--size', '1000']) -test('Check position accuracy with coordinate bits', CalculateResolution) -test('Check parsing of command line args', CmdLineParsing) -test('Check parsing of colors', ColorParse) -test('Check coordinate buffer conversions', CoordBufferTest) -test('Check parsing of opening hours', OpeningHours) -test('Check parsing of ways.dat', CoordinateEncoding, args : [meson.current_source_dir() + '/data/testregion']) -test('Check encoding of numbers', EncodeNumber) -test('Check label formatting', FeatureLabelTest) -test('Check File utilities', File) -test('Check File access implementation', FileScannerWriter) -test('Check handling of geo box intersection', GeoBox) -test('Check parsing of geo coordinates', GeoCoordParse) -test('Check impl. of geometric functions', Geometry) -if (compiler.get_id()=='gcc' and target_machine.system()=='windows') - warning('Test "Check rotation of maps" does not run under MSYS because of missing locale support') -else - test('Check rotation of maps', MapRotate) -endif -test('Check MercatorProjection', MercatorProjection) -test('Check routing', MultiDBRouting, args : ['50.412', '14.534', '50.424', '14.6013', meson.current_source_dir() + '/data/testregion']) -test('Check correctness of NumberSet class', NumberSet) -test('Check number set performance', NumberSetPerformance, timeout: 180) -test('Check PolygonCenter utility', PolygonCenter) -test('Check reader scanner performance', ReaderScannerPerformance, args : [meson.current_source_dir() + '/data/testregion']) -test('Check scan conversion code', ScanConversion) -test('Check ScreenBox functionality', ScreenBox) -test('Check string utils', StringUtils) -test('Check tiling calculation code', TilingTest) -test('Check polygon transformation code', TransPolygon) -test('Check water index import code', WaterIndex) -test('Check implementation of work queue', WorkQueue) -test('Check WString<=>String conversion code', WStringStringConversion) -test('Check threaded database', ThreadedDatabase, args : [ - '--threads', '100', - '--iterations', '1000', - meson.current_source_dir() + '/data/testregion', - meson.current_source_dir() + '/../stylesheets/standard.oss']) + test('Check text lookup - Vysoká', TextLookupTest, args : [ + '--expected-results', '5', + meson.current_source_dir() + '/data/testregion', + 'Vysoká']) -if marisaDep.found() - test('Check text lookup - vysoka', TextLookupTest, args : [ - '--expected-results', '5', - meson.current_source_dir() + '/data/testregion', - 'vysoka']) - - test('Check text lookup - Vysoká', TextLookupTest, args : [ - '--expected-results', '5', - meson.current_source_dir() + '/data/testregion', - 'Vysoká']) - - test('Check text lookup - bosyne', TextLookupTest, args : [ - '--expected-results', '1', - meson.current_source_dir() + '/data/testregion', - 'bosyne']) + test('Check text lookup - bosyne', TextLookupTest, args : [ + '--expected-results', '1', + meson.current_source_dir() + '/data/testregion', + 'bosyne']) endif -test('Check SunriseSunset utility', SunriseSunset) -test('Check parsing of time string', TimeParse) - - -test('Check LabelPath code', LabelPathTest) - if buildImport + ostandossEnv = environment() + ostandossEnv.set('TESTS_TOP_DIR', meson.current_source_dir()) test('Check LocationService', LocationServiceTest, env: ostandossEnv) endif diff --git a/Tests/src/HeaderCheck.cpp b/Tests/src/HeaderCheck.cpp new file mode 100644 index 000000000..eacc4903a --- /dev/null +++ b/Tests/src/HeaderCheck.cpp @@ -0,0 +1,107 @@ +#include + +#include +#include + +namespace fs = std::filesystem; + +std::list getFiles(const fs::path& directory, const std::string& extension) +{ + std::list files; + + if (exists(directory)) { + for (auto const &entry: fs::recursive_directory_iterator(directory)) { + if (entry.exists() && entry.is_regular_file() && entry.path().extension() == extension) { + files.push_back(entry.path()); + } + } + } + + return files; +} + +std::list getIncludes(const fs::path& filename) +{ + std::list includes; + std::regex include("#include *[<\"][a-zA-Z0-9/.]+[>\"]"); + + std::string line; + std::ifstream file (filename); + if (file.is_open()) { + while (getline(file, line)) { + std::smatch match; + if (std::regex_search(line,match,include)) { + includes.push_back(match[0]); + } + } + file.close(); + } + + return includes; +} + +TEST_CASE("Check format of includes") +{ + std::list projects{ + "libosmscout/", + "libosmscout-client/", + "libosmscout-client-qt/", + "libosmscout-gpx/", + "libosmscout-import/", + "libosmscout-map/", + "libosmscout-map-agg/", + "libosmscout-map-cairo/", + "libosmscout-map-directx/", + "libosmscout-map-gdi/", + "libosmscout-map-opengl/", + "libosmscout-map-qt/", + "libosmscout-map-svg/", + "libosmscout-test/", + "OSMScout2", + "OSMScoutOpenGL", + "PublicTransportMap", + "StyleEditor", + "Tests"}; + + const char* sourceRoot = getenv("SOURCE_ROOT"); + + CHECK(sourceRoot!= nullptr); + + + std::list allFiles; + fs::path root=sourceRoot; + + CHECK(exists(root)); + CHECK(is_directory(root)); + + std::cout << "SOURCE_ROOT=" << root << std::endl; + + for (const auto& project : projects) { + std::list files; + fs::path projectPath=root / project; + + files=getFiles(projectPath / "include",".h"); + allFiles.insert(allFiles.end(),files.begin(),files.end()); + + files=getFiles(projectPath / "src",".cpp"); + allFiles.insert(allFiles.end(),files.begin(),files.end()); + } + + std::regex includeString("#include *[\"][a-zA-Z0-9/.]+[\"]"); + + bool foundErrors=false; + + for (const auto& file : allFiles) { + auto includes=getIncludes(file); + + for (const auto& include : includes) { + if (std::regex_search(include,includeString)) { + std::cerr << "File '" << file.generic_string() << "' using wrong include format for include '" << include << "'!" << '\n'; + foundErrors=true; + } + } + } + + REQUIRE_FALSE(foundErrors); +} + diff --git a/Tests/src/MercatorProjection.cpp b/Tests/src/MercatorProjection.cpp index 5a398956f..20385edf6 100644 --- a/Tests/src/MercatorProjection.cpp +++ b/Tests/src/MercatorProjection.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "osmscout/projection/MercatorProjection.h" +#include #include diff --git a/Tests/src/PerformanceTest.cpp b/Tests/src/PerformanceTest.cpp index 84491c9f7..4f08721e0 100644 --- a/Tests/src/PerformanceTest.cpp +++ b/Tests/src/PerformanceTest.cpp @@ -22,7 +22,7 @@ #include #include -#include "config.h" +#include #include diff --git a/libosmscout-gpx/include/osmscoutgpx/TrackPoint.h b/libosmscout-gpx/include/osmscoutgpx/TrackPoint.h index 496b867c9..4f539511a 100644 --- a/libosmscout-gpx/include/osmscoutgpx/TrackPoint.h +++ b/libosmscout-gpx/include/osmscoutgpx/TrackPoint.h @@ -23,7 +23,7 @@ #include #include -#include "GPXImportExport.h" +#include #include #include diff --git a/libosmscout-gpx/include/osmscoutgpx/Waypoint.h b/libosmscout-gpx/include/osmscoutgpx/Waypoint.h index 9b2aa0d48..e51a77ccd 100644 --- a/libosmscout-gpx/include/osmscoutgpx/Waypoint.h +++ b/libosmscout-gpx/include/osmscoutgpx/Waypoint.h @@ -24,7 +24,7 @@ #include -#include "GPXImportExport.h" +#include #include #include diff --git a/libosmscout-import/src/osmscoutimport/GenAreaRouteIndex.cpp b/libosmscout-import/src/osmscoutimport/GenAreaRouteIndex.cpp index eb97580cb..0dd94f59a 100644 --- a/libosmscout-import/src/osmscoutimport/GenAreaRouteIndex.cpp +++ b/libosmscout-import/src/osmscoutimport/GenAreaRouteIndex.cpp @@ -19,7 +19,7 @@ #include -#include "osmscout/routing/RouteDataFile.h" +#include #include namespace osmscout { diff --git a/libosmscout-import/src/osmscoutimport/GenRoute2Dat.cpp b/libosmscout-import/src/osmscoutimport/GenRoute2Dat.cpp index 65464e307..cee21713d 100644 --- a/libosmscout-import/src/osmscoutimport/GenRoute2Dat.cpp +++ b/libosmscout-import/src/osmscoutimport/GenRoute2Dat.cpp @@ -23,7 +23,7 @@ #include #include -#include "osmscout/routing/RouteDataFile.h" +#include namespace osmscout { diff --git a/libosmscout-map-opengl/include/poly2tri/poly2tri.h b/libosmscout-map-opengl/include/poly2tri/poly2tri.h index 487755e2e..d498cef57 100644 --- a/libosmscout-map-opengl/include/poly2tri/poly2tri.h +++ b/libosmscout-map-opengl/include/poly2tri/poly2tri.h @@ -32,8 +32,8 @@ #ifndef POLY2TRI_H #define POLY2TRI_H -#include "common/shapes.h" -#include "sweep/cdt.h" +#include +#include #endif diff --git a/libosmscout-map-opengl/include/poly2tri/sweep/advancing_front.h b/libosmscout-map-opengl/include/poly2tri/sweep/advancing_front.h index b12c1b8fe..72fb019e7 100644 --- a/libosmscout-map-opengl/include/poly2tri/sweep/advancing_front.h +++ b/libosmscout-map-opengl/include/poly2tri/sweep/advancing_front.h @@ -32,7 +32,7 @@ #ifndef ADVANCED_FRONT_H #define ADVANCED_FRONT_H -#include "../common/shapes.h" +#include namespace p2t { diff --git a/libosmscout-map-opengl/include/poly2tri/sweep/cdt.h b/libosmscout-map-opengl/include/poly2tri/sweep/cdt.h index 2d3c822be..0f669da24 100644 --- a/libosmscout-map-opengl/include/poly2tri/sweep/cdt.h +++ b/libosmscout-map-opengl/include/poly2tri/sweep/cdt.h @@ -32,9 +32,9 @@ #ifndef CDT_H #define CDT_H -#include "advancing_front.h" -#include "sweep_context.h" -#include "sweep.h" +#include +#include +#include /** * diff --git a/libosmscout-test/include/osmscout-test/PreprocessOLT.h b/libosmscout-test/include/osmscout-test/PreprocessOLT.h index 496a45422..3ccf4a33b 100644 --- a/libosmscout-test/include/osmscout-test/PreprocessOLT.h +++ b/libosmscout-test/include/osmscout-test/PreprocessOLT.h @@ -26,12 +26,11 @@ #include -#include "TestImportExport.h" - -#include "RegionList.h" - #include +#include +#include + namespace osmscout { namespace test { class OSMSCOUT_TEST_API PreprocessOLT CLASS_FINAL : public Preprocessor diff --git a/libosmscout-test/include/osmscout-test/RegionList.h b/libosmscout-test/include/osmscout-test/RegionList.h index 6a89915de..a122ce70c 100644 --- a/libosmscout-test/include/osmscout-test/RegionList.h +++ b/libosmscout-test/include/osmscout-test/RegionList.h @@ -24,7 +24,7 @@ #include #include -#include "TestImportExport.h" +#include namespace osmscout::test { diff --git a/libosmscout-test/include/osmscout-test/olt/Parser.h b/libosmscout-test/include/osmscout-test/olt/Parser.h index 57b4d734a..784801f46 100644 --- a/libosmscout-test/include/osmscout-test/olt/Parser.h +++ b/libosmscout-test/include/osmscout-test/olt/Parser.h @@ -21,7 +21,7 @@ #if !defined(osmscout_olt_PARSER_H) #define osmscout_olt_PARSER_H -#include "../RegionList.h" +#include #include diff --git a/libosmscout-test/parser/OLT/OLT.atg b/libosmscout-test/parser/OLT/OLT.atg index f1070ac7a..33b36a0c6 100644 --- a/libosmscout-test/parser/OLT/OLT.atg +++ b/libosmscout-test/parser/OLT/OLT.atg @@ -1,4 +1,4 @@ -#include "../RegionList.h" +#include #include diff --git a/libosmscout/include/osmscout/db/BasemapDatabase.h b/libosmscout/include/osmscout/db/BasemapDatabase.h index 160b5e374..15ed11642 100644 --- a/libosmscout/include/osmscout/db/BasemapDatabase.h +++ b/libosmscout/include/osmscout/db/BasemapDatabase.h @@ -21,13 +21,13 @@ */ // Type and style sheet configuration -#include "osmscout/OSMScoutTypes.h" -#include "osmscout/TypeConfig.h" +#include +#include // Water index -#include "WaterIndex.h" +#include -#include "osmscout/system/Compiler.h" +#include namespace osmscout { diff --git a/libosmscout/include/osmscout/db/BoundingBoxDataFile.h b/libosmscout/include/osmscout/db/BoundingBoxDataFile.h index ee63dc869..b21eefbd4 100644 --- a/libosmscout/include/osmscout/db/BoundingBoxDataFile.h +++ b/libosmscout/include/osmscout/db/BoundingBoxDataFile.h @@ -20,11 +20,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "osmscout/CoreImportExport.h" +#include #include -#include "osmscout/util/GeoBox.h" +#include namespace osmscout { diff --git a/libosmscout/include/osmscout/db/Database.h b/libosmscout/include/osmscout/db/Database.h index 86a9b0b02..fb6268f3e 100644 --- a/libosmscout/include/osmscout/db/Database.h +++ b/libosmscout/include/osmscout/db/Database.h @@ -29,15 +29,15 @@ #include // Type and style sheet configuration -#include "osmscout/OSMScoutTypes.h" -#include "osmscout/TypeConfig.h" +#include +#include // Datafiles #include #include #include #include -#include "osmscout/routing/RouteDataFile.h" +#include #include #include @@ -55,13 +55,13 @@ #include // SRTM index -#include "osmscout/SRTM.h" +#include -#include "osmscout/routing/RouteDescription.h" +#include -#include "osmscout/util/GeoBox.h" +#include -#include "osmscout/system/Compiler.h" +#include namespace osmscout { diff --git a/libosmscout/include/osmscout/db/DebugDatabase.h b/libosmscout/include/osmscout/db/DebugDatabase.h index bfd3da402..43f7ba48c 100644 --- a/libosmscout/include/osmscout/db/DebugDatabase.h +++ b/libosmscout/include/osmscout/db/DebugDatabase.h @@ -24,10 +24,10 @@ #include #include -#include "osmscout/ObjectRef.h" +#include // Type and style sheet configuration -#include "osmscout/TypeConfig.h" +#include #include diff --git a/libosmscout/include/osmscout/db/ObjectVariantDataFile.h b/libosmscout/include/osmscout/db/ObjectVariantDataFile.h index 85059ae90..284015b2d 100644 --- a/libosmscout/include/osmscout/db/ObjectVariantDataFile.h +++ b/libosmscout/include/osmscout/db/ObjectVariantDataFile.h @@ -20,10 +20,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "osmscout/CoreImportExport.h" +#include -#include "osmscout/routing/RouteNode.h" -#include "osmscout/TypeConfig.h" +#include + +#include namespace osmscout { diff --git a/libosmscout/include/osmscout/db/TypeDistributionDataFile.h b/libosmscout/include/osmscout/db/TypeDistributionDataFile.h index 565bb395c..4253d760c 100644 --- a/libosmscout/include/osmscout/db/TypeDistributionDataFile.h +++ b/libosmscout/include/osmscout/db/TypeDistributionDataFile.h @@ -20,12 +20,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "osmscout/CoreImportExport.h" +#include #include #include -#include "osmscout/TypeConfig.h" +#include namespace osmscout { diff --git a/libosmscout/include/osmscout/navigation/VoiceInstructionAgent.h b/libosmscout/include/osmscout/navigation/VoiceInstructionAgent.h index 1c1a8a985..b0577e1ac 100644 --- a/libosmscout/include/osmscout/navigation/VoiceInstructionAgent.h +++ b/libosmscout/include/osmscout/navigation/VoiceInstructionAgent.h @@ -23,7 +23,7 @@ #include #include #include -#include "PositionAgent.h" +#include namespace osmscout { diff --git a/libosmscout/src/osmscout/db/BasemapDatabase.cpp b/libosmscout/src/osmscout/db/BasemapDatabase.cpp index df543fbed..046a7eda4 100644 --- a/libosmscout/src/osmscout/db/BasemapDatabase.cpp +++ b/libosmscout/src/osmscout/db/BasemapDatabase.cpp @@ -19,8 +19,8 @@ #include -#include "osmscout/util/Logger.h" -#include "osmscout/util/StopClock.h" +#include +#include namespace osmscout { diff --git a/libosmscout/src/osmscout/db/Database.cpp b/libosmscout/src/osmscout/db/Database.cpp index 986d9ea12..90c55fbf5 100644 --- a/libosmscout/src/osmscout/db/Database.cpp +++ b/libosmscout/src/osmscout/db/Database.cpp @@ -21,12 +21,12 @@ #include -#include "osmscout/system/Assert.h" -#include "osmscout/system/Math.h" +#include +#include -#include "osmscout/util/Geometry.h" -#include "osmscout/util/Logger.h" -#include "osmscout/util/StopClock.h" +#include +#include +#include namespace osmscout { diff --git a/libosmscout/src/osmscout/location/Location.cpp b/libosmscout/src/osmscout/location/Location.cpp index 294f906a6..5c38a2199 100644 --- a/libosmscout/src/osmscout/location/Location.cpp +++ b/libosmscout/src/osmscout/location/Location.cpp @@ -21,7 +21,7 @@ #include -#include "osmscout/util/String.h" +#include namespace osmscout { diff --git a/libosmscout/src/osmscout/projection/Projection.cpp b/libosmscout/src/osmscout/projection/Projection.cpp index 29f8c0bfb..6b1f57f1d 100644 --- a/libosmscout/src/osmscout/projection/Projection.cpp +++ b/libosmscout/src/osmscout/projection/Projection.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "osmscout/projection/Projection.h" +#include #include diff --git a/libosmscout/src/osmscout/routing/RouteDataFile.cpp b/libosmscout/src/osmscout/routing/RouteDataFile.cpp index 7477a036d..e674e1b4d 100644 --- a/libosmscout/src/osmscout/routing/RouteDataFile.cpp +++ b/libosmscout/src/osmscout/routing/RouteDataFile.cpp @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "osmscout/routing/RouteDataFile.h" +#include namespace osmscout {