Skip to content

Commit

Permalink
added cmake testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jklimke committed Jan 4, 2024
1 parent 9af7194 commit 56898ca
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DLIBCITYGML_TESTS=true
-DLIBCITYGML_OSGPLUGIN=true
-DLIBCITYGML_USE_OPENGL=true
-S ${{ github.workspace }}
- name: Build
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ ENDIF(LIBCITYGML_OSGPLUGIN)
# test
OPTION(LIBCITYGML_TESTS "Set to ON to build libcitygml tests programs." ON)
IF (LIBCITYGML_TESTS)
enable_testing()
ADD_SUBDIRECTORY( test )
ENDIF(LIBCITYGML_TESTS)

Expand Down Expand Up @@ -220,3 +221,5 @@ IF(UNIX AND NOT APPLE)
include(CPack)
endif()
ENDIF()


5 changes: 5 additions & 0 deletions CTestTestfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@


add_test(berlin_open_data_sample_data.citygml COMMAND bin/citygmltest ../data/berlin_open_data_sample_data.citygml)
add_test(b1_lod2_s.gml COMMAND bin/citygmltest ../data/b1_lod2_s.gml)
add_test(FZK-Haus-LoD0-KIT-IAI-KHH-B36-V1.gml COMMAND bin/citygmltest ../data/FZK-Haus-LoD0-KIT-IAI-KHH-B36-V1.gml)
9 changes: 5 additions & 4 deletions osgplugin/ReaderWriterCityGML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <citygml/polygon.h>
#include <citygml/material.h>
#include <citygml/texture.h>
#include <citygml/tesselator.h>
#include <citygml/citygmllogger.h>

#include <algorithm>
Expand Down Expand Up @@ -189,8 +190,8 @@ osgDB::ReaderWriter::ReadResult ReaderWriterCityGML::readNode( const std::string
std::streambuf* cerrsb = std::cerr.rdbuf( osg::notify(osg::NOTICE).rdbuf() );

osg::notify(osg::NOTICE) << "Parsing CityGML file " << fileName << "..." << std::endl;

std::shared_ptr<const citygml::CityModel> city = citygml::load( fileName, settings._params, m_logger );
std::unique_ptr<TesselatorBase> tesselator = std::unique_ptr<TesselatorBase>(new Tesselator(nullptr));
std::shared_ptr<const citygml::CityModel> city = citygml::load( fileName, settings._params, std::move(tesselator), m_logger );

ReadResult rr = readCity( city, settings );

Expand Down Expand Up @@ -221,8 +222,8 @@ osgDB::ReaderWriter::ReadResult ReaderWriterCityGML::readNode( std::istream& fin
std::streambuf* cerrsb = std::cerr.rdbuf( osg::notify(osg::NOTICE).rdbuf() );

osg::notify(osg::NOTICE) << "Parsing CityGML stream..." << std::endl;

std::shared_ptr<const citygml::CityModel> city = citygml::load( fin, settings._params );
std::unique_ptr<TesselatorBase> tesselator = std::unique_ptr<TesselatorBase>(new Tesselator(nullptr));
std::shared_ptr<const citygml::CityModel> city = citygml::load( fin, settings._params, std::move(tesselator), m_logger);

ReadResult rr = readCity( city, settings );

Expand Down
5 changes: 5 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ if(NOT DEFINED BIN_INSTALL_DIR)
endif(NOT DEFINED BIN_INSTALL_DIR)

install(TARGETS citygmltest RUNTIME DESTINATION ${BIN_INSTALL_DIR})


add_test(NAME berlin_open_data_sample_data COMMAND citygmltest ../../data/berlin_open_data_sample_data.citygml)
add_test(NAME b1_lod2_s COMMAND citygmltest ../../data/b1_lod2_s.gml)
add_test(NAME FZK-Haus-LoD0-KIT-IAI-KHH-B36-V1 COMMAND citygmltest ../../data/FZK-Haus-LoD0-KIT-IAI-KHH-B36-V1.gml)

0 comments on commit 56898ca

Please sign in to comment.