| 1243 | } |
| 1244 | |
| 1245 | void 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 ************************ |
nothing calls this directly
no test coverage detected