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

Method formulaUpdateAfterPaste

tests/spreadsheet/SpreadsheetFormulaTest.cpp:503–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

501}
502
503void SpreadsheetFormulaTest::formulaUpdateAfterPaste() {
504 INIT_SPREADSHEET
505
506 auto* col1 = sheet.column(0);
507 auto* col2 = sheet.column(1);
508 col2->setFormula(QLatin1String("x"), variableNames, variableColumns, true);
509 col2->updateFormula();
510
511 // values
512 for (int i = 0; i < rows; i++) {
513 QCOMPARE(col1->valueAt(i), i + 1);
514 QCOMPARE(col2->valueAt(i), i + 1);
515 }
516
517 // paste three values into the first column and check the updated values
518 const QString str = QStringLiteral("10\n20\n30");
519 QApplication::clipboard()->setText(str);
520 SpreadsheetView viewToPaste(&sheet, false);
521 viewToPaste.pasteIntoSelection();
522
523 // check the first three rows
524 QCOMPARE(col1->valueAt(0), 10);
525 QCOMPARE(col2->valueAt(0), 10);
526 QCOMPARE(col1->valueAt(1), 20);
527 QCOMPARE(col2->valueAt(1), 20);
528 QCOMPARE(col1->valueAt(2), 30);
529 QCOMPARE(col2->valueAt(2), 30);
530
531 // check the remaining rows
532 for (int i = 3; i < rows; i++) {
533 QCOMPARE(col1->valueAt(i), i + 1);
534 QCOMPARE(col2->valueAt(i), i + 1);
535 }
536}
537
538void SpreadsheetFormulaTest::formulaUpdateAfterRowRemoval() {
539 INIT_SPREADSHEET2

Callers

nothing calls this directly

Calls 6

columnMethod · 0.45
setFormulaMethod · 0.45
updateFormulaMethod · 0.45
valueAtMethod · 0.45
setTextMethod · 0.45
pasteIntoSelectionMethod · 0.45

Tested by

no test coverage detected