sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx |    7 +------
 sw/qa/extras/odfimport/data/incorrectsum.odt             |binary
 sw/qa/extras/odfimport/odfimport.cxx                     |   13 +++++++++++++
 sw/source/filter/basflt/shellio.cxx                      |    2 +-
 4 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit c132a1abd57c109331191c3b3fbd14e1c5e46631
Author:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
AuthorDate: Mon Mar 6 17:00:10 2023 +0100
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>
CommitDate: Mon Mar 13 20:12:52 2023 +0000

    Always update fields when loading document
    
    to make sure that table formulas are re-evaluated after loading.
    
    When a document has a wrong sum saved (which seems to happen sometimes),
    this sum is used until user clicks into the table or otherwise
    refreshes the formula.
    
    Change-Id: I5cc3f983524b395089c17aa35d8641847a388bad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148355
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@allotropia.de>

diff --git a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx 
b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
index 235a5ccaf757..d24a0922b73e 100644
--- a/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
+++ b/sw/qa/core/accessibilitycheck/AccessibilityCheckTest.cxx
@@ -273,12 +273,7 @@ CPPUNIT_TEST_FIXTURE(AccessibilityCheckTest, 
testOnlineNodeSplitAppend)
 
     Scheduler::ProcessEventsToIdle();
 
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(0),
-                         
pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues());
-    // Trigger a11y checker
-    pWrtShell->Down(/*bSelect*/ false, /*nCount*/ 0);
-
-    // Check we have 1 a11y issue
+    // Check we have 2 a11y issue
     CPPUNIT_ASSERT_EQUAL(sal_Int32(2),
                          
pDoc->getOnlineAccessibilityCheck()->getNumberOfAccessibilityIssues());
     auto aIssues = scanAccessibilityIssuesOnNodes(pDoc);
diff --git a/sw/qa/extras/odfimport/data/incorrectsum.odt 
b/sw/qa/extras/odfimport/data/incorrectsum.odt
new file mode 100644
index 000000000000..0e1e99b0d699
Binary files /dev/null and b/sw/qa/extras/odfimport/data/incorrectsum.odt differ
diff --git a/sw/qa/extras/odfimport/odfimport.cxx 
b/sw/qa/extras/odfimport/odfimport.cxx
index cc84c5c16fb5..227814045ad5 100644
--- a/sw/qa/extras/odfimport/odfimport.cxx
+++ b/sw/qa/extras/odfimport/odfimport.cxx
@@ -46,6 +46,7 @@
 #include <comphelper/propertysequence.hxx>
 #include <comphelper/propertyvalue.hxx>
 #include <editeng/boxitem.hxx>
+#include <vcl/scheduler.hxx>
 
 #include <IDocumentSettingAccess.hxx>
 #include <wrtsh.hxx>
@@ -596,6 +597,18 @@ CPPUNIT_TEST_FIXTURE(Test, testFdo56272)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(422), xShape->getPosition().Y); // Was -2371
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testIncorrectSum)
+{
+    createSwDoc("incorrectsum.odt");
+    Scheduler::ProcessEventsToIdle();
+    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xCell(xTextTable->getCellByName("C3"), 
uno::UNO_QUERY);
+    // Use indexOf instead of exact match since the result contains an Euro 
sign which OUString doesn't like
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xCell->getString().indexOf("1,278"));
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testTdf128737)
 {
     createSwDoc("tdf128737.odt");
diff --git a/sw/source/filter/basflt/shellio.cxx 
b/sw/source/filter/basflt/shellio.cxx
index 3157943dcceb..c4bdc52c7590 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -383,7 +383,7 @@ ErrCode SwReader::Read( const Reader& rOptions )
         // not insert: set the redline mode read from settings.xml
         eOld = ePostReadRedlineFlags & ~RedlineFlags::Ignore;
 
-        mxDoc->getIDocumentFieldsAccess().SetFieldsDirty(false, nullptr, 
SwNodeOffset(0));
+        mxDoc->getIDocumentFieldsAccess().SetFieldsDirty(true, nullptr, 
SwNodeOffset(0));
     }
 
     mxDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( eOld );

Reply via email to