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

Method addCurve

tests/analysis/fit/FitTest.cpp:38–65  ·  view source on GitHub ↗

############################################################################## ################# linear regression with NIST datasets ###################### ##############################################################################

Source from the content-addressed store, hash-verified

36// ################# linear regression with NIST datasets ######################
37// ##############################################################################
38void 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
67void FitTest::testLinearNorris() {
68 // NIST data for Norris dataset

Callers 7

addPlotMethod · 0.45
removeCurveMethod · 0.45
moveCurveMethod · 0.45
saveLoadMethod · 0.45

Calls 8

currentCurveMethod · 0.80
addFitCurveMethod · 0.80
addChildMethod · 0.45
setColumnCountMethod · 0.45
setNameMethod · 0.45
columnMethod · 0.45
setSelectedMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected