BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
labeldatarowstrategy.test.cpp File Reference

Implements class CLASS? More...

Include dependency graph for labeldatarowstrategy.test.cpp:

Go to the source code of this file.

Classes

class  LabelDataRowStrategyTest
 

Functions

 TEST_F (LabelDataRowStrategyTest, initialState)
 
 TEST_F (LabelDataRowStrategyTest, propertyItem)
 Checks row construction for property item. More...
 
 TEST_F (LabelDataRowStrategyTest, topLevelItem)
 Checks row construction for standard top level item, like Level, MultiLayer etc. More...
 

Detailed Description

Implements class CLASS?

Homepage:\n http://www.bornagainproject.org
License:\n GNU General Public License v3 or higher (see COPYING)
Authors
Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)

Definition in file labeldatarowstrategy.test.cpp.

Function Documentation

◆ TEST_F() [1/3]

TEST_F ( LabelDataRowStrategyTest  ,
initialState   
)

Definition at line 36 of file labeldatarowstrategy.test.cpp.

37 {
38  LabelDataRowStrategy constructor;
39  EXPECT_EQ(constructor.constructRow(nullptr).size(), 0);
40  EXPECT_EQ(constructor.horizontalHeaderLabels(), expected_labels);
41 }
Constructs row of QStandardItem's for given SessionItem.
std::vector< std::unique_ptr< ViewItem > > constructRow(SessionItem *) override
QStringList horizontalHeaderLabels() const override
Example: For LayerItem two items will be generated: ViewLabelItem and ViewEmptyItem,...

References ModelView::LabelDataRowStrategy::constructRow(), and ModelView::LabelDataRowStrategy::horizontalHeaderLabels().

Here is the call graph for this function:

◆ TEST_F() [2/3]

TEST_F ( LabelDataRowStrategyTest  ,
propertyItem   
)

Checks row construction for property item.

Definition at line 65 of file labeldatarowstrategy.test.cpp.

66 {
67  SessionItem item("model_type");
68  item.setData(42.0);
69 
70  LabelDataRowStrategy constructor;
71  auto items = constructor.constructRow(&item);
72  EXPECT_EQ(items.size(), expected_column_count);
73  EXPECT_EQ(constructor.horizontalHeaderLabels(), expected_labels);
74 
75  // checking that it is label and data
76  auto labelItem = dynamic_cast<ViewLabelItem*>(items.at(0).get());
77  auto dataItem = dynamic_cast<ViewDataItem*>(items.at(1).get());
78  ASSERT_TRUE(labelItem != nullptr);
79  EXPECT_EQ(labelItem->item(), &item);
80  ASSERT_TRUE(dataItem != nullptr);
81  EXPECT_EQ(dataItem->item(), &item);
82 }
The main object representing an editable/displayable/serializable entity.
Definition: sessionitem.h:38
Represents data role of SessionItem in any cell of Qt's trees and tables.
Represents display name of SessionItem in any cell of Qt's trees and tables.

References ModelView::LabelDataRowStrategy::constructRow(), ModelView::LabelDataRowStrategy::horizontalHeaderLabels(), and ModelView::SessionItem::setData().

Here is the call graph for this function:

◆ TEST_F() [3/3]

TEST_F ( LabelDataRowStrategyTest  ,
topLevelItem   
)

Checks row construction for standard top level item, like Level, MultiLayer etc.

Definition at line 45 of file labeldatarowstrategy.test.cpp.

46 {
47  SessionItem item("model_type");
48 
49  LabelDataRowStrategy constructor;
50  auto items = constructor.constructRow(&item);
51  EXPECT_EQ(items.size(), expected_column_count); // label and empty items
52  EXPECT_EQ(constructor.horizontalHeaderLabels(), expected_labels);
53 
54  // checking that it is label and data
55  auto labelItem = dynamic_cast<ViewLabelItem*>(items.at(0).get());
56  auto dataItem = dynamic_cast<ViewDataItem*>(items.at(1).get());
57  ASSERT_TRUE(labelItem != nullptr);
58  EXPECT_EQ(labelItem->item(), &item);
59  ASSERT_TRUE(dataItem != nullptr);
60  EXPECT_EQ(dataItem->item(), &item);
61 }

References ModelView::LabelDataRowStrategy::constructRow(), and ModelView::LabelDataRowStrategy::horizontalHeaderLabels().

Here is the call graph for this function: