[Libreoffice-commits] core.git: sc/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 2 20:27:36 UTC 2021


 sc/qa/unit/uicalc/data/tdf97215.ods |binary
 sc/qa/unit/uicalc/uicalc.cxx        |   33 +++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

New commits:
commit e99608ce752f34ddb6611146c6cf4643c97d62f3
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Feb 2 16:39:59 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Feb 2 21:26:32 2021 +0100

    tdf#97215: sc_uicalc: Add unittest
    
    Change-Id: I829021d0ab5619317d831986309cab577499f278
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110326
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/unit/uicalc/data/tdf97215.ods b/sc/qa/unit/uicalc/data/tdf97215.ods
new file mode 100644
index 000000000000..e6b01a67b324
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf97215.ods differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 2d8d6389f907..5c42f7c61db4 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -140,6 +140,39 @@ ScModelObj* ScUiCalcTest::createDoc(const char* pName)
     return pModelObj;
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf97215)
+{
+    ScModelObj* pModelObj = createDoc("tdf97215.ods");
+    ScDocument* pDoc = pModelObj->GetDocument();
+    CPPUNIT_ASSERT(pDoc);
+
+    // Enable sorting with update reference
+    ScModule* pMod = SC_MOD();
+    ScInputOptions aInputOption = pMod->GetInputOptions();
+    bool bOldStatus = aInputOption.GetSortRefUpdate();
+    aInputOption.SetSortRefUpdate(true);
+    pMod->SetInputOptions(aInputOption);
+
+    CPPUNIT_ASSERT_EQUAL(OUString("Inserted at bottom"), pDoc->GetString(ScAddress(0, 23, 0)));
+
+    goToCell("A1:M24");
+
+    // Without the fix in place, this test would have hung here
+    dispatchCommand(mxComponent, ".uno:SortAscending", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(OUString("Inserted at bottom"), pDoc->GetString(ScAddress(0, 0, 0)));
+
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(OUString("Inserted at bottom"), pDoc->GetString(ScAddress(0, 23, 0)));
+
+    // Restore previous status
+    aInputOption.SetSortRefUpdate(bOldStatus);
+    pMod->SetInputOptions(aInputOption);
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf92963)
 {
     ScModelObj* pModelObj = createDoc("tdf92963.ods");


More information about the Libreoffice-commits mailing list