[Libreoffice-commits] core.git: sc/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Thu Mar 25 15:03:23 UTC 2021
sc/qa/unit/ucalc.cxx | 32 ++++++++++++++++++++++++++++++++
sc/qa/unit/ucalc.hxx | 2 ++
2 files changed, 34 insertions(+)
New commits:
commit c8c5a06eed6c22e40bda9787ace5467d551130b6
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Mar 25 15:03:40 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Mar 25 16:02:38 2021 +0100
tdf#98642: sc_ucalc: Add unittest
Change-Id: I38e08ebec6f0a6a50290e8009cffbddfe89ba934
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113099
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index ec424f97f1d9..52dedc42c070 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3399,6 +3399,38 @@ void Test::testAdvancedFilter()
m_pDoc->DeleteTab(0);
}
+void Test::testTdf98642()
+{
+ m_pDoc->InsertTab(0, "Sheet1");
+ m_pDoc->SetString(0, 0, 0, "test");
+
+ ScRangeData* pName1 = new ScRangeData( *m_pDoc, "name1", "$Sheet1.$A$1");
+ ScRangeData* pName2 = new ScRangeData( *m_pDoc, "name2", "$Sheet1.$A$1");
+
+ std::unique_ptr<ScRangeName> pGlobalRangeName(new ScRangeName());
+ pGlobalRangeName->insert(pName1);
+ pGlobalRangeName->insert(pName2);
+ m_pDoc->SetRangeName(std::move(pGlobalRangeName));
+
+ m_pDoc->SetString(1, 0, 0, "=name1");
+ m_pDoc->SetString(1, 1, 0, "=name2");
+
+ CPPUNIT_ASSERT_EQUAL(OUString("test"), m_pDoc->GetString(1, 0, 0));
+ CPPUNIT_ASSERT_EQUAL(OUString("test"), m_pDoc->GetString(1, 1, 0));
+
+ OUString aFormula;
+ m_pDoc->GetFormula(1,0,0, aFormula);
+ CPPUNIT_ASSERT_EQUAL(OUString("=name1"), aFormula);
+ m_pDoc->GetFormula(1,1,0, aFormula);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: =name2
+ // - Actual : =name1
+ CPPUNIT_ASSERT_EQUAL(OUString("=name2"), aFormula);
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testCopyPaste()
{
m_pDoc->InsertTab(0, "Sheet1");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index 1f6dc580922c..d5000f042c1e 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -380,6 +380,7 @@ public:
void testAutofilter();
void testAutoFilterTimeValue();
void testAdvancedFilter();
+ void testTdf98642();
void testCopyPaste();
void testCopyPasteAsLink();
void testCopyPasteTranspose();
@@ -746,6 +747,7 @@ public:
CPPUNIT_TEST(testAutofilter);
CPPUNIT_TEST(testAutoFilterTimeValue);
CPPUNIT_TEST(testAdvancedFilter);
+ CPPUNIT_TEST(testTdf98642);
CPPUNIT_TEST(testCopyPaste);
CPPUNIT_TEST(testCopyPasteAsLink);
CPPUNIT_TEST(testCopyPasteTranspose);
More information about the Libreoffice-commits
mailing list