| 692 | } |
| 693 | |
| 694 | void ColumnTest::testFormulaAutoUpdateEnabledResize() { |
| 695 | Column sourceColumn(QStringLiteral("source"), Column::ColumnMode::Integer); |
| 696 | sourceColumn.setIntegers({1, 2, 3, 4}); |
| 697 | |
| 698 | Column targetColumn(QStringLiteral("target"), Column::ColumnMode::Integer); |
| 699 | targetColumn.setIntegers({3, 2, 1}); |
| 700 | |
| 701 | // evaluatue 2*x and check the generated values in the target column |
| 702 | targetColumn.setColumnMode(AbstractColumn::ColumnMode::Double); // should happen automatically in Column::setFormula() |
| 703 | targetColumn.setFormula(QStringLiteral("2*x"), |
| 704 | QStringList{QStringLiteral("x")}, |
| 705 | QVector<Column*>({&sourceColumn}), |
| 706 | true /* autoUpdate */, |
| 707 | false /* autoResize */); |
| 708 | targetColumn.updateFormula(); |
| 709 | QCOMPARE(targetColumn.rowCount(), 3); |
| 710 | QCOMPARE(targetColumn.valueAt(0), 2); |
| 711 | QCOMPARE(targetColumn.valueAt(1), 4); |
| 712 | QCOMPARE(targetColumn.valueAt(2), 6); |
| 713 | |
| 714 | targetColumn.insertRows(3, 1); // Rowcount of the target changes |
| 715 | |
| 716 | // Values updated |
| 717 | QCOMPARE(targetColumn.rowCount(), 4); |
| 718 | QCOMPARE(targetColumn.valueAt(0), 2); |
| 719 | QCOMPARE(targetColumn.valueAt(1), 4); |
| 720 | QCOMPARE(targetColumn.valueAt(2), 6); |
| 721 | QCOMPARE(targetColumn.valueAt(3), 8); |
| 722 | } |
| 723 | |
| 724 | void ColumnTest::testDictionaryIndex() { |
| 725 | Column c(QStringLiteral("Text column"), Column::ColumnMode::Text); |
nothing calls this directly
no test coverage detected