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

Method testSortSingleInteger1

tests/spreadsheet/SpreadsheetTest.cpp:550–573  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

548 * check sorting single column of integer values with empty entries ascending
549 */
550void SpreadsheetTest::testSortSingleInteger1() {
551 const QVector<int> xData1{4, 5, 2};
552 const QVector<int> xData2{3, 6, -1};
553
554 Spreadsheet sheet(QStringLiteral("test"), false);
555 sheet.setColumnCount(1);
556 sheet.setRowCount(7);
557 auto* col = sheet.column(0);
558 col->setColumnMode(AbstractColumn::ColumnMode::Integer);
559 col->replaceInteger(0, xData1);
560 col->replaceInteger(4, xData2);
561
562 // sort
563 sheet.sortColumns(nullptr, {col}, true);
564
565 // values
566 QCOMPARE(col->integerAt(0), -1);
567 QCOMPARE(col->integerAt(1), 0);
568 QCOMPARE(col->integerAt(2), 2);
569 QCOMPARE(col->integerAt(3), 3);
570 QCOMPARE(col->integerAt(4), 4);
571 QCOMPARE(col->integerAt(5), 5);
572 QCOMPARE(col->integerAt(6), 6);
573}
574
575/*
576 * check sorting single column of integer 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