diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-01-08 14:46:12 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2024-01-09 12:33:19 +0100 |
commit | d2d0bbbc2bd3a2ad1e73acc03d2183e74ca4a410 (patch) | |
tree | 652a1cfb05e91e42b676d1d733e537c0d7c8fb29 | |
parent | bac43054e2997235ce98432bc9cb6c434120e4b2 (diff) |
tdf#159046: sc_uicalc: Add unittest
Change-Id: I71a8e73b32a4ec9333109e616a827bb36e3791c3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161789
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/qa/unit/uicalc/data/tdf159046.ods | bin | 0 -> 17146 bytes | |||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 32 |
2 files changed, 32 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/data/tdf159046.ods b/sc/qa/unit/uicalc/data/tdf159046.ods Binary files differnew file mode 100644 index 000000000000..f9fc556c0bef --- /dev/null +++ b/sc/qa/unit/uicalc/data/tdf159046.ods diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 930ad6ee7dcb..e3d526fbd53d 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -964,6 +964,38 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154125) CPPUNIT_ASSERT_EQUAL(OUString("21"), pDoc->GetString(ScAddress(0, 1, 0))); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf159046) +{ + createScDoc("tdf159046.ods"); + ScDocument* pDoc = getScDoc(); + ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + + std::map<SCROW, std::vector<SdrObject*>> aObjects + = pDrawLayer->GetObjectsAnchoredToRange(0, 0, 6, 8); + CPPUNIT_ASSERT_EQUAL(size_t(1), aObjects.size()); + + aObjects = pDrawLayer->GetObjectsAnchoredToRange(0, 1, 6, 8); + CPPUNIT_ASSERT_EQUAL(size_t(0), aObjects.size()); + + goToCell("A2:F10"); + dispatchCommand(mxComponent, ".uno:Cut", {}); + + goToCell("B2"); + dispatchCommand(mxComponent, ".uno:Paste", {}); + + // Without the fix in place, this test would have crashed here + saveAndReload("calc8"); + + pDoc = getScDoc(); + pDrawLayer = pDoc->GetDrawLayer(); + + aObjects = pDrawLayer->GetObjectsAnchoredToRange(0, 0, 6, 8); + CPPUNIT_ASSERT_EQUAL(size_t(0), aObjects.size()); + + aObjects = pDrawLayer->GetObjectsAnchoredToRange(0, 1, 6, 8); + CPPUNIT_ASSERT_EQUAL(size_t(1), aObjects.size()); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf148863) { createScDoc(); |