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

Method testMaskRowsWithMissingValues

tests/spreadsheet/SpreadsheetTest.cpp:1245–1278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1243}
1244
1245void SpreadsheetTest::testMaskRowsWithMissingValues() {
1246 // prepare the spreadsheet
1247 Spreadsheet sheet(QStringLiteral("test"), false);
1248 sheet.setColumnCount(2);
1249 sheet.setRowCount(5);
1250
1251 auto* col0{sheet.column(0)};
1252 col0->setColumnMode(AbstractColumn::ColumnMode::Double);
1253 col0->setValueAt(0, 0.);
1254 // missing value for row = 1
1255 col0->setValueAt(2, 2.);
1256 col0->setValueAt(3, 3.);
1257
1258 auto* col1{sheet.column(1)};
1259 col1->setColumnMode(AbstractColumn::ColumnMode::Double);
1260 col1->setValueAt(0, 0.);
1261 col1->setValueAt(1, 1.);
1262 // missing value for row = 2
1263 col1->setValueAt(3, 3.);
1264
1265 // mask rows with empty values and check the results
1266 sheet.maskEmptyRows();
1267 QCOMPARE(sheet.rowCount(), 5);
1268 QCOMPARE(col0->isMasked(0), false);
1269 QCOMPARE(col0->isMasked(1), true);
1270 QCOMPARE(col0->isMasked(2), true);
1271 QCOMPARE(col0->isMasked(3), false);
1272 QCOMPARE(col0->isMasked(4), true);
1273 QCOMPARE(col1->isMasked(0), false);
1274 QCOMPARE(col1->isMasked(1), true);
1275 QCOMPARE(col1->isMasked(2), true);
1276 QCOMPARE(col1->isMasked(3), false);
1277 QCOMPARE(col1->isMasked(4), true);
1278}
1279
1280// **********************************************************
1281// ********************* flattening ************************

Callers

nothing calls this directly

Calls 8

maskEmptyRowsMethod · 0.80
setColumnCountMethod · 0.45
setRowCountMethod · 0.45
columnMethod · 0.45
setColumnModeMethod · 0.45
setValueAtMethod · 0.45
rowCountMethod · 0.45
isMaskedMethod · 0.45

Tested by

no test coverage detected