diff --git a/application/sources/diagram_container.cpp b/application/sources/diagram_container.cpp index fc300db..28cdd0d 100644 --- a/application/sources/diagram_container.cpp +++ b/application/sources/diagram_container.cpp @@ -26,7 +26,7 @@ DiagramContainer::DiagramContainer(QObject* parent) : QAbstractItemModel(parent) #ifdef DIAGRAM_CONTAINER_DEBUG_MODE std::cout << "Elements contained by the DiagramContainer:" << std::endl; - root_item->PrintAllElementsBelow(); + root_element->PrintAllElementsRecursive(); std::cout << std::endl; #endif } @@ -334,9 +334,19 @@ QModelIndex DiagramContainer::parent(const QModelIndex &index) const { Element* indexed_element = static_cast(index.internalPointer()); Element* parent_element = indexed_element->parent; + Element* parent_of_parent_element = parent_element->parent; if(root_element.get() != parent_element) { - result = createIndex(0, (column_count - 1), parent_element); + int row = 0; + for(std::size_t i = parent_of_parent_element->GetNumberOfChildren(); i > 0; --i) + { + std::size_t index_of_parent = i - 1; + if(parent_of_parent_element->GetIndexWithChild(parent_element, index_of_parent) == true) + { + row = static_cast(index_of_parent); + } + } + result = createIndex(row, (column_count - 1), parent_element); } } @@ -622,7 +632,7 @@ void DiagramContainer::Element::CallFunctionOnElementsRecursive(std::function(data) << "\", Address: " << this << std::endl; for(const auto& i : children) { diff --git a/application/sources/diagram_container.hpp b/application/sources/diagram_container.hpp index c162e84..d9988f0 100644 --- a/application/sources/diagram_container.hpp +++ b/application/sources/diagram_container.hpp @@ -49,11 +49,11 @@ class DiagramContainer : public QAbstractItemModel public: DiagramContainer(QObject* parent = nullptr); - DiagramContainer(const DiagramContainer& new_backend) = delete; - DiagramContainer(DiagramContainer&& new_backend) = delete; + DiagramContainer(const DiagramContainer&) = delete; + DiagramContainer(DiagramContainer&&) = delete; - DiagramContainer& operator=(const DiagramContainer& new_backend) = delete; - DiagramContainer& operator=(DiagramContainer&& new_backend) = delete; + DiagramContainer& operator=(const DiagramContainer&) = delete; + DiagramContainer& operator=(DiagramContainer&&) = delete; virtual ~DiagramContainer() override = default; @@ -112,11 +112,11 @@ class DiagramContainer : public QAbstractItemModel explicit Element(const DataType& new_data, Element* new_parent = nullptr, const Qt::ItemFlags& new_flags = element_flags_default, const Qt::CheckState new_check_state = Qt::Unchecked) : data(new_data), parent(new_parent), flags(new_flags), check_state(new_check_state) {} - Element(const Element& new_backend) = delete; - Element(Element&& new_backend) = delete; + Element(const Element&) = delete; + Element(Element&&) = delete; - Element& operator=(const Element& new_backend) = delete; - Element& operator=(Element&& new_backend) = delete; + Element& operator=(const Element&) = delete; + Element& operator=(Element&&) = delete; ~Element() = default; diff --git a/tests/sources/test_backend.cpp b/tests/sources/test_backend.cpp index 23c374f..1f9202d 100644 --- a/tests/sources/test_backend.cpp +++ b/tests/sources/test_backend.cpp @@ -30,5 +30,5 @@ TEST(TestBackend, Constructor) { - Backend myBackend(); + Backend myBackend; } diff --git a/tests/sources/test_diagram_container.cpp b/tests/sources/test_diagram_container.cpp index 2cb570b..1abace7 100644 --- a/tests/sources/test_diagram_container.cpp +++ b/tests/sources/test_diagram_container.cpp @@ -24,11 +24,351 @@ #include #include +#include #include "../application/sources/diagram_container.hpp" +// Constructed model structure should be... +// +// root ("Available digrams") +// | +// --- first_child ("Diagrams loaded from files") +// | | +// | --- first_child_of_first_child ("No diagrams yet...") +// | +// --- second_child ("Diagrams received on the network") +// | +// --- first_child_of_second_child ("No diagrams yet...") -TEST(TestDiagramContainer, Constructor) +class TestDiagramContainer : public ::testing::Test { - DiagramContainer myContainer(); +protected: + DiagramContainer container; + QModelIndex root; + QModelIndex first_child; + QModelIndex first_child_of_first_child; + QModelIndex second_child; + QModelIndex first_child_of_second_child; + + TestDiagramContainer() {} + ~TestDiagramContainer() override {} + void SetUp() override + { + root = QModelIndex{}; + first_child = container.index(0,0,root); + first_child_of_first_child = container.index(0,0,first_child); + second_child = container.index(1,0,root); + first_child_of_second_child = container.index(0,0,second_child); + } + void TearDown() override {} +}; + +TEST_F(TestDiagramContainer, ModelStructureAndIndexingAfterConstruction) +{ + EXPECT_EQ(first_child.row(), 0); + EXPECT_EQ(first_child.column(), 0); + EXPECT_TRUE(first_child.isValid()); + EXPECT_EQ(first_child_of_first_child.row(), 0); + EXPECT_EQ(first_child_of_first_child.column(), 0); + EXPECT_TRUE(first_child_of_first_child.isValid()); + + EXPECT_EQ(second_child.row(), 1); + EXPECT_EQ(second_child.column(), 0); + EXPECT_TRUE(second_child.isValid()); + EXPECT_EQ(first_child_of_second_child.row(), 0); + EXPECT_EQ(first_child_of_second_child.column(), 0); + EXPECT_TRUE(first_child_of_second_child.isValid()); + + QModelIndex non_existent_second_child_of_first_child = container.index(1,0,first_child); + QModelIndex non_existent_second_child_of_second_child = container.index(1,0,second_child); + QModelIndex non_existent_third_child = container.index(2,0,root); + + EXPECT_EQ(non_existent_second_child_of_first_child.row(), -1); + EXPECT_EQ(non_existent_second_child_of_first_child.column(), -1); + EXPECT_FALSE(non_existent_second_child_of_first_child.isValid()); + EXPECT_EQ(non_existent_second_child_of_second_child.row(), -1); + EXPECT_EQ(non_existent_second_child_of_second_child.column(), -1); + EXPECT_FALSE(non_existent_second_child_of_second_child.isValid()); + EXPECT_EQ(non_existent_third_child.row(), -1); + EXPECT_EQ(non_existent_third_child.column(), -1); + EXPECT_FALSE(non_existent_third_child.isValid()); +} + +TEST_F(TestDiagramContainer, ParentReferencing) +{ + EXPECT_EQ(container.parent(root), QModelIndex{}); + EXPECT_EQ(container.parent(first_child), root); + EXPECT_EQ(container.parent(second_child), root); + EXPECT_EQ(container.parent(first_child_of_first_child), first_child); + EXPECT_EQ(container.parent(first_child_of_second_child), second_child); } + +TEST_F(TestDiagramContainer, RowAndColumnCountAfterConstruction) +{ + EXPECT_EQ(container.rowCount(root), 2); + EXPECT_EQ(container.columnCount(root), 1); + EXPECT_EQ(container.rowCount(first_child), 1); + EXPECT_EQ(container.columnCount(first_child), 1); + EXPECT_EQ(container.rowCount(second_child), 1); + EXPECT_EQ(container.columnCount(second_child), 1); + EXPECT_EQ(container.rowCount(first_child_of_first_child), 0); + EXPECT_EQ(container.columnCount(first_child_of_first_child), 1); + EXPECT_EQ(container.rowCount(first_child_of_second_child), 0); + EXPECT_EQ(container.columnCount(first_child_of_second_child), 1); +} + +TEST_F(TestDiagramContainer, FlagsAfterConstruction) +{ + EXPECT_EQ(root.flags(), Qt::NoItemFlags); + EXPECT_EQ(first_child.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(second_child.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(first_child_of_first_child.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(first_child_of_second_child.flags(), Qt::ItemIsEnabled); +} + +TEST_F(TestDiagramContainer, DataAfterConstruction) +{ + EXPECT_EQ(container.headerData(0, Qt::Horizontal, Qt::DisplayRole).value(), QString("Available diagrams")); + EXPECT_FALSE(container.headerData(0, Qt::Vertical, Qt::DisplayRole).isValid()); + EXPECT_FALSE(container.headerData(0, Qt::Horizontal, Qt::CheckStateRole).isValid()); + + EXPECT_EQ(container.data(first_child, Qt::DisplayRole).value(), QString("Diagrams loaded from files")); + EXPECT_EQ(container.data(first_child, Qt::CheckStateRole).value(), Qt::Unchecked); + + EXPECT_EQ(container.data(second_child, Qt::DisplayRole).value(), QString("Diagrams received on the network")); + EXPECT_EQ(container.data(second_child, Qt::CheckStateRole).value(), Qt::Unchecked); + + EXPECT_EQ(container.data(first_child_of_first_child, Qt::DisplayRole).value(), QString("No diagrams yet...")); + EXPECT_EQ(container.data(first_child_of_first_child, Qt::CheckStateRole).value(), Qt::Unchecked); + + EXPECT_EQ(container.data(first_child_of_second_child, Qt::DisplayRole).value(), QString("No diagrams yet...")); + EXPECT_EQ(container.data(first_child_of_second_child, Qt::CheckStateRole).value(), Qt::Unchecked); +} + +TEST_F(TestDiagramContainer, ShowHideCheckBoxes) +{ + container.ShowCheckBoxes(); + EXPECT_EQ(root.flags(), Qt::NoItemFlags); + EXPECT_EQ(first_child.flags(), Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); + EXPECT_EQ(second_child.flags(), Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); + EXPECT_EQ(first_child_of_first_child.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(first_child_of_second_child.flags(), Qt::ItemIsEnabled); + + container.HideCheckBoxes(); + EXPECT_EQ(root.flags(), Qt::NoItemFlags); + EXPECT_EQ(first_child.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(second_child.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(first_child_of_first_child.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(first_child_of_second_child.flags(), Qt::ItemIsEnabled); +} + +TEST_F(TestDiagramContainer, ChangingCheckStateOfItem) +{ + container.ShowCheckBoxes(); + QSignalSpy SpyDataChangedSignal(&container, SIGNAL(dataChanged(QModelIndex, QModelIndex, QVector))); + + EXPECT_TRUE(container.setData(first_child, QVariant{Qt::Checked}, Qt::CheckStateRole)); + EXPECT_EQ(container.data(first_child, Qt::CheckStateRole).value(), Qt::Checked); + EXPECT_EQ(SpyDataChangedSignal.count(), 1); + + EXPECT_TRUE(container.setData(second_child, QVariant{Qt::Checked}, Qt::CheckStateRole)); + EXPECT_EQ(container.data(second_child, Qt::CheckStateRole).value(), Qt::Checked); + EXPECT_EQ(SpyDataChangedSignal.count(), 2); + + EXPECT_FALSE(container.setData(first_child_of_first_child, QVariant{Qt::Checked}, Qt::CheckStateRole)); + EXPECT_FALSE(container.setData(first_child_of_second_child, QVariant{Qt::Checked}, Qt::CheckStateRole)); + EXPECT_EQ(SpyDataChangedSignal.count(), 2); +} + +class TestDiagramContainerWithDiagrams : public ::testing::Test +{ +protected: + DiagramContainer container; + + QModelIndex diagrams_from_file; + QModelIndex diagrams_from_first_file; + QModelIndex first_diagram_from_first_file; + QModelIndex second_diagram_from_first_file; + QModelIndex diagrams_from_second_file; + QModelIndex first_diagram_from_second_file; + + QModelIndex diagrams_from_network; + QModelIndex diagrams_from_first_network; + QModelIndex first_diagram_from_first_network; + QModelIndex second_diagram_from_first_network; + QModelIndex diagrams_from_second_network; + QModelIndex first_diagram_from_second_network; + + const std::string file_path{"file_path"}; + const std::string first_file_name{"first_file_name"}; + const std::string second_file_name{"second_file_name"}; + const std::string first_connection_name{"first_connection_name"}; + const std::string second_connection_name{"second_connection_name"}; + const std::string title{"Title"}; + const std::string axis_x{"Axis X"}; + + DiagramSpecialized default_diagram; + DiagramSpecialized diagram{title, axis_x}; + + TestDiagramContainerWithDiagrams() {} + ~TestDiagramContainerWithDiagrams() override {} + void SetUp() override + { + diagrams_from_file = container.index(0,0,QModelIndex{}); + first_diagram_from_first_file = container.AddDiagramFromFile(first_file_name, file_path, default_diagram); + second_diagram_from_first_file = container.AddDiagramFromFile(first_file_name, file_path, diagram); + first_diagram_from_second_file = container.AddDiagramFromFile(second_file_name, file_path, diagram); + diagrams_from_first_file = container.index(0,0,diagrams_from_file); + diagrams_from_second_file = container.index(1,0,diagrams_from_file); + + diagrams_from_network = container.index(1,0, QModelIndex{}); + first_diagram_from_first_network = container.AddDiagramFromNetwork(first_connection_name, default_diagram); + second_diagram_from_first_network = container.AddDiagramFromNetwork(first_connection_name, diagram); + first_diagram_from_second_network = container.AddDiagramFromNetwork(second_connection_name, diagram); + diagrams_from_first_network = container.index(0,0,diagrams_from_network); + diagrams_from_second_network = container.index(1,0,diagrams_from_network); + } + void TearDown() override {} + void UncheckAllFileElements() + { + container.setData(diagrams_from_file, QVariant{Qt::Unchecked}, Qt::CheckStateRole); + container.setData(diagrams_from_first_file, QVariant{Qt::Unchecked}, Qt::CheckStateRole); + container.setData(first_diagram_from_first_file, QVariant{Qt::Unchecked}, Qt::CheckStateRole); + container.setData(second_diagram_from_first_file, QVariant{Qt::Unchecked}, Qt::CheckStateRole); + container.setData(diagrams_from_second_file, QVariant{Qt::Unchecked}, Qt::CheckStateRole); + container.setData(first_diagram_from_second_file, QVariant{Qt::Unchecked}, Qt::CheckStateRole); + } +}; + +TEST_F(TestDiagramContainerWithDiagrams, HierarchyAfterAddingDiagrams) +{ + EXPECT_TRUE(diagrams_from_file.isValid()); + EXPECT_TRUE(diagrams_from_first_file.isValid()); + EXPECT_TRUE(first_diagram_from_first_file.isValid()); + EXPECT_TRUE(second_diagram_from_first_file.isValid()); + EXPECT_TRUE(diagrams_from_second_file.isValid()); + EXPECT_TRUE(first_diagram_from_second_file.isValid()); + + EXPECT_TRUE(diagrams_from_network.isValid()); + EXPECT_TRUE(diagrams_from_first_network.isValid()); + EXPECT_TRUE(first_diagram_from_first_network.isValid()); + EXPECT_TRUE(second_diagram_from_first_network.isValid()); + EXPECT_TRUE(diagrams_from_second_network.isValid()); + EXPECT_TRUE(first_diagram_from_second_network.isValid()); + + EXPECT_EQ(diagrams_from_first_file, container.index(0,0,diagrams_from_file)); + EXPECT_EQ(first_diagram_from_first_file, container.index(0,0,diagrams_from_first_file)); + EXPECT_EQ(second_diagram_from_first_file, container.index(1,0,diagrams_from_first_file)); + EXPECT_EQ(diagrams_from_second_file, container.index(1,0,diagrams_from_file)); + EXPECT_EQ(first_diagram_from_second_file, container.index(0,0,diagrams_from_second_file)); + + EXPECT_EQ(diagrams_from_first_network, container.index(0,0,diagrams_from_network)); + EXPECT_EQ(first_diagram_from_first_network, container.index(0,0,diagrams_from_first_network)); + EXPECT_EQ(second_diagram_from_first_network, container.index(1,0,diagrams_from_first_network)); + EXPECT_EQ(diagrams_from_second_network, container.index(1,0,diagrams_from_network)); + EXPECT_EQ(first_diagram_from_second_network, container.index(0,0,diagrams_from_second_network)); +} + +TEST_F(TestDiagramContainerWithDiagrams, FlagsAndDataAfterAddingDiagrams) +{ + EXPECT_EQ(container.data(diagrams_from_first_file, Qt::DisplayRole).value(), QString::fromStdString(first_file_name)); + EXPECT_EQ(container.data(first_diagram_from_first_file, Qt::DisplayRole).value(), QString{}); + EXPECT_EQ(container.data(second_diagram_from_first_file, Qt::DisplayRole).value(), QString::fromStdString(title)); + EXPECT_EQ(container.data(diagrams_from_second_file, Qt::DisplayRole).value(),QString::fromStdString(second_file_name)); + EXPECT_EQ(container.data(first_diagram_from_second_file, Qt::DisplayRole).value(), QString::fromStdString(title)); + + EXPECT_EQ(container.data(diagrams_from_first_network, Qt::DisplayRole).value(), QString::fromStdString(first_connection_name)); + EXPECT_EQ(container.data(first_diagram_from_first_network, Qt::DisplayRole).value(), QString{}); + EXPECT_EQ(container.data(second_diagram_from_first_network, Qt::DisplayRole).value(), QString::fromStdString(title)); + EXPECT_EQ(container.data(diagrams_from_second_network, Qt::DisplayRole).value(), QString::fromStdString(second_connection_name)); + EXPECT_EQ(container.data(first_diagram_from_second_network, Qt::DisplayRole).value(), QString::fromStdString(title)); + + EXPECT_EQ(container.data(diagrams_from_first_file, Qt::CheckStateRole).value(), Qt::Unchecked); + EXPECT_EQ(container.data(first_diagram_from_first_file, Qt::CheckStateRole).value(), Qt::Unchecked); + EXPECT_EQ(container.data(second_diagram_from_first_file, Qt::CheckStateRole).value(), Qt::Unchecked); + EXPECT_EQ(container.data(diagrams_from_second_file, Qt::CheckStateRole).value(), Qt::Unchecked); + EXPECT_EQ(container.data(first_diagram_from_second_file, Qt::CheckStateRole).value(), Qt::Unchecked); + + EXPECT_EQ(container.data(diagrams_from_first_network, Qt::CheckStateRole).value(), Qt::Unchecked); + EXPECT_EQ(container.data(first_diagram_from_first_network, Qt::CheckStateRole).value(), Qt::Unchecked); + EXPECT_EQ(container.data(second_diagram_from_first_network, Qt::CheckStateRole).value(), Qt::Unchecked); + EXPECT_EQ(container.data(diagrams_from_second_network, Qt::CheckStateRole).value(), Qt::Unchecked); + EXPECT_EQ(container.data(first_diagram_from_second_network, Qt::CheckStateRole).value(), Qt::Unchecked); + + EXPECT_EQ(diagrams_from_first_file.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(first_diagram_from_first_file.flags(), Qt::ItemIsEnabled | Qt::ItemIsEditable); + EXPECT_EQ(second_diagram_from_first_file.flags(), Qt::ItemIsEnabled | Qt::ItemIsEditable); + EXPECT_EQ(diagrams_from_second_file.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(first_diagram_from_second_file.flags(), Qt::ItemIsEnabled | Qt::ItemIsEditable); + + EXPECT_EQ(diagrams_from_first_network.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(first_diagram_from_first_network.flags(), Qt::ItemIsEnabled | Qt::ItemIsEditable); + EXPECT_EQ(second_diagram_from_first_network.flags(), Qt::ItemIsEnabled | Qt::ItemIsEditable); + EXPECT_EQ(diagrams_from_second_network.flags(), Qt::ItemIsEnabled); + EXPECT_EQ(first_diagram_from_second_network.flags(), Qt::ItemIsEnabled | Qt::ItemIsEditable); +} + +TEST_F(TestDiagramContainerWithDiagrams, DiagramNumbersUpdated) +{ + EXPECT_EQ(container.GetNumberOfDiagrams(), std::size_t{6}); + + container.AddDiagramFromFile(first_file_name, file_path, default_diagram); + EXPECT_EQ(container.GetNumberOfDiagrams(), std::size_t{7}); + + container.AddDiagramFromFile("new_file_name", "new_file_path", default_diagram); + EXPECT_EQ(container.GetNumberOfDiagrams(), std::size_t{8}); + + container.AddDiagramFromNetwork(first_connection_name, default_diagram); + EXPECT_EQ(container.GetNumberOfDiagrams(), std::size_t{9}); + + container.AddDiagramFromNetwork("new_connection_name", default_diagram); + EXPECT_EQ(container.GetNumberOfDiagrams(), std::size_t{10}); +} + +TEST_F(TestDiagramContainerWithDiagrams, FileDuplication) +{ + EXPECT_TRUE(container.IsThisFileAlreadyStored(first_file_name, file_path)); + EXPECT_FALSE(container.IsThisFileAlreadyStored("new_file_name", "new_file_path")); +} + +TEST_F(TestDiagramContainerWithDiagrams, GetDiagram) +{ + EXPECT_EQ(container.GetDiagram(first_diagram_from_first_file)->GetTitle(), std::string{}); + EXPECT_EQ(container.GetDiagram(first_diagram_from_first_file)->GetAxisXTitle(), std::string{}); + EXPECT_EQ(container.GetDiagram(second_diagram_from_first_file)->GetTitle(), title); + EXPECT_EQ(container.GetDiagram(second_diagram_from_first_file)->GetAxisXTitle(), axis_x); +} + +TEST_F(TestDiagramContainerWithDiagrams, GetCheckedDiagrams) +{ + container.ShowCheckBoxes(); + auto no_checked_diagrams = container.GetCheckedDiagrams(); + EXPECT_TRUE(no_checked_diagrams.empty()); + + UncheckAllFileElements(); + EXPECT_TRUE(container.setData(second_diagram_from_first_file, QVariant{Qt::Checked}, Qt::CheckStateRole)); + auto one_daigram_checked = container.GetCheckedDiagrams(); + ASSERT_EQ(one_daigram_checked.size(), std::size_t{1}); + EXPECT_EQ(one_daigram_checked.at(0).GetTitle(), title); + EXPECT_EQ(one_daigram_checked.at(0).GetAxisXTitle(), axis_x); + + UncheckAllFileElements(); + EXPECT_TRUE(container.setData(diagrams_from_first_file, QVariant{Qt::Checked}, Qt::CheckStateRole)); + auto first_file_checked = container.GetCheckedDiagrams(); + ASSERT_EQ(first_file_checked.size(), std::size_t{2}); + EXPECT_EQ(first_file_checked.at(0).GetTitle(), std::string{}); + EXPECT_EQ(first_file_checked.at(0).GetAxisXTitle(), std::string{}); + EXPECT_EQ(first_file_checked.at(1).GetTitle(), title); + EXPECT_EQ(first_file_checked.at(1).GetAxisXTitle(), axis_x); + + UncheckAllFileElements(); + EXPECT_TRUE(container.setData(diagrams_from_file, QVariant{Qt::Checked}, Qt::CheckStateRole)); + auto diagrams_from_file_checked = container.GetCheckedDiagrams(); + ASSERT_EQ(diagrams_from_file_checked.size(), std::size_t{3}); + EXPECT_EQ(diagrams_from_file_checked.at(0).GetTitle(), std::string{}); + EXPECT_EQ(diagrams_from_file_checked.at(0).GetAxisXTitle(), std::string{}); + EXPECT_EQ(diagrams_from_file_checked.at(1).GetTitle(), title); + EXPECT_EQ(diagrams_from_file_checked.at(1).GetAxisXTitle(), axis_x); + EXPECT_EQ(diagrams_from_file_checked.at(2).GetTitle(), title); + EXPECT_EQ(diagrams_from_file_checked.at(2).GetAxisXTitle(), axis_x); +} \ No newline at end of file diff --git a/tests/sources/test_serial_port.cpp b/tests/sources/test_serial_port.cpp index b04cc8e..b129bae 100644 --- a/tests/sources/test_serial_port.cpp +++ b/tests/sources/test_serial_port.cpp @@ -30,5 +30,5 @@ TEST(TestSerialPort, Constructor) { - SerialPort myPort(); + SerialPort myPort; } diff --git a/tests/tests.pro b/tests/tests.pro index e85603d..f41f3ac 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -35,7 +35,9 @@ CONFIG += \ QT += core \ gui \ charts \ - serialport + serialport \ + testlib + greaterThan(QT_MAJOR_VERSION, 4): QT += widgets # Compiler flags @@ -46,8 +48,16 @@ QMAKE_LFLAGS += --coverage # Source files of the target SOURCES += \ + ../application/sources/backend.cpp \ ../application/sources/configuration.cpp \ + ../application/sources/data_line.cpp \ + ../application/sources/data_point.cpp \ + ../application/sources/diagram.cpp \ + ../application/sources/diagram_container.cpp \ + ../application/sources/main_window.cpp \ ../application/sources/measurement_data_protocol.cpp \ + ../application/sources/network_handler.cpp \ + ../application/sources/serial_port.cpp \ sources/test_main.cpp \ sources/test_data_point.cpp \ sources/test_data_line.cpp \ @@ -58,6 +68,24 @@ SOURCES += \ sources/test_serial_port.cpp \ sources/test_backend.cpp +HEADERS += \ + ../application/sources/backend.hpp \ + ../application/sources/backend_signal_interface.hpp \ + ../application/sources/configuration.hpp \ + ../application/sources/data_connection_interface.hpp \ + ../application/sources/data_line.hpp \ + ../application/sources/data_point.hpp \ + ../application/sources/data_processing_interface.hpp \ + ../application/sources/diagram.hpp \ + ../application/sources/diagram_container.hpp \ + ../application/sources/global.hpp \ + ../application/sources/gui_signal_interface.hpp \ + ../application/sources/main_window.hpp \ + ../application/sources/measurement_data_protocol.hpp \ + ../application/sources/network_connection_interface.hpp \ + ../application/sources/network_handler.hpp \ + ../application/sources/serial_port.hpp + DISTFILES += \ gtest_dendency.pri \ test_files/TEST_1C_0E_MDP.mdp \