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

Method spreadsheetRemoveRows

tests/cartesianplot/CartesianPlotTest.cpp:1288–1342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1286}
1287
1288void CartesianPlotTest::spreadsheetRemoveRows() {
1289 Project project;
1290
1291 auto* worksheet = new Worksheet(QStringLiteral("Worksheet"));
1292 project.addChild(worksheet);
1293
1294 auto* plot = new CartesianPlot(QStringLiteral("plot"));
1295 worksheet->addChild(plot);
1296 plot->setType(CartesianPlot::Type::TwoAxes); // Otherwise no axis are created
1297 plot->setNiceExtend(false);
1298
1299 auto* sheet = new Spreadsheet(QStringLiteral("data"), false);
1300 project.addChild(sheet);
1301 sheet->setColumnCount(2);
1302
1303 const auto& columns = sheet->children<Column>();
1304 QCOMPARE(columns.count(), 2);
1305 Column* xColumn = columns.at(0);
1306 Column* yColumn = columns.at(1);
1307
1308 xColumn->replaceValues(-1,
1309 {
1310 1.,
1311 2.,
1312 3.,
1313 4.,
1314 5.,
1315 });
1316 yColumn->replaceValues(-1,
1317 {
1318 0.,
1319 4.,
1320 6.,
1321 8.,
1322 10.,
1323 });
1324
1325 auto* curve = new XYCurve(QStringLiteral("curve"));
1326 plot->addChild(curve);
1327 curve->setXColumn(xColumn);
1328 curve->setYColumn(yColumn);
1329
1330 CHECK_RANGE(plot, curve, Dimension::X, 1., 5.);
1331 CHECK_RANGE(plot, curve, Dimension::Y, 0., 10.);
1332
1333 sheet->removeRows(4, 1);
1334
1335 CHECK_RANGE(plot, curve, Dimension::X, 1., 4.);
1336 CHECK_RANGE(plot, curve, Dimension::Y, 0., 8.);
1337
1338 project.undoStack()->undo();
1339
1340 CHECK_RANGE(plot, curve, Dimension::X, 1., 5.);
1341 CHECK_RANGE(plot, curve, Dimension::Y, 0., 10.);
1342}
1343
1344void CartesianPlotTest::spreadsheetInsertRows() {
1345 Project project;

Callers

nothing calls this directly

Calls 11

setNiceExtendMethod · 0.80
setYColumnMethod · 0.80
addChildMethod · 0.45
setTypeMethod · 0.45
setColumnCountMethod · 0.45
countMethod · 0.45
replaceValuesMethod · 0.45
setXColumnMethod · 0.45
removeRowsMethod · 0.45
undoMethod · 0.45
undoStackMethod · 0.45

Tested by

no test coverage detected