BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
groupitem.test.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/tests/testmodel/groupitem.test.cpp
6 //! @brief Implements class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #include "google_test.h"
16 #include "mvvm/model/groupitem.h"
17 #include <stdexcept>
18 
19 using namespace ModelView;
20 
21 //! Testing GroupItem class.
22 
23 class GroupItemTest : public ::testing::Test {
24 public:
26 };
27 
29 
30 TEST_F(GroupItemTest, initialState)
31 {
32  GroupItem item;
33  EXPECT_EQ(item.currentIndex(), -1);
34  EXPECT_EQ(item.currentItem(), nullptr);
35  EXPECT_EQ(item.currentType(), "");
36  EXPECT_TRUE(item.hasData());
37  EXPECT_TRUE(item.children().empty());
38  EXPECT_THROW(item.setCurrentType("abc"), std::runtime_error);
39 }
Testing GroupItem class.
Group item holds collection of predefined items.
Definition: groupitem.h:26
const SessionItem * currentItem() const
Returns currently selected item.
Definition: groupitem.cpp:41
void setCurrentType(const std::string &model_type)
Sets item corresponding to given model type.
Definition: groupitem.cpp:58
std::string currentType() const
Definition: groupitem.cpp:51
int currentIndex() const
Definition: groupitem.cpp:34
bool hasData(int role=ItemDataRole::DATA) const
Returns true if item has data on board with given role.
std::vector< SessionItem * > children() const
Returns vector of children formed from all chidlren from all tags.
Defines class CLASS?
Defines class CLASS?
TEST_F(GroupItemTest, initialState)
materialitems.h Collection of materials to populate MaterialModel.