[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source

Tibor Nagy (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 1 12:02:02 UTC 2021


 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 a6d3668362f8c7d41f08f8a4fa3dad56a4f5527f
Author:     Tibor Nagy <nagy.tibor2 at nisz.hu>
AuthorDate: Thu Nov 19 16:29:01 2020 +0100
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Mon Mar 1 13:01:27 2021 +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 <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 6975e4387640a1473ca158f503637be61ac9dedb)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106447
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
    (cherry picked from commit fbf92ea796a398f0fceb1613aad0a3d682dd2403)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111701
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

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 6d400cb7371f..f7171a4d567d 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();
@@ -271,6 +272,7 @@ public:
     void testDeleteCirclesInRowAndCol();
 
     CPPUNIT_TEST_SUITE(ScFiltersTest);
+    CPPUNIT_TEST(testDeleteCircleInMergedCellODS);
     CPPUNIT_TEST(testBooleanFormatXLSX);
     CPPUNIT_TEST(testBasicCellContentODS);
     CPPUNIT_TEST(testRangeNameXLS);
@@ -482,6 +484,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 b76af228830f..5e5b538a80e6 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(*pDoc, ScAddress(nCol, nRow, nTab), true);
     aRect.AdjustLeft(-250);
     aRect.AdjustRight(250);
     aRect.AdjustTop(-70);


More information about the Libreoffice-commits mailing list