[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jul 13 23:58:45 UTC 2018
sc/inc/colorscale.hxx | 1
sc/qa/unit/ucalc.hxx | 1
sc/qa/unit/ucalc_condformat.cxx | 38 +++++++++++++++++++++++++++++++++++++
sc/source/core/data/colorscale.cxx | 5 ++++
4 files changed, 45 insertions(+)
New commits:
commit 4b7ce45c2384fdd65c17ab18036899cd76577254
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
AuthorDate: Tue Jul 10 03:58:21 2018 +0200
Commit: Markus Mohrhard <markus.mohrhard at googlemail.com>
CommitDate: Sat Jul 14 01:58:17 2018 +0200
add tests for tdf#117809
Change-Id: Ifbd48879a10acfbc6fdb0f2799321ff0684cdcc4
Reviewed-on: https://gerrit.libreoffice.org/57407
Tested-by: Jenkins
Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 13328ccf76b6..45d536dfb7c9 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -77,6 +77,7 @@ public:
void SetType( ScColorScaleEntryType eType );
void SetRepaintCallback(ScConditionalFormat* pParent);
+ void SetRepaintCallback(std::function<void()> func);
};
namespace databar
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index a81a452c494c..60cee22b07c2 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -522,6 +522,7 @@ public:
void testCondFormatUndoList();
void testMultipleSingleCellCondFormatCopyPaste();
void testDeduplicateMultipleCondFormats();
+ void testCondFormatListenToOwnRange();
void testImportStream();
void testDeleteContents();
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index b2febe4ec136..62b0ba9dace0 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -1188,4 +1188,42 @@ void Test::testDeduplicateMultipleCondFormats()
m_pDoc->DeleteTab(0);
}
+void Test::testCondFormatListenToOwnRange()
+{
+ m_pDoc->InsertTab(0, "Test");
+
+ ScConditionalFormatList* pList = m_pDoc->GetCondFormList(0);
+
+ ScConditionalFormat* pFormat = new ScConditionalFormat(1, m_pDoc);
+ ScRangeList aRangeList(ScRange(0,0,0,10,0,0));
+ pFormat->SetRange(aRangeList);
+
+ ScIconSetFormat* pEntry = new ScIconSetFormat(m_pDoc);
+ ScIconSetFormatData* pData = new ScIconSetFormatData;
+ pData->m_Entries.push_back(o3tl::make_unique<ScColorScaleEntry>(0, COL_BLUE));
+ pData->m_Entries.push_back(o3tl::make_unique<ScColorScaleEntry>(1, COL_GREEN));
+ pData->m_Entries.push_back(o3tl::make_unique<ScColorScaleEntry>(2, COL_RED));
+ pEntry->SetIconSetData(pData);
+ pEntry->SetParent(pFormat);
+
+ m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, 1);
+ pFormat->AddEntry(pEntry);
+ pList->InsertNew(pFormat);
+
+ bool bFirstCallbackCalled = false;
+ bool bSecondCallbackCalled = false;
+ bool bThirdCallbackCalled = false;
+ std::function<void()> aFirstCallback = [&]() {bFirstCallbackCalled = true;};
+ std::function<void()> aSecondCallback = [&]() {bSecondCallbackCalled = true;};
+ std::function<void()> aThirdCallback = [&]() {bThirdCallbackCalled = true;};
+ pData->m_Entries[0]->SetType(COLORSCALE_PERCENT);
+ pData->m_Entries[0]->SetRepaintCallback(aFirstCallback);
+
+ m_pDoc->SetValue(0, 0, 0, -1.0);
+
+ CPPUNIT_ASSERT(bFirstCallbackCalled);
+
+ m_pDoc->DeleteTab(0);
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index e35083b639fe..3617dcf7401f 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -346,6 +346,11 @@ void ScColorScaleEntry::setListener()
}
}
+void ScColorScaleEntry::SetRepaintCallback(std::function<void()> func)
+{
+ mpListener->setCallback(func);
+}
+
ScColorFormat::ScColorFormat(ScDocument* pDoc)
: ScFormatEntry(pDoc)
, mpParent(nullptr)
More information about the Libreoffice-commits
mailing list