diff options
author | Tibor Nagy <nagy.tibor2@nisz.hu> | 2020-11-26 14:20:14 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-11-30 14:23:25 +0100 |
commit | 3741b90abe478fb04db88207b496a5238df35bb8 (patch) | |
tree | 68fc2eada929b579d72f9065a64fa765e8fd0ebb /sc/qa | |
parent | f98af92e2bbc2064ddc18b80ede68f4267813ddf (diff) |
tdf#138483 sc: update red circles after merging cells
If there are detective circles on the cells and these cells are merged,
the merged cell keeps all red circles instead of removed them except
the circle of merged cell.
Co-authored-by: Attila Szűcs (NISZ)
Change-Id: I39c76cbb7c41affb0a18e5e82923945a2d41795d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106698
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/data/ods/updateCircleInMergedCell.ods | bin | 0 -> 8689 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 35 |
2 files changed, 35 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/updateCircleInMergedCell.ods b/sc/qa/unit/data/ods/updateCircleInMergedCell.ods Binary files differnew file mode 100644 index 000000000000..93be82487e22 --- /dev/null +++ b/sc/qa/unit/data/ods/updateCircleInMergedCell.ods diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 9c087549ec3e..2ef3cf4fb326 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -65,6 +65,8 @@ #include <stlpool.hxx> #include <hints.hxx> #include <detfunc.hxx> +#include <cellmergeoption.hxx> +#include <undoblk.hxx> #include <orcusfilters.hxx> #include <filter.hxx> @@ -102,6 +104,7 @@ public: virtual void tearDown() override; //ods, xls, xlsx filter tests + void testUpdateCircleInMergedCellODS(); void testDeleteCircleInMergedCellODS(); void testBooleanFormatXLSX(); void testBasicCellContentODS(); @@ -292,6 +295,7 @@ public: void testDeleteCirclesInRowAndCol(); CPPUNIT_TEST_SUITE(ScFiltersTest); + CPPUNIT_TEST(testUpdateCircleInMergedCellODS); CPPUNIT_TEST(testDeleteCircleInMergedCellODS); CPPUNIT_TEST(testBooleanFormatXLSX); CPPUNIT_TEST(testBasicCellContentODS); @@ -526,6 +530,37 @@ void testRangeNameImpl(const ScDocument& rDoc) } +void ScFiltersTest::testUpdateCircleInMergedCellODS() +{ + ScDocShellRef xDocSh = loadDoc("updateCircleInMergedCell.", FORMAT_ODS); + CPPUNIT_ASSERT_MESSAGE("Failed to load updateCircleInMergedCell.ods", xDocSh.is()); + + ScDocument& rDoc = xDocSh->GetDocument(); + rDoc.EnableChangeReadOnly(true); + + ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); + SdrPage* pPage = pDrawLayer->GetPage(0); + CPPUNIT_ASSERT_MESSAGE("draw page for sheet 1 should exist.", pPage); + + // There should be four circle objects! + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), pPage->GetObjCount()); + + ScCellMergeOption aCellMergeOption(0,0,1,1); // A1:B2 + aCellMergeOption.maTabs.insert(0); + xDocSh->GetDocFunc().MergeCells(aCellMergeOption, false, true, true, false); + + // There should be a circle object! + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pPage->GetObjCount()); + + std::unique_ptr<ScUndoRemoveMerge> pUndoRemoveMerge; + xDocSh->GetDocFunc().UnmergeCells(aCellMergeOption, true, pUndoRemoveMerge.get()); + + // There should be four circle objects! + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), pPage->GetObjCount()); + + xDocSh->DoClose(); +} + void ScFiltersTest::testDeleteCircleInMergedCellODS() { ScDocShellRef xDocSh = loadDoc("deleteCircleInMergedCell.", FORMAT_ODS); |