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

Method testFormulaAutoUpdateDisabled

tests/backend/Column/ColumnTest.cpp:613–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

611}
612
613void 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
641void ColumnTest::testFormulaAutoResizeEnabled() {
642 Column sourceColumn1(QStringLiteral("source1"), Column::ColumnMode::Integer);

Callers

nothing calls this directly

Calls 6

setIntegersMethod · 0.80
setColumnModeMethod · 0.45
setFormulaMethod · 0.45
updateFormulaMethod · 0.45
rowCountMethod · 0.45
valueAtMethod · 0.45

Tested by

no test coverage detected