| 536 | } |
| 537 | |
| 538 | void 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 | |
| 561 | QTEST_MAIN(SpreadsheetFormulaTest) |
nothing calls this directly
no test coverage detected