diff options
author | Tibor Nagy <nagy.tibor2@nisz.hu> | 2020-11-19 16:29:01 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-11-24 10:58:23 +0100 |
commit | 6975e4387640a1473ca158f503637be61ac9dedb (patch) | |
tree | 41945348710de3ef5b4395e81d35bcc1108dcb84 /sc | |
parent | a3638ec207b6aa2ee8e5b4255c3b73e15c479852 (diff) |
tdf#138137 sc: remove red circle in merged cell
This mark wasn't removed when valid data is entered in the merged cell.
Co-authored-by: Attila Szűcs (NISZ)
Change-Id: I7632abadde9c482819f80af2600ab4c58292a821
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106172
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/ods/deleteCircleInMergedCell.ods | bin | 0 -> 7976 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 36 | ||||
-rw-r--r-- | sc/source/core/tool/detfunc.cxx | 2 |
3 files changed, 37 insertions, 1 deletions
diff --git a/sc/qa/unit/data/ods/deleteCircleInMergedCell.ods b/sc/qa/unit/data/ods/deleteCircleInMergedCell.ods Binary files differnew file mode 100644 index 000000000000..f4d078d1f610 --- /dev/null +++ b/sc/qa/unit/data/ods/deleteCircleInMergedCell.ods diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index af64711856a6..23a2c27faa48 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -104,6 +104,7 @@ public: virtual void tearDown() override; //ods, xls, xlsx filter tests + void testDeleteCircleInMergedCellODS(); void testBooleanFormatXLSX(); void testBasicCellContentODS(); void testRangeNameXLS(); @@ -292,6 +293,7 @@ public: void testDeleteCirclesInRowAndCol(); CPPUNIT_TEST_SUITE(ScFiltersTest); + CPPUNIT_TEST(testDeleteCircleInMergedCellODS); CPPUNIT_TEST(testBooleanFormatXLSX); CPPUNIT_TEST(testBasicCellContentODS); CPPUNIT_TEST(testRangeNameXLS); @@ -524,6 +526,40 @@ void testRangeNameImpl(const ScDocument& rDoc) } +void ScFiltersTest::testDeleteCircleInMergedCellODS() +{ + ScDocShellRef xDocSh = loadDoc("deleteCircleInMergedCell.", FORMAT_ODS); + CPPUNIT_ASSERT_MESSAGE("Failed to load deleteCircleInMergedCell.ods", xDocSh.is()); + + ScDocument& rDoc = xDocSh->GetDocument(); + + ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); + SdrPage* pPage = pDrawLayer->GetPage(0); + CPPUNIT_ASSERT_MESSAGE("draw page for sheet 1 should exist.", pPage); + + // There should be a circle object! + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pPage->GetObjCount()); + + ScRefCellValue aMergedCell; + ScAddress aPosMergedCell(0, 0, 0); + aMergedCell.assign(rDoc, aPosMergedCell); + + // The value of merged cell change to 6. + aMergedCell.mfValue = 6; + + // Check that the data is valid.(True if the value = 6) + const ScValidationData* pData = rDoc.GetValidationEntry(1); + bool bValidA1 = pData->IsDataValid(aMergedCell, aPosMergedCell); + // if valid, delete circle. + if (bValidA1) + ScDetectiveFunc(rDoc, 0).DeleteCirclesAt(aPosMergedCell.Col(), aPosMergedCell.Row()); + + // There should not be a circle object! + CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pPage->GetObjCount()); + + xDocSh->DoClose(); +} + void ScFiltersTest::testBasicCellContentODS() { ScDocShellRef xDocSh = loadDoc("basic-cell-content.", FORMAT_ODS); diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 786b4624f9c8..1fa94abe635c 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1240,7 +1240,7 @@ bool ScDetectiveFunc::DeletePred( SCCOL nCol, SCROW nRow ) bool ScDetectiveFunc::DeleteCirclesAt( SCCOL nCol, SCROW nRow ) { - tools::Rectangle aRect = GetDrawRect(nCol, nRow); + tools::Rectangle aRect = ScDrawLayer::GetCellRect(rDoc, ScAddress(nCol, nRow, nTab), true); aRect.AdjustLeft(-250); aRect.AdjustRight(250); aRect.AdjustTop(-70); |