sc/qa/uitest/calc_tests8/dataProvider.py  |   74 +++++++++++++++++++++
 sc/qa/uitest/data/tdf169019.csv           |  101 ++++++++++++++++++++++++++++++
 sc/qa/uitest/data/tdf169019.ods           |binary
 sc/source/ui/miscdlgs/dataproviderdlg.cxx |   10 ++
 4 files changed, 185 insertions(+)

New commits:
commit 0f6c8e2baa1c73bf87bef27fd086ccd280a81ec5
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Oct 28 17:08:21 2025 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Dec 4 14:02:07 2025 +0100

    tdf#169019: sc: Add UItest
    
    Change-Id: Iaa10db0c44d415642826780aa207d514d8b963f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193104
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sc/qa/uitest/calc_tests8/dataProvider.py 
b/sc/qa/uitest/calc_tests8/dataProvider.py
index 5880881fab43..cc9b9c69e85f 100644
--- a/sc/qa/uitest/calc_tests8/dataProvider.py
+++ b/sc/qa/uitest/calc_tests8/dataProvider.py
@@ -11,6 +11,10 @@ from uitest.framework import UITestCase
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file, 
select_by_text
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from libreoffice.calc.document import get_cell_by_position
+from org.libreoffice.unotest import systemPathToFileUrl
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from tempfile import TemporaryDirectory
 
 import os
 
@@ -83,4 +87,74 @@ class DataProvider(UITestCase):
                                  "test1.csv")
         self.do_import("CSV", test_file, "", "1")
 
+    def test_save_split_transformation(self):
+
+        with TemporaryDirectory() as tempdir:
+
+            xFilePath = os.path.join(tempdir, 'tdf169019-tmp.ods')
+
+            with 
self.ui_test.load_file(get_url_for_data_file('tdf169019.ods')):
+
+                with 
self.ui_test.execute_dialog_through_command(".uno:DataProvider") as xDialog:
+                    xDB = xDialog.getChild("select_db_range")
+                    select_by_text(xDB, "myImport")
+                    self.assertEqual("myImport", 
get_state_as_dict(xDB)['DisplayText'])
+
+                    xBrowse = xDialog.getChild("browse")
+                    with self.ui_test.execute_blocking_action(
+                            xBrowse.executeAction, args=('CLICK', ()), 
close_button="") as dialog:
+                        xFileName = dialog.getChild("file_name")
+                        xFileName.executeAction("TYPE", 
mkPropertyValues({"TEXT": get_url_for_data_file("tdf169019.csv")}))
+                        xOpen = dialog.getChild("open")
+                        xOpen.executeAction("CLICK", tuple())
+
+                    xProvider = xDialog.getChild("provider_lst")
+                    xURL = xDialog.getChild("ed_url")
+                    self.assertEqual(get_url_for_data_file("tdf169019.csv"), 
get_state_as_dict(xURL)['Text'])
+                    self.assertEqual("CSV", 
get_state_as_dict(xProvider)['DisplayText'])
+
+                    xTransformation = xDialog.getChild("transformation_box")
+                    select_by_text(xTransformation, "Split Column")
+                    self.assertEqual("Split Column", 
get_state_as_dict(xTransformation)['DisplayText'])
+
+                    xAdd = xDialog.getChild("add_transformation")
+                    xAdd.executeAction("CLICK", tuple())
+
+                    xSeparator1 = xDialog.getChild("ed_separator0")
+                    xNumCols1 = xDialog.getChild("num_cols0")
+                    xSeparator1.executeAction("TYPE", 
mkPropertyValues({"TEXT":"|"}))
+                    xNumCols1.executeAction("TYPE", 
mkPropertyValues({"TEXT":"1"}))
+
+                    xApply = xDialog.getChild("apply")
+                    xApply.executeAction("CLICK", tuple())
+
+                    self.assertEqual("Split Column", 
get_state_as_dict(xTransformation)['DisplayText'])
+
+                    xAdd = xDialog.getChild("add_transformation")
+                    xAdd.executeAction("CLICK", tuple())
+
+                    xSeparator2 = xDialog.getChild("ed_separator1")
+                    xNumCols2 = xDialog.getChild("num_cols1")
+                    xSeparator2.executeAction("TYPE", 
mkPropertyValues({"TEXT":"|"}))
+                    xNumCols2.executeAction("TYPE", 
mkPropertyValues({"TEXT":"2"}))
+
+                    xApply = xDialog.getChild("apply")
+                    xApply.executeAction("CLICK", tuple())
+
+                # Save Copy as
+                with 
self.ui_test.execute_dialog_through_command('.uno:SaveAs', close_button="open") 
as xDialog:
+                    xFileName = xDialog.getChild('file_name')
+                    xFileName.executeAction('TYPE', 
mkPropertyValues({'KEYCODE':'CTRL+A'}))
+                    xFileName.executeAction('TYPE', 
mkPropertyValues({'KEYCODE':'BACKSPACE'}))
+                    xFileName.executeAction('TYPE', mkPropertyValues({'TEXT': 
xFilePath}))
+
+            with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as 
doc2:
+                # Without the fix in place, this test would have failed with
+                # AssertionError: 'Rank' != 'Rank|Males|Females '
+                self.assertEqual("Rank", get_cell_by_position(doc2, 0, 0, 
0).getString())
+                self.assertEqual("Males", get_cell_by_position(doc2, 0, 1, 
0).getString())
+                self.assertEqual("Females ", get_cell_by_position(doc2, 0, 2, 
0).getString())
+                for i in range(1, 101):
+                    self.assertEqual(str(i), get_cell_by_position(doc2, 0, 0, 
i).getString())
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf169019.csv b/sc/qa/uitest/data/tdf169019.csv
new file mode 100644
index 000000000000..1795ae3c5a70
--- /dev/null
+++ b/sc/qa/uitest/data/tdf169019.csv
@@ -0,0 +1,101 @@
+Rank|Males|Females
+1|James|Mary
+2|Michael|Patricia
+3|Robert|Jennifer
+4|John|Linda
+5|David|Elizabeth
+6|William|Barbara
+7|Richard|Susan
+8|Joseph|Jessica
+9|Thomas|Karen
+10|Christopher|Sarah
+11|Charles|Lisa
+12|Daniel|Nancy
+13|Matthew|Sandra
+14|Anthony|Betty
+15|Mark|Ashley
+16|Donald|Emily
+17|Steven|Kimberly
+18|Andrew|Margaret
+19|Paul|Donna
+20|Joshua|Michelle
+21|Kenneth|Carol
+22|Kevin|Amanda
+23|Brian|Melissa
+24|Timothy|Deborah
+25|Ronald|Stephanie
+26|George|Rebecca
+27|Jason|Sharon
+28|Edward|Laura
+29|Jeffrey|Cynthia
+30|Ryan|Dorothy
+31|Jacob|Amy
+32|Nicholas|Kathleen
+33|Gary|Angela
+34|Eric|Shirley
+35|Jonathan|Emma
+36|Stephen|Brenda
+37|Larry|Pamela
+38|Justin|Nicole
+39|Scott|Anna
+40|Brandon|Samantha
+41|Benjamin|Katherine
+42|Samuel|Christine
+43|Gregory|Debra
+44|Alexander|Rachel
+45|Patrick|Carolyn
+46|Frank|Janet
+47|Raymond|Maria
+48|Jack|Olivia
+49|Dennis|Heather
+50|Jerry|Helen
+51|Tyler|Catherine
+52|Aaron|Diane
+53|Jose|Julie
+54|Adam|Victoria
+55|Nathan|Joyce
+56|Henry|Lauren
+57|Zachary|Kelly
+58|Douglas|Christina
+59|Peter|Ruth
+60|Kyle|Joan
+61|Noah|Virginia
+62|Ethan|Judith
+63|Jeremy|Evelyn
+64|Christian|Hannah
+65|Walter|Andrea
+66|Keith|Megan
+67|Austin|Cheryl
+68|Roger|Jacqueline
+69|Terry|Madison
+70|Sean|Teresa
+71|Gerald|Abigail
+72|Carl|Sophia
+73|Dylan|Martha
+74|Harold|Sara
+75|Jordan|Gloria
+76|Jesse|Janice
+77|Bryan|Kathryn
+78|Lawrence|Ann
+79|Arthur|Isabella
+80|Gabriel|Judy
+81|Bruce|Charlotte
+82|Logan|Julia
+83|Billy|Grace
+84|Joe|Amber
+85|Alan|Alice
+86|Juan|Jean
+87|Elijah|Denise
+88|Willie|Frances
+89|Albert|Danielle
+90|Wayne|Marilyn
+91|Randy|Natalie
+92|Mason|Beverly
+93|Vincent|Diana
+94|Liam|Brittany
+95|Roy|Theresa
+96|Bobby|Kayla
+97|Caleb|Alexis
+98|Bradley|Doris
+99|Russell|Lori
+100|Lucas|Tiffany
diff --git a/sc/qa/uitest/data/tdf169019.ods b/sc/qa/uitest/data/tdf169019.ods
new file mode 100644
index 000000000000..c0b549aaad03
Binary files /dev/null and b/sc/qa/uitest/data/tdf169019.ods differ
diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx 
b/sc/source/ui/miscdlgs/dataproviderdlg.cxx
index 0be34cbbe0ec..03beba8d6222 100644
--- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx
+++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx
@@ -151,6 +151,11 @@ 
ScSplitColumnTransformationControl::ScSplitColumnTransformationControl(
     , maDeleteTransformation(std::move(aDeleteTransformation))
     , mpDoc(pDoc)
 {
+    // for uitests
+    mxSeparator->set_buildable_name(mxSeparator->get_buildable_name() + 
OUString::number(nIndex));
+    mxNumColumns->set_buildable_name(mxNumColumns->get_buildable_name() + 
OUString::number(nIndex));
+    mxDelete->set_buildable_name(mxDelete->get_buildable_name() + 
OUString::number(nIndex));
+
     mxDelete->connect_clicked(LINK(this,ScSplitColumnTransformationControl, 
DeleteHdl));
 }
 
@@ -192,6 +197,11 @@ 
ScMergeColumnTransformationControl::ScMergeColumnTransformationControl(
     , maDeleteTransformation(std::move(aDeleteTransformation))
     , mpDoc(pDoc)
 {
+    // for uitests
+    mxSeparator->set_buildable_name(mxSeparator->get_buildable_name() + 
OUString::number(nIndex));
+    mxEdColumns->set_buildable_name(mxEdColumns->get_buildable_name() + 
OUString::number(nIndex));
+    mxDelete->set_buildable_name(mxDelete->get_buildable_name() + 
OUString::number(nIndex));
+
     mxDelete->connect_clicked(LINK(this,ScMergeColumnTransformationControl, 
DeleteHdl));
 
     OUStringBuffer aBuffer;

Reply via email to