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

Method pasteFitCurveSourceSpreadsheet

tests/backend/core/AbstractAspectTest.cpp:226–255  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

224 * the pointers to the data source columns must be properly restored after the duplication.
225 */
226void AbstractAspectTest::pasteFitCurveSourceSpreadsheet() {
227 Project project;
228
229 auto* spreadsheet = new Spreadsheet(QStringLiteral("Spreadsheet"));
230 spreadsheet->setColumnCount(2);
231 project.addChild(spreadsheet);
232
233 auto* worksheet = new Worksheet(QStringLiteral("Worksheet"));
234 project.addChild(worksheet);
235
236 auto* plot = new CartesianPlot(QStringLiteral("plot"));
237 worksheet->addChild(plot);
238
239 auto* fitCurve = new XYFitCurve(QStringLiteral("fit"));
240 fitCurve->setDataSourceType(XYAnalysisCurve::DataSourceType::Spreadsheet);
241 fitCurve->setXDataColumn(spreadsheet->column(0));
242 fitCurve->setYDataColumn(spreadsheet->column(1));
243 plot->addChild(fitCurve);
244
245 fitCurve->copy();
246 plot->paste();
247
248 // checks
249 const auto& fitCurves = project.children<XYFitCurve>(AbstractAspect::ChildIndexFlag::Recursive);
250 QCOMPARE(fitCurves.count(), 2);
251 auto* fitCurveCopy = fitCurves.at(1);
252 QCOMPARE(fitCurveCopy->dataSourceType(), XYAnalysisCurve::DataSourceType::Spreadsheet);
253 QCOMPARE(fitCurveCopy->xDataColumn(), spreadsheet->column(0));
254 QCOMPARE(fitCurveCopy->yDataColumn(), spreadsheet->column(1));
255}
256
257/*!
258 * check copy&paste (duplicate) of a XYFitCurve with the data source type "Curve",

Callers

nothing calls this directly

Calls 9

setDataSourceTypeMethod · 0.80
setXDataColumnMethod · 0.80
setYDataColumnMethod · 0.80
pasteMethod · 0.80
setColumnCountMethod · 0.45
addChildMethod · 0.45
columnMethod · 0.45
copyMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected