! * 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. */
| 224 | * the pointers to the data source columns must be properly restored after the duplication. |
| 225 | */ |
| 226 | void 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", |
nothing calls this directly
no test coverage detected