############################################################################## ################# linear regression with NIST datasets ###################### ##############################################################################
| 36 | // ################# linear regression with NIST datasets ###################### |
| 37 | // ############################################################################## |
| 38 | void FitTest::addCurve() { |
| 39 | Project project; |
| 40 | |
| 41 | auto* ws = new Worksheet(QStringLiteral("Worksheet")); |
| 42 | project.addChild(ws); |
| 43 | |
| 44 | auto* plot = new CartesianPlot(QStringLiteral("plot")); |
| 45 | ws->addChild(plot); |
| 46 | |
| 47 | auto* sheet = new Spreadsheet(QStringLiteral("sheet")); |
| 48 | project.addChild(sheet); |
| 49 | sheet->setColumnCount(2); |
| 50 | sheet->column(0)->setName(QStringLiteral("x")); |
| 51 | sheet->column(1)->setName(QStringLiteral("y")); |
| 52 | |
| 53 | auto* curve = new XYCurve(QStringLiteral("curve")); |
| 54 | plot->addChild(curve); |
| 55 | |
| 56 | curve->d_func()->setSelected(true); |
| 57 | QCOMPARE(plot->currentCurve(), curve); |
| 58 | |
| 59 | plot->addFitCurve(); // Should not crash and curve should be assigned accordingly |
| 60 | |
| 61 | const auto& analysisCurves = plot->children<XYAnalysisCurve>(); |
| 62 | QCOMPARE(analysisCurves.count(), 1); |
| 63 | |
| 64 | QCOMPARE(analysisCurves.at(0)->d_func()->dataSourceCurve, curve); |
| 65 | } |
| 66 | |
| 67 | void FitTest::testLinearNorris() { |
| 68 | // NIST data for Norris dataset |
no test coverage detected