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

Method testRemoveRowsWithMissingValues

tests/spreadsheet/SpreadsheetTest.cpp:1216–1243  ·  view source on GitHub ↗

drop/mask

Source from the content-addressed store, hash-verified

1214// ********************* drop/mask *************************
1215// **********************************************************
1216void SpreadsheetTest::testRemoveRowsWithMissingValues() {
1217 // prepare the spreadsheet
1218 Spreadsheet sheet(QStringLiteral("test"), false);
1219 sheet.setColumnCount(2);
1220 sheet.setRowCount(5);
1221
1222 auto* col0{sheet.column(0)};
1223 col0->setColumnMode(AbstractColumn::ColumnMode::Double);
1224 col0->setValueAt(0, 0.);
1225 // missing value for row = 1
1226 col0->setValueAt(2, 2.);
1227 col0->setValueAt(3, 3.);
1228
1229 auto* col1{sheet.column(1)};
1230 col1->setColumnMode(AbstractColumn::ColumnMode::Double);
1231 col1->setValueAt(0, 0.);
1232 col1->setValueAt(1, 1.);
1233 // missing value for row = 2
1234 col1->setValueAt(3, 3.);
1235
1236 // remove rows with empty values and check the results
1237 sheet.removeEmptyRows();
1238 QCOMPARE(sheet.rowCount(), 2);
1239 QCOMPARE(col0->valueAt(0), 0.);
1240 QCOMPARE(col0->valueAt(1), 3.);
1241 QCOMPARE(col1->valueAt(0), 0.);
1242 QCOMPARE(col1->valueAt(1), 3.);
1243}
1244
1245void SpreadsheetTest::testMaskRowsWithMissingValues() {
1246 // prepare the spreadsheet

Callers

nothing calls this directly

Calls 8

removeEmptyRowsMethod · 0.80
setColumnCountMethod · 0.45
setRowCountMethod · 0.45
columnMethod · 0.45
setColumnModeMethod · 0.45
setValueAtMethod · 0.45
rowCountMethod · 0.45
valueAtMethod · 0.45

Tested by

no test coverage detected