MCPcopy Create free account
hub / github.com/KDE/labplot / pasteFitCurveSourceHistogram

Method pasteFitCurveSourceHistogram

tests/backend/core/AbstractAspectTest.cpp:293–319  ·  view source on GitHub ↗

! * check copy&paste (duplicate) of a XYFitCurve with the data source type "Histogram", * the pointer to the data source histogram must be properly restored after the duplication. */

Source from the content-addressed store, hash-verified

291 * the pointer to the data source histogram must be properly restored after the duplication.
292 */
293void AbstractAspectTest::pasteFitCurveSourceHistogram() {
294 Project project;
295
296 auto* worksheet = new Worksheet(QStringLiteral("Worksheet"));
297 project.addChild(worksheet);
298
299 auto* plot = new CartesianPlot(QStringLiteral("plot"));
300 worksheet->addChild(plot);
301
302 auto* histogram = new Histogram(QStringLiteral("histogram"));
303 plot->addChild(histogram);
304
305 auto* fitCurve = new XYFitCurve(QStringLiteral("fit"));
306 fitCurve->setDataSourceType(XYAnalysisCurve::DataSourceType::Histogram);
307 fitCurve->setDataSourceHistogram(histogram);
308 plot->addChild(fitCurve);
309
310 fitCurve->copy();
311 plot->paste();
312
313 // checks
314 const auto& fitCurves = project.children<XYFitCurve>(AbstractAspect::ChildIndexFlag::Recursive);
315 QCOMPARE(fitCurves.count(), 2);
316 auto* fitCurveCopy = fitCurves.at(1);
317 QCOMPARE(fitCurveCopy->dataSourceType(), XYAnalysisCurve::DataSourceType::Histogram);
318 QCOMPARE(fitCurveCopy->dataSourceHistogram(), histogram);
319}
320
321void AbstractAspectTest::saveLoad() {
322 Project project;

Callers

nothing calls this directly

Calls 6

setDataSourceTypeMethod · 0.80
pasteMethod · 0.80
addChildMethod · 0.45
copyMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected