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

Method pasteFitCurveSourceCurve

tests/backend/core/AbstractAspectTest.cpp:261–287  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

259 * the pointer to the data source curve must be properly restored after the duplication.
260 */
261void AbstractAspectTest::pasteFitCurveSourceCurve() {
262 Project project;
263
264 auto* worksheet = new Worksheet(QStringLiteral("Worksheet"));
265 project.addChild(worksheet);
266
267 auto* plot = new CartesianPlot(QStringLiteral("plot"));
268 worksheet->addChild(plot);
269
270 auto* xyCurve = new XYCurve(QStringLiteral("xy-curve"));
271 plot->addChild(xyCurve);
272
273 auto* fitCurve = new XYFitCurve(QStringLiteral("fit"));
274 fitCurve->setDataSourceType(XYAnalysisCurve::DataSourceType::Curve);
275 fitCurve->setDataSourceCurve(xyCurve);
276 plot->addChild(fitCurve);
277
278 fitCurve->copy();
279 plot->paste();
280
281 // checks
282 const auto& fitCurves = project.children<XYFitCurve>(AbstractAspect::ChildIndexFlag::Recursive);
283 QCOMPARE(fitCurves.count(), 2);
284 auto* fitCurveCopy = fitCurves.at(1);
285 QCOMPARE(fitCurveCopy->dataSourceType(), XYAnalysisCurve::DataSourceType::Curve);
286 QCOMPARE(fitCurveCopy->dataSourceCurve(), xyCurve);
287}
288
289/*!
290 * check copy&paste (duplicate) of a XYFitCurve with the data source type "Histogram",

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected