* check sorting single column of text with empty entries descending */
| 691 | * check sorting single column of text with empty entries descending |
| 692 | */ |
| 693 | void SpreadsheetTest::testSortSingleText2() { |
| 694 | const QVector<QString> xData = |
| 695 | {QStringLiteral("ben"), QStringLiteral("amy"), QStringLiteral("eddy"), QString(), QStringLiteral("carl"), QStringLiteral("dan")}; |
| 696 | |
| 697 | Spreadsheet sheet(QStringLiteral("test"), false); |
| 698 | sheet.setColumnCount(1); |
| 699 | sheet.setRowCount(8); |
| 700 | auto* col = sheet.column(0); |
| 701 | col->setColumnMode(AbstractColumn::ColumnMode::Text); |
| 702 | col->replaceTexts(0, xData); |
| 703 | |
| 704 | // sort |
| 705 | sheet.sortColumns(nullptr, {col}, false); |
| 706 | |
| 707 | // values |
| 708 | QCOMPARE(col->textAt(0), QLatin1String("eddy")); |
| 709 | QCOMPARE(col->textAt(1), QLatin1String("dan")); |
| 710 | QCOMPARE(col->textAt(2), QLatin1String("carl")); |
| 711 | QCOMPARE(col->textAt(3), QLatin1String("ben")); |
| 712 | QCOMPARE(col->textAt(4), QLatin1String("amy")); |
| 713 | QCOMPARE(col->textAt(5), QString()); |
| 714 | QCOMPARE(col->textAt(6), QString()); |
| 715 | } |
| 716 | |
| 717 | /* |
| 718 | * check sorting single column of datetimes with invalid entries ascending |
nothing calls this directly
no test coverage detected