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

Method testSortSingleInteger2

tests/spreadsheet/SpreadsheetTest.cpp:578–601  ·  view source on GitHub ↗

* check sorting single column of integer values with empty entries ascending */

Source from the content-addressed store, hash-verified

576 * check sorting single column of integer values with empty entries ascending
577 */
578void 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

Callers

nothing calls this directly

Calls 7

setColumnCountMethod · 0.45
setRowCountMethod · 0.45
columnMethod · 0.45
setColumnModeMethod · 0.45
replaceIntegerMethod · 0.45
sortColumnsMethod · 0.45
integerAtMethod · 0.45

Tested by

no test coverage detected