! * 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. */
| 259 | * the pointer to the data source curve must be properly restored after the duplication. |
| 260 | */ |
| 261 | void 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", |
nothing calls this directly
no test coverage detected