* check sorting single column of text with empty entries ascending */
| 660 | * check sorting single column of text with empty entries ascending |
| 661 | */ |
| 662 | void SpreadsheetTest::testSortSingleText1() { |
| 663 | const QVector<QString> xData{QStringLiteral("ben"), |
| 664 | QStringLiteral("amy"), |
| 665 | QStringLiteral("eddy"), |
| 666 | QString(), |
| 667 | QStringLiteral("carl"), |
| 668 | QStringLiteral("dan")}; |
| 669 | |
| 670 | Spreadsheet sheet(QStringLiteral("test"), false); |
| 671 | sheet.setColumnCount(1); |
| 672 | sheet.setRowCount(8); |
| 673 | auto* col = sheet.column(0); |
| 674 | col->setColumnMode(AbstractColumn::ColumnMode::Text); |
| 675 | col->replaceTexts(0, xData); |
| 676 | |
| 677 | // sort |
| 678 | sheet.sortColumns(nullptr, {col}, true); |
| 679 | |
| 680 | // values |
| 681 | QCOMPARE(col->textAt(0), QLatin1String("amy")); |
| 682 | QCOMPARE(col->textAt(1), QLatin1String("ben")); |
| 683 | QCOMPARE(col->textAt(2), QLatin1String("carl")); |
| 684 | QCOMPARE(col->textAt(3), QLatin1String("dan")); |
| 685 | QCOMPARE(col->textAt(4), QLatin1String("eddy")); |
| 686 | QCOMPARE(col->textAt(5), QString()); |
| 687 | QCOMPARE(col->textAt(6), QString()); |
| 688 | } |
| 689 | |
| 690 | /* |
| 691 | * check sorting single column of text with empty entries descending |
nothing calls this directly
no test coverage detected