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

Method testSortSingleText2

tests/spreadsheet/SpreadsheetTest.cpp:693–715  ·  view source on GitHub ↗

* check sorting single column of text with empty entries descending */

Source from the content-addressed store, hash-verified

691 * check sorting single column of text with empty entries descending
692 */
693void 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

Callers

nothing calls this directly

Calls 8

QStringClass · 0.50
setColumnCountMethod · 0.45
setRowCountMethod · 0.45
columnMethod · 0.45
setColumnModeMethod · 0.45
replaceTextsMethod · 0.45
sortColumnsMethod · 0.45
textAtMethod · 0.45

Tested by

no test coverage detected