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

Method removeColumn

tests/backend/InfoElement/InfoElementTest.cpp:188–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186}
187
188void InfoElementTest::removeColumn() {
189 Project project;
190 auto* ws = new Worksheet(QStringLiteral("worksheet"));
191 QVERIFY(ws != nullptr);
192 project.addChild(ws);
193
194 auto* p = new CartesianPlot(QStringLiteral("plot"));
195 QVERIFY(p != nullptr);
196 ws->addChild(p);
197
198 auto* curve{new XYCurve(QStringLiteral("f(x)"))};
199 curve->setCoordinateSystemIndex(p->defaultCoordinateSystemIndex());
200
201 auto* spreadsheet = new Spreadsheet(QStringLiteral("spreadsheet"));
202 spreadsheet->setRowCount(11);
203 project.addChild(spreadsheet);
204 const auto& columns = spreadsheet->children<Column>();
205 QCOMPARE(columns.count(), 2);
206
207 auto* xColumn = columns.at(0);
208 auto* yColumn = columns.at(1);
209
210 for (int i = 0; i < spreadsheet->rowCount(); i++) {
211 const double value = i;
212 xColumn->setValueAt(i, value);
213 yColumn->setValueAt(i, value);
214 }
215
216 curve->setXColumn(xColumn);
217 curve->setYColumn(yColumn);
218 p->addChild(curve);
219
220 CHECK_RANGE(p, curve, Dimension::X, 0., 10.);
221 CHECK_RANGE(p, curve, Dimension::Y, 0., 10.);
222
223 auto* ie = new InfoElement(QStringLiteral("InfoElement"), p, curve, 4.9);
224 QVERIFY(ie != nullptr);
225 p->addChild(ie);
226
227 {
228 const auto points = ie->children<CustomPoint>();
229 QCOMPARE(ie->markerPointsCount(), 1);
230 QCOMPARE(ie->markerPointAt(0).curve, curve);
231 QCOMPARE(points.count(), 1);
232 QCOMPARE(ie->markerPointAt(0).customPoint, points.at(0));
233 QCOMPARE(points.at(0)->positionLogical(), QPointF(5, 5));
234 }
235 QCOMPARE(ie->connectionLineCurveName(), curve->name());
236
237 // InfoElement is invalid
238 const auto& labels = ie->children<TextLabel>(AbstractAspect::ChildIndexFlag::IncludeHidden);
239 const auto& points = ie->children<CustomPoint>();
240 QCOMPARE(labels.count(), 1);
241 QCOMPARE(points.count(), 1);
242
243 QCOMPARE(ie->isValid(), true);
244 QCOMPARE(labels.at(0)->isVisible(), true);
245 QCOMPARE(points.at(0)->isVisible(), true);

Callers

nothing calls this directly

Calls 15

setYColumnMethod · 0.80
markerPointsCountMethod · 0.80
markerPointAtMethod · 0.80
QPointFClass · 0.50
addChildMethod · 0.45
setRowCountMethod · 0.45
countMethod · 0.45
rowCountMethod · 0.45
setValueAtMethod · 0.45
setXColumnMethod · 0.45

Tested by

no test coverage detected