From a2d0741eed98db9c8b3509153a77d2e56b423d06 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 7 Mar 2021 20:43:13 +0000 Subject: SetCurItemId takes an ItemId not a Position MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id0b34364cf45b9305f865d46cf8c3c0f838ce630 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112147 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- sw/qa/uitest/findBar/findbar.py | 10 +++++----- sw/qa/uitest/findBar/tdf136941.py | 8 ++++---- sw/qa/uitest/findBar/tdf138232.py | 4 ++-- sw/qa/uitest/findBar/tdf88608.py | 4 ++-- sw/qa/uitest/sidebar/stylesSidebar.py | 2 +- vcl/source/uitest/uiobject.cxx | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sw/qa/uitest/findBar/findbar.py b/sw/qa/uitest/findBar/findbar.py index df973dc8e162..2620d39a0a98 100644 --- a/sw/qa/uitest/findBar/findbar.py +++ b/sw/qa/uitest/findBar/findbar.py @@ -43,28 +43,28 @@ class FindBar(UITestCase): self.assertEqual(get_state_as_dict(xfind_bar)["ItemCount"], "14") # Press on FindAll in the Find Bar - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "5"})) # 5 is FindAll id - self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "5") + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "5") # 5 is FindAll id for Pos 4 self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find All") self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:FindAll") self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "LibreLibreLibre") # Press on Find Next in the Find Bar - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) # 4 is Find Next id + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) # 3 is Find Next pos self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "4") self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Next") self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:DownSearch") self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre") # Press on Find Previous in the Find Bar - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) # 3 is Find Previous id + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "2"})) # 2 is Find Previous pos self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemID"], "3") self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemText"], "Find Previous") self.assertEqual(get_state_as_dict(xfind_bar)["CurrSelectedItemCommand"], ".uno:UpSearch") self.assertEqual(get_state_as_dict(xWriterEdit)["SelectedText"], "Libre") # Close the Find Bar - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "1"})) # 1 is for close + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 0 is pos for close self.ui_test.close_doc() diff --git a/sw/qa/uitest/findBar/tdf136941.py b/sw/qa/uitest/findBar/tdf136941.py index a96964a2fb79..ab94449aefed 100644 --- a/sw/qa/uitest/findBar/tdf136941.py +++ b/sw/qa/uitest/findBar/tdf136941.py @@ -28,10 +28,10 @@ class tdf136941(UITestCase): xfind_bar = xWriterDoc.getChild("FindBar") # Search Next - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) # Close button - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "1"})) + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # Check the toolbar is closed self.assertTrue("find" not in xWriterDoc.getChildren()) @@ -49,10 +49,10 @@ class tdf136941(UITestCase): xfind_bar = xWriterDoc.getChild("FindBar") # Search Next - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) # Close button - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "1"})) + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # Check the toolbar is closed self.assertTrue("find" not in xWriterDoc.getChildren()) diff --git a/sw/qa/uitest/findBar/tdf138232.py b/sw/qa/uitest/findBar/tdf138232.py index 037296c8d0d6..93f859bc7521 100644 --- a/sw/qa/uitest/findBar/tdf138232.py +++ b/sw/qa/uitest/findBar/tdf138232.py @@ -29,7 +29,7 @@ class tdf138232(UITestCase): xfind_bar = xWriterDoc.getChild("FindBar") # Click on Find All - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "5"})) + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) self.assertEqual("HelloHello", get_state_as_dict(xWriterEdit)['SelectedText']) @@ -39,7 +39,7 @@ class tdf138232(UITestCase): # AssertionError: 'HelloWorld' != 'World' self.assertEqual("HelloWorld", get_state_as_dict(xfind)['Text']) - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "5"})) + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) self.assertEqual("", get_state_as_dict(xWriterEdit)['SelectedText']) diff --git a/sw/qa/uitest/findBar/tdf88608.py b/sw/qa/uitest/findBar/tdf88608.py index 463968dc4daa..b3576ec7587e 100644 --- a/sw/qa/uitest/findBar/tdf88608.py +++ b/sw/qa/uitest/findBar/tdf88608.py @@ -29,7 +29,7 @@ class tdf88608(UITestCase): self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text']) # Search Next - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) self.assertEqual('Search key not found', get_state_as_dict(xfind_bar.getChild('label'))['Text']) @@ -44,7 +44,7 @@ class tdf88608(UITestCase): self.assertEqual('', get_state_as_dict(xfind_bar.getChild('label'))['Text']) # Search Next - xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "4"})) + xfind_bar.executeAction("CLICK", mkPropertyValues({"POS": "3"})) self.assertEqual('Reached the end of the document', get_state_as_dict(xfind_bar.getChild('label'))['Text']) diff --git a/sw/qa/uitest/sidebar/stylesSidebar.py b/sw/qa/uitest/sidebar/stylesSidebar.py index db625be6f006..8096a06c0d20 100644 --- a/sw/qa/uitest/sidebar/stylesSidebar.py +++ b/sw/qa/uitest/sidebar/stylesSidebar.py @@ -62,7 +62,7 @@ class StylesSidebar(UITestCase): xLeft = xWriterEdit.getChild('left') #change to another style type - xLeft.executeAction("CLICK", mkPropertyValues({"POS": str( i + 1 )})) + xLeft.executeAction("CLICK", mkPropertyValues({"POS": str( i )})) xFlatView = xWriterEdit.getChild("flatview") diff --git a/vcl/source/uitest/uiobject.cxx b/vcl/source/uitest/uiobject.cxx index b85c9864a083..5af9ee2f82bc 100644 --- a/vcl/source/uitest/uiobject.cxx +++ b/vcl/source/uitest/uiobject.cxx @@ -1620,7 +1620,7 @@ void ToolBoxUIObject::execute(const OUString& rAction, { auto itr = rParameters.find("POS"); sal_uInt16 nPos = itr->second.toUInt32(); - mxToolBox->SetCurItemId(nPos); + mxToolBox->SetCurItemId(mxToolBox->GetItemId(nPos)); mxToolBox->Click(); mxToolBox->Select(); } -- cgit