sc/qa/uitest/conditional_format/colorScale.py  |   52 ++++++++++++++++++++++
 sc/qa/uitest/conditional_format/iconSet.py     |   57 +++++++++++++++++++++++++
 sc/source/ui/condformat/condformatdlgentry.cxx |    3 +
 3 files changed, 112 insertions(+)

New commits:
commit 849461b17ca124c111aff27ed7e6bf4d47b012fd
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Feb 19 16:51:52 2025 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Feb 19 21:20:02 2025 +0100

    sc: Add basic UItest for ColorScaleFormatDialog with 3 entries
    
    Change-Id: If38de58b22c94748c8e5db7423c57b24ad934f03
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181910
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Tested-by: Jenkins

diff --git a/sc/qa/uitest/conditional_format/colorScale.py 
b/sc/qa/uitest/conditional_format/colorScale.py
new file mode 100644
index 000000000000..f9fa8c0f4a62
--- /dev/null
+++ b/sc/qa/uitest/conditional_format/colorScale.py
@@ -0,0 +1,52 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import select_by_text, type_text
+
+class colorScale(UITestCase):
+
+    def test_colorScale3Entries(self):
+
+        with self.ui_test.create_doc_in_start_center("calc") as document:
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+
+            cond_formats = document.Sheets[0].ConditionalFormats
+            self.assertEqual(0, cond_formats.Length)
+
+            enter_text_to_cell(gridwin, "A1", "1")
+            enter_text_to_cell(gridwin, "A2", "2")
+            enter_text_to_cell(gridwin, "A3", "3")
+
+            self.xUITest.executeCommand(".uno:SelectColumn")
+
+            with 
self.ui_test.execute_dialog_through_command(".uno:ColorScaleFormatDialog") as 
xCondFormat:
+                self.assertEqual("Condition 1", 
get_state_as_dict(xCondFormat.getChild("number"))["Text"])
+                self.assertEqual("All Cells", 
get_state_as_dict(xCondFormat.getChild("type"))["SelectEntryText"])
+                self.assertEqual("Color Scale (3 Entries)", 
get_state_as_dict(xCondFormat.getChild("colorformat"))["SelectEntryText"])
+                self.assertEqual("Min", 
get_state_as_dict(xCondFormat.getChild("colscalemin"))["SelectEntryText"])
+                self.assertEqual("Percentile", 
get_state_as_dict(xCondFormat.getChild("colscalemiddle"))["SelectEntryText"])
+                self.assertEqual("Max", 
get_state_as_dict(xCondFormat.getChild("colscalemax"))["SelectEntryText"])
+                self.assertEqual("Red", 
get_state_as_dict(xCondFormat.getChild("lbcolmin"))["Text"])
+                self.assertEqual("Yellow", 
get_state_as_dict(xCondFormat.getChild("lbcolmiddle"))["Text"])
+                self.assertEqual("Green", 
get_state_as_dict(xCondFormat.getChild("lbcolmax"))["Text"])
+                self.assertEqual("", 
get_state_as_dict(xCondFormat.getChild("edcolscalemin"))["Text"])
+                self.assertEqual("50", 
get_state_as_dict(xCondFormat.getChild("edcolscalemiddle"))["Text"])
+                self.assertEqual("", 
get_state_as_dict(xCondFormat.getChild("edcolscalemax"))["Text"])
+
+            self.assertEqual(1, cond_formats.Length)
+            self.assertEqual(3, 
len(cond_formats.ConditionalFormats[0].getByIndex(0).ColorScaleEntries))
+            self.assertEqual(16711680, 
cond_formats.ConditionalFormats[0].getByIndex(0).ColorScaleEntries[0].Color)
+            self.assertEqual(16776960, 
cond_formats.ConditionalFormats[0].getByIndex(0).ColorScaleEntries[1].Color)
+            self.assertEqual(43315, 
cond_formats.ConditionalFormats[0].getByIndex(0).ColorScaleEntries[2].Color)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
commit 29751c4eb4004d1c4c8205f0f4c6bef8f88f3512
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Feb 19 16:44:21 2025 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Feb 19 21:19:52 2025 +0100

    tdf#163316: sc: Add basic UItest for IconSetFormatDialog
    
    Change-Id: I0c6ad7983addd8d24a0b79874aa8f095a58d93e0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181909
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/uitest/conditional_format/iconSet.py 
b/sc/qa/uitest/conditional_format/iconSet.py
new file mode 100644
index 000000000000..817f7d6cb43e
--- /dev/null
+++ b/sc/qa/uitest/conditional_format/iconSet.py
@@ -0,0 +1,57 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+from uitest.uihelper.calc import enter_text_to_cell
+from uitest.uihelper.common import select_by_text, type_text
+
+class IconSet(UITestCase):
+
+    def test_IconSet(self):
+
+        with self.ui_test.create_doc_in_start_center("calc") as document:
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
+
+            cond_formats = document.Sheets[0].ConditionalFormats
+            self.assertEqual(0, cond_formats.Length)
+
+            enter_text_to_cell(gridwin, "A1", "1")
+            enter_text_to_cell(gridwin, "A2", "2")
+            enter_text_to_cell(gridwin, "A3", "3")
+
+            self.xUITest.executeCommand(".uno:SelectColumn")
+
+            with 
self.ui_test.execute_dialog_through_command(".uno:IconSetFormatDialog", 
close_button="") as xCondFormat:
+                self.assertEqual("Condition 1", 
get_state_as_dict(xCondFormat.getChild("number"))["Text"])
+                self.assertEqual("All Cells", 
get_state_as_dict(xCondFormat.getChild("type"))["SelectEntryText"])
+                self.assertEqual("Icon Set", 
get_state_as_dict(xCondFormat.getChild("colorformat"))["SelectEntryText"])
+                self.assertEqual("3 Arrows", 
get_state_as_dict(xCondFormat.getChild("iconsettype"))["SelectEntryText"])
+                select_by_text(xCondFormat.getChild("iconsettype"), "4 Gray 
Arrows")
+
+                # we need to get a pointer again after changing the IconSet 
type
+                xCondFormat = self.xUITest.getTopFocusWindow()
+
+                self.assertEqual("Percent", 
get_state_as_dict(xCondFormat.getChild("listbox1"))["SelectEntryText"])
+                self.assertEqual("Percent", 
get_state_as_dict(xCondFormat.getChild("listbox2"))["SelectEntryText"])
+                self.assertEqual("Percent", 
get_state_as_dict(xCondFormat.getChild("listbox3"))["SelectEntryText"])
+                self.assertEqual("", 
get_state_as_dict(xCondFormat.getChild("entry1"))["Text"])
+                self.assertEqual("", 
get_state_as_dict(xCondFormat.getChild("entry2"))["Text"])
+                self.assertEqual("", 
get_state_as_dict(xCondFormat.getChild("entry3"))["Text"])
+
+                # close the conditional format manager
+                xOKBtn = xCondFormat.getChild("ok")
+                self.ui_test.close_dialog_through_button(xOKBtn)
+
+            self.assertEqual(1, cond_formats.Length)
+            self.assertEqual(11, 
cond_formats.ConditionalFormats[0].getByIndex(0).Icons) # IconSet_4ArrowsGray
+            self.assertEqual(4, 
len(cond_formats.ConditionalFormats[0].getByIndex(0).IconSetEntries))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx 
b/sc/source/ui/condformat/condformatdlgentry.cxx
index b9594afd9adc..1be4d4151d44 100644
--- a/sc/source/ui/condformat/condformatdlgentry.cxx
+++ b/sc/source/ui/condformat/condformatdlgentry.cxx
@@ -1368,6 +1368,9 @@ 
ScIconSetFrmtDataEntry::ScIconSetFrmtDataEntry(weld::Grid* pParent, ScIconSetTyp
     , mxLbEntryType(mxBuilder->weld_combo_box(u"listbox"_ustr))
     , mpParentGrid(pParent)
 {
+    mxEdEntry->set_buildable_name(mxEdEntry->get_buildable_name() + 
OUString::number(i));
+    mxLbEntryType->set_buildable_name(mxLbEntryType->get_buildable_name() + 
OUString::number(i));
+
     mxImgIcon->set_from_icon_name(ScIconSetFormat::getIconName(eType, i));
     if(pEntry)
     {

Reply via email to