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

Method formulaUpdateAfterRowRemoval

tests/spreadsheet/SpreadsheetFormulaTest.cpp:538–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

536}
537
538void SpreadsheetFormulaTest::formulaUpdateAfterRowRemoval() {
539 INIT_SPREADSHEET2
540
541 sheet.column(2)->setFormula(QLatin1String("x + y"), variableNames, variableColumns, true);
542 sheet.column(2)->updateFormula();
543
544 // check the initial values
545 for (int i = 0; i < sheet.rowCount(); i++) {
546 QCOMPARE(sheet.column(0)->valueAt(i), i + 1);
547 QCOMPARE(sheet.column(1)->valueAt(i), 1);
548 QCOMPARE(sheet.column(2)->valueAt(i), i + 2);
549 }
550
551 // select the rows from 10 to 15 and delete them
552 view.setCellsSelected(9, 0, 14, 2, true);
553 view.removeSelectedRows();
554
555 // re-check the values in the calculated column
556 QCOMPARE(sheet.rowCount(), 94);
557 for (int i = 0; i < sheet.rowCount(); i++)
558 QCOMPARE(sheet.column(2)->valueAt(i), sheet.column(0)->valueAt(i) + 1);
559}
560
561QTEST_MAIN(SpreadsheetFormulaTest)

Callers

nothing calls this directly

Calls 6

updateFormulaMethod · 0.45
columnMethod · 0.45
rowCountMethod · 0.45
valueAtMethod · 0.45
setCellsSelectedMethod · 0.45
removeSelectedRowsMethod · 0.45

Tested by

no test coverage detected