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

Implements class CLASS? More...

Include dependency graph for colormapitem.test.cpp:

Go to the source code of this file.

Classes

class  ColorMapItemTest
 Testing ColorMapItem. More...
 

Functions

 TEST_F (ColorMapItemTest, initialState)
 Initial state. More...
 
 TEST_F (ColorMapItemTest, onSetDataItem)
 Check signaling on set data item. More...
 
 TEST_F (ColorMapItemTest, setDataItem)
 Setting dataItem in model context. 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 colormapitem.test.cpp.

Function Documentation

◆ TEST_F() [1/3]

TEST_F ( ColorMapItemTest  ,
initialState   
)

Initial state.

Definition at line 38 of file colormapitem.test.cpp.

39 {
40  ColorMapItem item;
41  EXPECT_TRUE(item.dataItem() == nullptr);
42  EXPECT_TRUE(item.property<bool>(ColorMapItem::P_INTERPOLATION));
43  EXPECT_EQ(item.property<ComboProperty>(ColorMapItem::P_GRADIENT).value(), "Polar");
44 }
Two-dimensional color map representation of Data2DItem.
Definition: colormapitem.h:28
Data2DItem * dataItem() const
Returns data item linked to the given ColorMapItem.
Custom property to define list of string values with multiple selections.
Definition: comboproperty.h:27
std::string value() const
T property(const std::string &tag) const
Returns data stored in property item.
Definition: sessionitem.h:181

References ModelView::ColorMapItem::dataItem(), ModelView::ColorMapItem::P_GRADIENT, ModelView::ColorMapItem::P_INTERPOLATION, ModelView::SessionItem::property(), and ModelView::ComboProperty::value().

Here is the call graph for this function:

◆ TEST_F() [2/3]

TEST_F ( ColorMapItemTest  ,
onSetDataItem   
)

Check signaling on set data item.

Definition at line 61 of file colormapitem.test.cpp.

62 {
63  SessionModel model;
64  auto data_item = model.insertItem<Data2DItem>();
65  auto colormap_item = model.insertItem<ColorMapItem>();
66 
67  MockWidgetForItem widget(colormap_item);
68 
69  EXPECT_CALL(widget, onDataChange(_, _)).Times(0);
70  EXPECT_CALL(widget, onPropertyChange(colormap_item, ColorMapItem::P_LINK)).Times(1);
71  EXPECT_CALL(widget, onChildPropertyChange(_, _)).Times(0);
72  EXPECT_CALL(widget, onItemInserted(_, _)).Times(0);
73  EXPECT_CALL(widget, onAboutToRemoveItem(_, _)).Times(0);
74 
75  // performing action
76  colormap_item->setDataItem(data_item);
77 }
Mock widget to test ItemMapper functionality.
Definition: mockwidgets.h:36
Represents two-dimensional data (axes definition and 2d array of values).
Definition: data2ditem.h:29
Main class to hold hierarchy of SessionItem objects.
Definition: sessionmodel.h:37
T * insertItem(SessionItem *parent=nullptr, const TagRow &tagrow={})
Inserts item into given parent under given tagrow.
Definition: sessionmodel.h:104

References ModelView::SessionModel::insertItem(), and ModelView::ColorMapItem::P_LINK.

Here is the call graph for this function:

◆ TEST_F() [3/3]

TEST_F ( ColorMapItemTest  ,
setDataItem   
)

Setting dataItem in model context.

Definition at line 48 of file colormapitem.test.cpp.

49 {
50  SessionModel model;
51  auto data_item = model.insertItem<Data2DItem>();
52  auto colormap_item = model.insertItem<ColorMapItem>();
53 
54  colormap_item->setDataItem(data_item);
55 
56  EXPECT_EQ(colormap_item->dataItem(), data_item);
57 }

References ModelView::SessionModel::insertItem().

Here is the call graph for this function: