diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-11-18 18:19:47 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-11-18 19:23:53 +0100 |
commit | 7f326714ffbed94a4107b1e896898c1be89ca938 (patch) | |
tree | 572bd81b7b4a5dd32e2e2e1b549cdb01a0f264bf /sc | |
parent | 99e860b5231f86600ebb63b73d6ee557acc44ac8 (diff) |
tdf#76836: sc_ucalc: Add unittest
Change-Id: I62d4325dcaee19188529bb749801dc945c060572
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125487
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index cc101bfe2253..32a53aa25649 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -169,6 +169,7 @@ public: void testDataArea(); void testAutofilter(); void testAutoFilterTimeValue(); + void testTdf76836(); void testTdf76441(); void testTdf142186(); void testTdf137063(); @@ -292,6 +293,7 @@ public: CPPUNIT_TEST(testToggleRefFlag); CPPUNIT_TEST(testAutofilter); CPPUNIT_TEST(testAutoFilterTimeValue); + CPPUNIT_TEST(testTdf76836); CPPUNIT_TEST(testTdf76441); CPPUNIT_TEST(testTdf142186); CPPUNIT_TEST(testTdf137063); @@ -3579,6 +3581,36 @@ void Test::testTdf76441() m_pDoc->DeleteTab(0); } +void Test::testTdf76836() +{ + m_pDoc->InsertTab(0, "Test"); + + OUString aCode = "\"192.168.0.\"@"; + sal_Int32 nCheckPos; + SvNumFormatType nType; + sal_uInt32 nFormat; + SvNumberFormatter* pFormatter = m_pDoc->GetFormatTable(); + pFormatter->PutEntry( aCode, nCheckPos, nType, nFormat ); + + ScPatternAttr aNewAttrs(m_pDoc->GetPool()); + SfxItemSet& rSet = aNewAttrs.GetItemSet(); + rSet.Put(SfxUInt32Item(ATTR_VALUE_FORMAT, nFormat)); + + m_pDoc->ApplyPattern(0, 0, 0, aNewAttrs); + m_pDoc->SetValue(0,0,0, 10.0); + + // Without the fix in place, this test would have failed with + // - Expected: 10 + // - Actual : 192.168.0.10 + CPPUNIT_ASSERT_EQUAL(OUString("10"), m_pDoc->GetString(ScAddress(0,0,0))); + + m_pDoc->ApplyPattern(0, 1, 0, aNewAttrs); + m_pDoc->SetString(ScAddress(0,1,0), "10"); + CPPUNIT_ASSERT_EQUAL(OUString("192.168.0.10"), m_pDoc->GetString(ScAddress(0,1,0))); + + m_pDoc->DeleteTab(0); +} + void Test::testTdf142186() { m_pDoc->InsertTab(0, "Test"); |