| 611 | } |
| 612 | |
| 613 | void ColumnTest::testFormulaAutoUpdateDisabled() { |
| 614 | Column sourceColumn(QStringLiteral("source"), Column::ColumnMode::Integer); |
| 615 | sourceColumn.setIntegers({1, 2, 3}); |
| 616 | |
| 617 | Column targetColumn(QStringLiteral("target"), Column::ColumnMode::Integer); |
| 618 | targetColumn.setIntegers({3, 2, 1}); |
| 619 | |
| 620 | // evaluatue 2*x and check the generated values in the target column |
| 621 | targetColumn.setColumnMode(AbstractColumn::ColumnMode::Double); |
| 622 | targetColumn.setFormula(QStringLiteral("2*x"), |
| 623 | QStringList{QStringLiteral("x")}, |
| 624 | QVector<Column*>({&sourceColumn}), |
| 625 | false /* autoUpdate */, |
| 626 | false /* autoResize */); |
| 627 | targetColumn.updateFormula(); |
| 628 | QCOMPARE(targetColumn.rowCount(), 3); |
| 629 | QCOMPARE(targetColumn.valueAt(0), 2); |
| 630 | QCOMPARE(targetColumn.valueAt(1), 4); |
| 631 | QCOMPARE(targetColumn.valueAt(2), 6); |
| 632 | |
| 633 | // modify value in the source column and check the target column again which shouldn't be updated |
| 634 | sourceColumn.setIntegers({3, 2, 1}); |
| 635 | QCOMPARE(targetColumn.rowCount(), 3); |
| 636 | QCOMPARE(targetColumn.valueAt(0), 2); |
| 637 | QCOMPARE(targetColumn.valueAt(1), 4); |
| 638 | QCOMPARE(targetColumn.valueAt(2), 6); |
| 639 | } |
| 640 | |
| 641 | void ColumnTest::testFormulaAutoResizeEnabled() { |
| 642 | Column sourceColumn1(QStringLiteral("source1"), Column::ColumnMode::Integer); |
nothing calls this directly
no test coverage detected