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

Implements class CLASS? More...

Include dependency graph for customplot_test_utils.test.cpp:

Go to the source code of this file.

Classes

class  CustomplotTestUtilsTest
 Testing "utilr for testing" defined in TestUtils namespace. More...
 

Functions

 TEST_F (CustomplotTestUtilsTest, binCentersbinValues)
 Check methods to access graph bin centers and values. More...
 
 TEST_F (CustomplotTestUtilsTest, binErrors)
 Check methods to access graph errors. 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 customplot_test_utils.test.cpp.

Function Documentation

◆ TEST_F() [1/2]

TEST_F ( CustomplotTestUtilsTest  ,
binCentersbinValues   
)

Check methods to access graph bin centers and values.

Definition at line 32 of file customplot_test_utils.test.cpp.

33 {
34  QCustomPlot custom_plot;
35 
36  auto graph = custom_plot.addGraph();
37  graph->setData(QVector<double>({1, 2, 3}), QVector<double>({10, 20, 30}));
38 
39  EXPECT_EQ(TestUtils::binCenters(graph), std::vector<double>({1, 2, 3}));
40  EXPECT_EQ(TestUtils::binValues(graph), std::vector<double>({10, 20, 30}));
41 }
std::vector< double > binValues(const QCPGraph *graph)
Returns vector representing y-values on QCPgraph.
std::vector< double > binCenters(const QCPGraph *graph)
Returns vector representing bin centers on QCPgraph.

References TestUtils::binCenters(), and TestUtils::binValues().

Here is the call graph for this function:

◆ TEST_F() [2/2]

TEST_F ( CustomplotTestUtilsTest  ,
binErrors   
)

Check methods to access graph errors.

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

46 {
47  QCustomPlot custom_plot;
48 
49  auto graph = custom_plot.addGraph();
50  graph->setData(QVector<double>({1, 2, 3}), QVector<double>({10, 20, 30}));
51 
52  EXPECT_EQ(TestUtils::binErrors(graph), std::vector<double>());
53 
54  QCPErrorBars* errorBars = new QCPErrorBars(custom_plot.xAxis, custom_plot.yAxis);
55  errorBars->removeFromLegend();
56  errorBars->setDataPlottable(graph);
57  errorBars->setData(QVector<double>({0.1, 0.2, 0.3}));
58 
59  EXPECT_EQ(TestUtils::binErrors(graph), std::vector<double>({0.1, 0.2, 0.3}));
60 }
std::vector< double > binErrors(const QCPGraph *graph)
Returns vector representing bin errors of QCPGraph.

References TestUtils::binErrors().

Here is the call graph for this function: