refactored common test-model functions to base class
This commit is contained in:
parent
3ad5d3bd57
commit
8f170eb83b
14 changed files with 353 additions and 480 deletions
24
source/CheckableTest/CMakeLists.txt
Normal file
24
source/CheckableTest/CMakeLists.txt
Normal file
|
@ -0,0 +1,24 @@
|
|||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
project(CheckableTest LANGUAGES CXX)
|
||||
|
||||
find_package(Qt5Core REQUIRED)
|
||||
|
||||
add_library(${PROJECT_NAME}
|
||||
CheckableTest.cpp
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME}
|
||||
PROPERTIES CXX_STANDARD 14
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
CheckableItem
|
||||
Qt5::Core
|
||||
)
|
28
source/CheckableTest/CheckableTest.cpp
Normal file
28
source/CheckableTest/CheckableTest.cpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#include "CheckableTest.h"
|
||||
|
||||
CheckableTest::CheckableTest(
|
||||
const char *name, std::initializer_list<std::string> items)
|
||||
: m_name(name)
|
||||
, m_items(items)
|
||||
{
|
||||
}
|
||||
|
||||
size_t CheckableTest::size() const
|
||||
{
|
||||
return m_items.size();
|
||||
}
|
||||
|
||||
const QString &CheckableTest::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
const CheckableItems &CheckableTest::items() const
|
||||
{
|
||||
return m_items;
|
||||
}
|
||||
|
||||
CheckableItems &CheckableTest::items()
|
||||
{
|
||||
return m_items;
|
||||
}
|
23
source/CheckableTest/CheckableTest.h
Normal file
23
source/CheckableTest/CheckableTest.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include "CheckableItems.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
class CheckableTest
|
||||
{
|
||||
private:
|
||||
CheckableItems m_items;
|
||||
QString m_name;
|
||||
|
||||
public:
|
||||
CheckableTest(const char *name, std::initializer_list<std::string> items);
|
||||
|
||||
size_t size() const;
|
||||
const QString &name() const;
|
||||
const CheckableItems &items() const;
|
||||
CheckableItems &items();
|
||||
};
|
||||
|
||||
using CheckableTests = std::vector<CheckableTest>;
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue