Spreadsheet: Add C++ test framework
This commit is contained in:
@@ -117,6 +117,9 @@ endif(BUILD_POINTS)
|
||||
if(BUILD_SKETCHER)
|
||||
list (APPEND TestExecutables Sketcher_tests_run)
|
||||
endif(BUILD_SKETCHER)
|
||||
if(BUILD_SPREADSHEET)
|
||||
list (APPEND TestExecutables Spreadsheet_tests_run)
|
||||
endif()
|
||||
|
||||
# -------------------------
|
||||
|
||||
|
||||
@@ -25,3 +25,6 @@ endif(BUILD_POINTS)
|
||||
if(BUILD_SKETCHER)
|
||||
add_subdirectory(Sketcher)
|
||||
endif(BUILD_SKETCHER)
|
||||
if(BUILD_SPREADSHEET)
|
||||
add_subdirectory(Spreadsheet)
|
||||
endif()
|
||||
|
||||
11
tests/src/Mod/Spreadsheet/App/CMakeLists.txt
Normal file
11
tests/src/Mod/Spreadsheet/App/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
target_sources(
|
||||
Spreadsheet_tests_run
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/PropertySheet.cpp
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
Spreadsheet_tests_run
|
||||
PUBLIC
|
||||
${CMAKE_BINARY_DIR}
|
||||
)
|
||||
43
tests/src/Mod/Spreadsheet/App/PropertySheet.cpp
Normal file
43
tests/src/Mod/Spreadsheet/App/PropertySheet.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "src/App/InitApplication.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <Mod/Spreadsheet/App/Sheet.h>
|
||||
#include <Mod/Spreadsheet/App/PropertySheet.h>
|
||||
|
||||
class PropertySheetTest: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
static void SetUpTestSuite()
|
||||
{
|
||||
tests::initApplication();
|
||||
}
|
||||
void SetUp() override
|
||||
{
|
||||
_sheet = std::make_unique<Spreadsheet::Sheet>();
|
||||
_propertySheet = std::make_unique<Spreadsheet::PropertySheet>(_sheet.get());
|
||||
}
|
||||
void TearDown() override
|
||||
{
|
||||
_sheet.reset();
|
||||
_propertySheet.reset();
|
||||
}
|
||||
|
||||
/// Get a non-owning pointer to the internal PropertySheet for this test
|
||||
Spreadsheet::PropertySheet* propertySheet()
|
||||
{
|
||||
return _propertySheet.get();
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<Spreadsheet::Sheet> _sheet;
|
||||
std::unique_ptr<Spreadsheet::PropertySheet> _propertySheet;
|
||||
};
|
||||
|
||||
TEST_F(PropertySheetTest, isValidCellAddressName) // NOLINT
|
||||
{
|
||||
// Test some things
|
||||
}
|
||||
17
tests/src/Mod/Spreadsheet/CMakeLists.txt
Normal file
17
tests/src/Mod/Spreadsheet/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
target_include_directories(Spreadsheet_tests_run PUBLIC
|
||||
${EIGEN3_INCLUDE_DIR}
|
||||
${OCC_INCLUDE_DIR}
|
||||
${Python3_INCLUDE_DIRS}
|
||||
${SMESH_INCLUDE_DIR}
|
||||
${VTK_INCLUDE_DIRS}
|
||||
${XercesC_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
target_link_libraries(Spreadsheet_tests_run
|
||||
gtest_main
|
||||
${Google_Tests_LIBS}
|
||||
Spreadsheet
|
||||
)
|
||||
|
||||
add_subdirectory(App)
|
||||
Reference in New Issue
Block a user