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

Implements class CLASS? More...

Include dependency graph for customplotsceneadapter.test.cpp:

Go to the source code of this file.

Classes

class  CustomPlotSceneAdapterTest
 Testing CustomPlotSceneAdapter. More...
 

Functions

 TEST_F (CustomPlotSceneAdapterTest, adapterBeforeCustomPlot)
 
 TEST_F (CustomPlotSceneAdapterTest, customPlotBeforeAdapter)
 Scenario when QCustomPlot destroyed before adapter. 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 customplotsceneadapter.test.cpp.

Function Documentation

◆ TEST_F() [1/2]

TEST_F ( CustomPlotSceneAdapterTest  ,
adapterBeforeCustomPlot   
)

Definition at line 46 of file customplotsceneadapter.test.cpp.

47 {
48  auto custom_plot = std::make_unique<QCustomPlot>();
49  auto adapter = std::make_unique<CustomPlotSceneAdapter>(custom_plot.get());
50 
51  adapter.reset();
52  custom_plot.reset(); // would cause SEGFAULT if connection to adapter still exists
53 }

◆ TEST_F() [2/2]

TEST_F ( CustomPlotSceneAdapterTest  ,
customPlotBeforeAdapter   
)

Scenario when QCustomPlot destroyed before adapter.

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

33 {
34  auto custom_plot = std::make_unique<QCustomPlot>();
35  auto adapter = std::make_unique<CustomPlotSceneAdapter>(custom_plot.get());
36 
37  // destroying QCustomPlot
38  custom_plot.reset();
39 
40  EXPECT_EQ(42, adapter->toSceneX(42));
41  EXPECT_EQ(42, adapter->toSceneY(42));
42  EXPECT_EQ(42, adapter->fromSceneX(42));
43  EXPECT_EQ(42, adapter->fromSceneY(42));
44 }