sc/qa/unit/data/ods/deleteCircleInMergedCell.ods |binary sc/qa/unit/subsequent_filters-test.cxx | 36 +++++++++++++++++++++++ sc/source/core/tool/detfunc.cxx | 2 - 3 files changed, 37 insertions(+), 1 deletion(-)
New commits: commit 6975e4387640a1473ca158f503637be61ac9dedb Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Thu Nov 19 16:29:01 2020 +0100 Commit: László Németh <nem...@numbertext.org> CommitDate: Tue Nov 24 10:58:23 2020 +0100 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 <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sc/qa/unit/data/ods/deleteCircleInMergedCell.ods b/sc/qa/unit/data/ods/deleteCircleInMergedCell.ods new file mode 100644 index 000000000000..f4d078d1f610 Binary files /dev/null and b/sc/qa/unit/data/ods/deleteCircleInMergedCell.ods differ 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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits