* check sorting single column of integer values with empty entries ascending */
| 576 | * check sorting single column of integer values with empty entries ascending |
| 577 | */ |
| 578 | void SpreadsheetTest::testSortSingleInteger2() { |
| 579 | const QVector<int> xData1{4, 5, 2}; |
| 580 | const QVector<int> xData2{3, 6, -1}; |
| 581 | |
| 582 | Spreadsheet sheet(QStringLiteral("test"), false); |
| 583 | sheet.setColumnCount(1); |
| 584 | sheet.setRowCount(7); |
| 585 | auto* col = sheet.column(0); |
| 586 | col->setColumnMode(AbstractColumn::ColumnMode::Integer); |
| 587 | col->replaceInteger(0, xData1); |
| 588 | col->replaceInteger(4, xData2); |
| 589 | |
| 590 | // sort |
| 591 | sheet.sortColumns(nullptr, {col}, false); |
| 592 | |
| 593 | // values |
| 594 | QCOMPARE(col->integerAt(6), -1); |
| 595 | QCOMPARE(col->integerAt(5), 0); |
| 596 | QCOMPARE(col->integerAt(4), 2); |
| 597 | QCOMPARE(col->integerAt(3), 3); |
| 598 | QCOMPARE(col->integerAt(2), 4); |
| 599 | QCOMPARE(col->integerAt(1), 5); |
| 600 | QCOMPARE(col->integerAt(0), 6); |
| 601 | } |
| 602 | |
| 603 | /* |
| 604 | * check sorting single column of big int values with empty entries ascending |
nothing calls this directly
no test coverage detected