| 501 | } |
| 502 | |
| 503 | void 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 | |
| 538 | void SpreadsheetFormulaTest::formulaUpdateAfterRowRemoval() { |
| 539 | INIT_SPREADSHEET2 |
nothing calls this directly
no test coverage detected