sc/qa/uitest/conditional_format/colorScale.py |   41 ++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

New commits:
commit f310b47ead5bf4a85a1c93d15b3c5f78f6675f7a
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Feb 19 17:15:22 2025 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Wed Feb 19 21:20:14 2025 +0100

    sc: Add basic UItest for ColorScaleFormatDialog with 2 entries
    
    Change-Id: I1ecbe1bfde1bf42de24832286eca795f74e135de
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181916
    Reviewed-by: Xisco Fauli <[email protected]>
    Tested-by: Jenkins

diff --git a/sc/qa/uitest/conditional_format/colorScale.py 
b/sc/qa/uitest/conditional_format/colorScale.py
index f9fa8c0f4a62..759a4794ba65 100644
--- a/sc/qa/uitest/conditional_format/colorScale.py
+++ b/sc/qa/uitest/conditional_format/colorScale.py
@@ -49,4 +49,45 @@ class colorScale(UITestCase):
             self.assertEqual(16776960, 
cond_formats.ConditionalFormats[0].getByIndex(0).ColorScaleEntries[1].Color)
             self.assertEqual(43315, 
cond_formats.ConditionalFormats[0].getByIndex(0).ColorScaleEntries[2].Color)
 
+    def test_colorScale2Entries(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", 
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"])
+
+                select_by_text(xCondFormat.getChild("colorformat"), "Color 
Scale (2 Entries)")
+
+                # we need to get a pointer again after changing the color 
format
+                xCondFormat = self.xUITest.getTopFocusWindow()
+
+                self.assertEqual("Color Scale (2 Entries)", 
get_state_as_dict(xCondFormat.getChild("colorformat"))["SelectEntryText"])
+                self.assertEqual("Min", 
get_state_as_dict(xCondFormat.getChild("colscalemin"))["SelectEntryText"])
+                self.assertEqual("Max", 
get_state_as_dict(xCondFormat.getChild("colscalemax"))["SelectEntryText"])
+                self.assertEqual("Light Yellow 2", 
get_state_as_dict(xCondFormat.getChild("lbcolmin"))["Text"])
+                self.assertEqual("Light Green 2", 
get_state_as_dict(xCondFormat.getChild("lbcolmax"))["Text"])
+                self.assertEqual("", 
get_state_as_dict(xCondFormat.getChild("edcolscalemin"))["Text"])
+                self.assertEqual("", 
get_state_as_dict(xCondFormat.getChild("edcolscalemax"))["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(2, 
len(cond_formats.ConditionalFormats[0].getByIndex(0).ColorScaleEntries))
+            self.assertEqual(16777069, 
cond_formats.ConditionalFormats[0].getByIndex(0).ColorScaleEntries[0].Color)
+            self.assertEqual(7847013, 
cond_formats.ConditionalFormats[0].getByIndex(0).ColorScaleEntries[1].Color)
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:

Reply via email to