diff --git a/autotests/calculatetexttest.cpp b/autotests/calculatetexttest.cpp index d313367e4..f105daba4 100644 --- a/autotests/calculatetexttest.cpp +++ b/autotests/calculatetexttest.cpp @@ -91,6 +91,15 @@ void CalculateTextTest::testSimpleCalculate() // Test that updating the field also worked with sum QCOMPARE (fields[QStringLiteral ("Sum")]->text(), QStringLiteral( "40" )); + + // Test that undo / redo works + QVERIFY( m_document->canUndo() ); + m_document->undo(); + QCOMPARE( fields[QStringLiteral ("Sum")]->text(), QStringLiteral( "60" ) ); + + QVERIFY( m_document->canRedo() ); + m_document->redo(); + QCOMPARE( fields[QStringLiteral ("Sum")]->text(), QStringLiteral( "40" ) ); } QTEST_MAIN( CalculateTextTest ) diff --git a/core/document.cpp b/core/document.cpp index 33ac2107c..571099d0c 100644 --- a/core/document.cpp +++ b/core/document.cpp @@ -3406,6 +3406,7 @@ void DocumentPrivate::notifyAnnotationChanges( int page ) void DocumentPrivate::notifyFormChanges( int /*page*/ ) { + recalculateForms(); } void Document::addPageAnnotation( int page, Annotation * annotation )