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

Implements class CLASS? More...

Include dependency graph for plottableitems.test.cpp:

Go to the source code of this file.

Classes

class  PlottableItemsTest
 Testing PlottableItemsTest. More...
 

Functions

 TEST_F (PlottableItemsTest, penItem_initialState)
 Initial state. More...
 
 TEST_F (PlottableItemsTest, penItem_setNamedColor)
 
 TEST_F (PlottableItemsTest, penItem_setSelected)
 

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 plottableitems.test.cpp.

Function Documentation

◆ TEST_F() [1/3]

TEST_F ( PlottableItemsTest  ,
penItem_initialState   
)

Initial state.

Definition at line 33 of file plottableitems.test.cpp.

34 {
35  PenItem item;
36  EXPECT_EQ(item.property<QColor>(PenItem::P_COLOR), QColor(Qt::black));
37  EXPECT_EQ(item.property<int>(PenItem::P_WIDTH), 1);
38  EXPECT_EQ(item.property<ComboProperty>(PenItem::P_STYLE).currentIndex(), Qt::SolidLine);
39 }
Custom property to define list of string values with multiple selections.
Definition: comboproperty.h:27
Represents basics settings of QPen.
T property(const std::string &tag) const
Returns data stored in property item.
Definition: sessionitem.h:181

References ModelView::ComboProperty::currentIndex(), ModelView::PenItem::P_COLOR, ModelView::PenItem::P_STYLE, ModelView::PenItem::P_WIDTH, and ModelView::SessionItem::property().

Here is the call graph for this function:

◆ TEST_F() [2/3]

TEST_F ( PlottableItemsTest  ,
penItem_setNamedColor   
)

Definition at line 52 of file plottableitems.test.cpp.

53 {
54  PenItem item;
55  item.setNamedColor("mediumaquamarine");
56  EXPECT_EQ(item.colorName(), std::string("#66cdaa"));
57 }
std::string colorName() const
Returns color name in #RRGGBB format.
void setNamedColor(const std::string &named_color)
Sets named color following schema from https://www.w3.org/TR/css-color-3/#svg-color.

References ModelView::PenItem::colorName(), and ModelView::PenItem::setNamedColor().

Here is the call graph for this function:

◆ TEST_F() [3/3]

TEST_F ( PlottableItemsTest  ,
penItem_setSelected   
)

Definition at line 41 of file plottableitems.test.cpp.

42 {
43  PenItem item;
44 
45  item.setSelected(true);
46  EXPECT_EQ(item.property<ComboProperty>(PenItem::P_STYLE).currentIndex(), Qt::DashLine);
47 
48  item.setSelected(false);
49  EXPECT_EQ(item.property<ComboProperty>(PenItem::P_STYLE).currentIndex(), Qt::SolidLine);
50 }
void setSelected(bool is_selected)
Sets style of the pen to represent selected object (dash line).

References ModelView::ComboProperty::currentIndex(), ModelView::PenItem::P_STYLE, ModelView::SessionItem::property(), and ModelView::PenItem::setSelected().

Here is the call graph for this function: