sc/qa/uitest/calc_tests6/tdf107267.py |   46 +++++++++++-----------------------
 sc/qa/uitest/calc_tests6/tdf118638.py |    4 +-
 sc/qa/uitest/sort/subtotals.py        |   14 +++++-----
 sc/source/ui/dbgui/tpsubt.cxx         |   12 +++++---
 sc/source/ui/inc/tpsubt.hxx           |    2 -
 5 files changed, 34 insertions(+), 44 deletions(-)

New commits:
commit 5505b0d7c3e5924c2614b03789307e4c26cb6f24
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Feb 10 17:51:55 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Feb 11 11:21:27 2022 +0100

    uitest: sc: add a buidable name to the tabs in DataSubTotals dialog
    
    Change-Id: I045f301083767fa32fd516a4a46823b3af4a6a2b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129794
    Tested-by: Jenkins
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sc/qa/uitest/calc_tests6/tdf107267.py 
b/sc/qa/uitest/calc_tests6/tdf107267.py
index 2ee73577aa25..8ff9a19baa38 100644
--- a/sc/qa/uitest/calc_tests6/tdf107267.py
+++ b/sc/qa/uitest/calc_tests6/tdf107267.py
@@ -11,8 +11,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.framework import UITestCase
 from libreoffice.calc.document import get_cell_by_position
 from uitest.uihelper.common import select_pos
-from uitest.uihelper.common import select_by_text
-from uitest.uihelper.common import get_url_for_data_file
+from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict
 
 #Bug 107267 - During a sub-total calculation or sum, the data set is not 
computed well.
 class Subtotals(UITestCase):
@@ -27,40 +26,27 @@ class Subtotals(UITestCase):
             # 2. Data->Subtotals
             with 
self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
+
                 select_pos(xTabs, "0")
-                # = 1st group = 3. Group by "Person Number", select "shipping 
time" and use the Max function.
-                xGroupBy = xDialog.getChild("group_by")
-                select_by_text(xGroupBy, "Person Number")
-                # 4. Tick 'Calculate subtotals for' -> "shipping time" - 
already selected
-        #        xCheckListMenu = xDialog.getChild("grid1")
-        #        xTreeList = xCheckListMenu.getChild("columns")
-        #        x6Entry = xTreeList.getChild("5")
-        #        xFirstEntry.executeAction("CLICK", tuple())
-                #use the Max function
+                xGroupBy1 = xDialog.getChild("group_by1")
+                self.assertEqual("Person Number", 
get_state_as_dict(xGroupBy1)["SelectEntryText"])
+
+                xColumns1 = xDialog.getChild("columns1")
+                self.assertEqual("shipping time", 
get_state_as_dict(xColumns1)["SelectEntryText"])
 
-                #= 2nd group =5. Group by "Person Number", select "shipping 
time" and use the Min function.
                 select_pos(xTabs, "1")
-                xGroupBy = xDialog.getChild("group_by")
-                select_by_text(xGroupBy, "Person Number")
-                # 4. Tick 'Calculate subtotals for' -> "shipping time" - 
already selected
-        #        xCheckListMenu = xDialog.getChild("grid1")
-        #        xTreeList = xCheckListMenu.getChild("columns")
-        #        x6Entry = xTreeList.getChild("5")
-        #        xFirstEntry.executeAction("CLICK", tuple())
-                #use the Min function
+                xGroupBy2 = xDialog.getChild("group_by2")
+                self.assertEqual("Person Number", 
get_state_as_dict(xGroupBy2)["SelectEntryText"])
+
+                xColumns2 = xDialog.getChild("columns2")
+                self.assertEqual("shipping time", 
get_state_as_dict(xColumns2)["SelectEntryText"])
 
-                #= 3rd group = Group by "Person Number", select "shipping 
time" and use the Average function.
                 select_pos(xTabs, "2")
-                xGroupBy = xDialog.getChild("group_by")
-                select_by_text(xGroupBy, "Person Number")
-                # 4. Tick 'Calculate subtotals for' -> "shipping time" - 
already selected
-        #        xCheckListMenu = xDialog.getChild("grid1")
-        #        xTreeList = xCheckListMenu.getChild("columns")
-        #        x6Entry = xTreeList.getChild("5")
-        #        xFirstEntry.executeAction("CLICK", tuple())
-                #use the Average function
+                xGroupBy3 = xDialog.getChild("group_by3")
+                self.assertEqual("Person Number", 
get_state_as_dict(xGroupBy3)["SelectEntryText"])
 
-                # 5. Click OK
+                xColumns3 = xDialog.getChild("columns3")
+                self.assertEqual("shipping time", 
get_state_as_dict(xColumns3)["SelectEntryText"])
 
             #verify
             self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 
141).getString(), "Grand Average")
diff --git a/sc/qa/uitest/calc_tests6/tdf118638.py 
b/sc/qa/uitest/calc_tests6/tdf118638.py
index 6ab1771ea60e..c928aa38843e 100644
--- a/sc/qa/uitest/calc_tests6/tdf118638.py
+++ b/sc/qa/uitest/calc_tests6/tdf118638.py
@@ -27,10 +27,10 @@ class Subtotals(UITestCase):
             with 
self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog:
                 xTabs = xDialog.getChild("tabcontrol")
                 select_pos(xTabs, "0")
-                xGroupBy = xDialog.getChild("group_by")
+                xGroupBy = xDialog.getChild("group_by1")
                 select_by_text(xGroupBy, "Store Name")
                 xCheckListMenu = xDialog.getChild("grid1")
-                xTreeList = xCheckListMenu.getChild("columns")
+                xTreeList = xCheckListMenu.getChild("columns1")
                 xEntry = xTreeList.getChild("1")
                 xEntry.executeAction("CLICK", tuple())
 
diff --git a/sc/qa/uitest/sort/subtotals.py b/sc/qa/uitest/sort/subtotals.py
index 7a3ad16e1095..40c91df05a10 100644
--- a/sc/qa/uitest/sort/subtotals.py
+++ b/sc/qa/uitest/sort/subtotals.py
@@ -56,7 +56,7 @@ class Subtotals(UITestCase):
             # Subtotal dialog displays
             with 
self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog:
                 # Select group by: Category
-                xGroupBy = xDialog.getChild("group_by")
+                xGroupBy = xDialog.getChild("group_by1")
                 select_by_text(xGroupBy, "Category")
                 # Select calculate subtotals for the months -  selected by 
default
                 # Select tab options
@@ -77,7 +77,7 @@ class Subtotals(UITestCase):
             self.xUITest.executeCommand(".uno:SelectAll")#use uno command Menu 
Edit->Select All
             # 2 invoke sub-total menu and select none
             with 
self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog:
-                xGroupBy = xDialog.getChild("group_by")
+                xGroupBy = xDialog.getChild("group_by1")
                 select_by_text(xGroupBy, "- none -")
             # 2 invoke sort menu and... crash
             with self.ui_test.execute_dialog_through_command(".uno:DataSort", 
close_button="cancel"):
@@ -94,22 +94,22 @@ class Subtotals(UITestCase):
             # 2. Data->Subtotals
             with 
self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog:
                 # 3. Group by->Trans date
-                xGroupBy = xDialog.getChild("group_by")
+                xGroupBy = xDialog.getChild("group_by1")
                 select_by_text(xGroupBy, "Trans Date")
                 # 4. Tick 'Calculate subtotals for' -> Amount  (grid1)
                 xCheckListMenu = xDialog.getChild("grid1")
-                xTreeList = xCheckListMenu.getChild("columns")
+                xTreeList = xCheckListMenu.getChild("columns1")
                 xFirstEntry = xTreeList.getChild("2")
                 xFirstEntry.executeAction("CLICK", tuple())
                 # 5. Click OK
             # 6. Data->Subtotals
             with 
self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog:
                 # 7. Group by->-none-
-                xGroupBy = xDialog.getChild("group_by")
+                xGroupBy = xDialog.getChild("group_by1")
                 select_by_text(xGroupBy, "- none -")
                 # 8. Untick 'Calculate subtotals for' -> Amount
                 xCheckListMenu = xDialog.getChild("grid1")
-                xTreeList = xCheckListMenu.getChild("columns")
+                xTreeList = xCheckListMenu.getChild("columns1")
                 xFirstEntry = xTreeList.getChild("2")
                 xFirstEntry.executeAction("CLICK", tuple())
                 # 9. Click OK
@@ -134,7 +134,7 @@ class Subtotals(UITestCase):
             # 3. Data → Subtotals
             with 
self.ui_test.execute_dialog_through_command(".uno:DataSubTotals") as xDialog:
                 # 4. Group by: "- none -"
-                xGroupBy = xDialog.getChild("group_by")
+                xGroupBy = xDialog.getChild("group_by1")
                 select_by_text(xGroupBy, "- none -")
                 # 5. Press "OK" and watch LibreOffice crash.
 
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index b94a02639083..020203c4c607 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -38,7 +38,7 @@
 
 // Subtotals group tabpage:
 
-ScTpSubTotalGroup::ScTpSubTotalGroup(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rArgSet)
+ScTpSubTotalGroup::ScTpSubTotalGroup(weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rArgSet, const 
sal_uInt16& rTabNumber)
     : SfxTabPage(pPage, pController, "modules/scalc/ui/subtotalgrppage.ui", 
"SubTotalGrpPage", &rArgSet)
     , aStrNone(ScResId(SCSTR_NONE))
     , aStrColumn(ScResId(SCSTR_COLUMN_LETTER))
@@ -62,6 +62,10 @@ ScTpSubTotalGroup::ScTpSubTotalGroup(weld::Container* pPage, 
weld::DialogControl
     mxLbColumns->enable_toggle_buttons(weld::ColumnToggleType::Check);
 
     Init();
+
+    // UI tests
+    mxLbGroup->set_buildable_name(mxLbGroup->get_buildable_name() + 
OString::number(rTabNumber));
+    mxLbColumns->set_buildable_name(mxLbColumns->get_buildable_name() + 
OString::number(rTabNumber));
 }
 
 ScTpSubTotalGroup::~ScTpSubTotalGroup()
@@ -407,15 +411,15 @@ std::unique_ptr<SfxTabPage> ScTpSubTotalGroup3::Create( 
weld::Container* pPage,
 }
 
 ScTpSubTotalGroup1::ScTpSubTotalGroup1( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rArgSet ) :
-    ScTpSubTotalGroup( pPage, pController, rArgSet )
+    ScTpSubTotalGroup( pPage, pController, rArgSet, 1 )
 {}
 
 ScTpSubTotalGroup2::ScTpSubTotalGroup2( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rArgSet ) :
-    ScTpSubTotalGroup( pPage, pController, rArgSet )
+    ScTpSubTotalGroup( pPage, pController, rArgSet, 2 )
 {}
 
 ScTpSubTotalGroup3::ScTpSubTotalGroup3( weld::Container* pPage, 
weld::DialogController* pController, const SfxItemSet& rArgSet ) :
-    ScTpSubTotalGroup( pPage, pController, rArgSet )
+    ScTpSubTotalGroup( pPage, pController, rArgSet, 3 )
 {}
 
 #define RESET(i) (ScTpSubTotalGroup::DoReset( (i), *rArgSet ))
diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx
index faa252c3a9c0..ef1c69ea010f 100644
--- a/sc/source/ui/inc/tpsubt.hxx
+++ b/sc/source/ui/inc/tpsubt.hxx
@@ -30,7 +30,7 @@ struct ScSubTotalParam;
 class ScTpSubTotalGroup : public SfxTabPage
 {
 protected:
-    ScTpSubTotalGroup(weld::Container* pPage, weld::DialogController* 
pController, const SfxItemSet& rArgSet);
+    ScTpSubTotalGroup(weld::Container* pPage, weld::DialogController* 
pController, const SfxItemSet& rArgSet, const sal_uInt16& nTabNumber);
 
 public:
     virtual ~ScTpSubTotalGroup() override;

Reply via email to