diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-24 13:06:07 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-24 13:13:51 -0500 |
commit | d7e5c54451acc9959fd38f0db7eb7e5ac6b38858 (patch) | |
tree | dd46f0e4a508dba707de9dac04fe83a1dd2c7b16 /sc | |
parent | 0bcaa9f9f7efe87f49473eefb467455dfb563138 (diff) |
fdo#75259: Add unit test for sharing of string pools with undo docs.
Change-Id: I785345144f7dd733b2ce8970412f79b384b8c94d
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/ucalc.cxx | 32 | ||||
-rw-r--r-- | sc/qa/unit/ucalc.hxx | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 58c212861376..a4c09abf48b5 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -599,6 +599,38 @@ void Test::testSharedStringPool() m_pDoc->DeleteTab(0); } +void Test::testSharedStringPoolUndoDoc() +{ + m_pDoc->InsertTab(0, "Test"); + + m_pDoc->SetString(ScAddress(0,0,0), "Header"); + m_pDoc->SetString(ScAddress(0,1,0), "A1"); + m_pDoc->SetString(ScAddress(0,2,0), "A2"); + m_pDoc->SetString(ScAddress(0,3,0), "A3"); + + ScDocument aUndoDoc(SCDOCMODE_UNDO); + aUndoDoc.InitUndo(m_pDoc, 0, 0); + + // Copy A1:A4 to the undo document. + for (SCROW i = 0; i <= 4; ++i) + { + ScAddress aPos(0,i,0); + aUndoDoc.SetString(aPos, m_pDoc->GetString(aPos)); + } + + + // String values in A1:A4 should have identical hash. + for (SCROW i = 0; i <= 4; ++i) + { + ScAddress aPos(0,i,0); + svl::SharedString aSS1 = m_pDoc->GetSharedString(aPos); + svl::SharedString aSS2 = aUndoDoc.GetSharedString(aPos); + CPPUNIT_ASSERT_MESSAGE("String hash values are not equal.", aSS1.getDataIgnoreCase() == aSS2.getDataIgnoreCase()); + } + + m_pDoc->DeleteTab(0); +} + void Test::testRangeList() { m_pDoc->InsertTab(0, "foo"); diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx index 29b4c53bca2c..28e015604a97 100644 --- a/sc/qa/unit/ucalc.hxx +++ b/sc/qa/unit/ucalc.hxx @@ -89,6 +89,7 @@ public: void testPerf(); void testCollator(); void testSharedStringPool(); + void testSharedStringPoolUndoDoc(); void testRangeList(); void testMarkData(); void testInput(); @@ -341,6 +342,7 @@ public: #endif CPPUNIT_TEST(testCollator); CPPUNIT_TEST(testSharedStringPool); + CPPUNIT_TEST(testSharedStringPoolUndoDoc); CPPUNIT_TEST(testRangeList); CPPUNIT_TEST(testMarkData); CPPUNIT_TEST(testInput); |