diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-03-07 20:17:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-03-09 10:07:49 +0100 |
commit | 2befe5c56c29fec45c898c00773e906d2d2d9f19 (patch) | |
tree | 58eb933dc438032ccc0f9fe07d903ae4626c299f /sw | |
parent | 6b0e1986a7c446cb6862f645e45c377c2a309065 (diff) |
decompose SwNavigationPIUIObject and use sub components directly
Change-Id: Ia4722972fe579646b4c3f06de339d72a931b05d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112146
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/uitest/navigator/tdf114724.py | 23 | ||||
-rw-r--r-- | sw/source/uibase/inc/navipi.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/inc/uiobject.hxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/uitest/uiobject.cxx | 40 | ||||
-rw-r--r-- | sw/source/uibase/utlui/navipi.cxx | 5 |
5 files changed, 13 insertions, 78 deletions
diff --git a/sw/qa/uitest/navigator/tdf114724.py b/sw/qa/uitest/navigator/tdf114724.py index a84bab60da60..ee39921a3285 100644 --- a/sw/qa/uitest/navigator/tdf114724.py +++ b/sw/qa/uitest/navigator/tdf114724.py @@ -18,26 +18,29 @@ class tdf114724(UITestCase): xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SwNavigatorPanel"})) xNavigatorPanel = xWriterEdit.getChild("NavigatorPanelParent") - xNavigatorPanel.executeAction("ROOT", tuple()) + xToolBar = xNavigatorPanel.getChild("content5") + xToolBar.executeAction("CLICK", mkPropertyValues({"POS": "0"})) # 'root' button xWriterEdit.executeAction("FOCUS", tuple()) - self.ui_test.wait_until_property_is_updated(xNavigatorPanel, "selectedtext", "HEADING 1") - self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectedtext"], "HEADING 1") - self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectioncount"], "1") + xContentTree = xNavigatorPanel.getChild("contenttree") + + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") for _ in range(0,3): xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) - self.ui_test.wait_until_property_is_updated(xNavigatorPanel, "selectedtext", "HEADING 4") - self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectedtext"], "HEADING 4") - self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectioncount"], "1") + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 4") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 4") + self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") for _ in range(0,3): xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"})) - self.ui_test.wait_until_property_is_updated(xNavigatorPanel, "selectedtext", "HEADING 1") - self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectedtext"], "HEADING 1") - self.assertEqual(get_state_as_dict(xNavigatorPanel)["selectioncount"], "1") + self.ui_test.wait_until_property_is_updated(xContentTree, "SelectEntryText", "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "HEADING 1") + self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1") self.xUITest.executeCommand(".uno:Sidebar") self.ui_test.close_doc() diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx index bdcd7acde296..8f0dd968f37f 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -46,7 +46,6 @@ class SwNavigationPI : public PanelLayout friend class SwNavigationChild; friend class SwContentTree; friend class SwGlobalTree; - friend class SwNavigationPIUIObject; ::sfx2::sidebar::ControllerItem m_aDocFullName; ::sfx2::sidebar::ControllerItem m_aPageStats; @@ -156,8 +155,6 @@ public: bool IsGlobalMode() const {return m_bGlobalMode;} SwView* GetCreateView() const; - - FactoryFunction GetUITestFactory() const override; }; class SwNavigationChild : public SfxChildWindowContext diff --git a/sw/source/uibase/inc/uiobject.hxx b/sw/source/uibase/inc/uiobject.hxx index b671365c3403..7f6ff239be6b 100644 --- a/sw/source/uibase/inc/uiobject.hxx +++ b/sw/source/uibase/inc/uiobject.hxx @@ -42,26 +42,6 @@ private: }; -class SwNavigationPIUIObject : public WindowUIObject -{ - VclPtr<SwNavigationPI> mxSwNavigationPI; - -public: - - SwNavigationPIUIObject(const VclPtr<SwNavigationPI>& xSwNavigationPI); - - virtual StringMap get_state() override; - - virtual void execute(const OUString& rAction, - const StringMap& rParameters) override; - - static std::unique_ptr<UIObject> create(vcl::Window* pWindow); - -protected: - - OUString get_name() const override; -}; - // This class handles the Comments as a UIObject to be used in UITest Framework class CommentUIObject : public WindowUIObject { diff --git a/sw/source/uibase/uitest/uiobject.cxx b/sw/source/uibase/uitest/uiobject.cxx index fc62fa157cf1..c120bdd778f7 100644 --- a/sw/source/uibase/uitest/uiobject.cxx +++ b/sw/source/uibase/uitest/uiobject.cxx @@ -146,46 +146,6 @@ std::unique_ptr<UIObject> SwEditWinUIObject::create(vcl::Window* pWindow) return std::unique_ptr<UIObject>(new SwEditWinUIObject(pEditWin)); } -SwNavigationPIUIObject::SwNavigationPIUIObject(const VclPtr<SwNavigationPI>& xSwNavigationPI): - WindowUIObject(xSwNavigationPI), - mxSwNavigationPI(xSwNavigationPI) -{ -} - -StringMap SwNavigationPIUIObject::get_state() -{ - StringMap aMap = WindowUIObject::get_state(); - - aMap["selectioncount"] = OUString::number(mxSwNavigationPI->m_xContentTree->count_selected_rows()); - aMap["selectedtext"] = mxSwNavigationPI->m_xContentTree->get_selected_text(); - - return aMap; -} - -void SwNavigationPIUIObject::execute(const OUString& rAction, - const StringMap& rParameters) -{ - if (rAction == "ROOT") - { - mxSwNavigationPI->m_xContentTree->grab_focus(); - mxSwNavigationPI->ToolBoxSelectHdl("root"); - } - else - WindowUIObject::execute(rAction, rParameters); -} - -std::unique_ptr<UIObject> SwNavigationPIUIObject::create(vcl::Window* pWindow) -{ - SwNavigationPI* pSwNavigationPI = dynamic_cast<SwNavigationPI*>(pWindow); - assert(pSwNavigationPI); - return std::unique_ptr<UIObject>(new SwNavigationPIUIObject(pSwNavigationPI)); -} - -OUString SwNavigationPIUIObject::get_name() const -{ - return "SwNavigationPIUIObject"; -} - CommentUIObject::CommentUIObject(const VclPtr<sw::annotation::SwAnnotationWin>& xCommentUIObject): WindowUIObject(xCommentUIObject), mxCommentUIObject(xCommentUIObject) diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 3520a9a5de53..c2a428cc412e 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -385,11 +385,6 @@ IMPL_LINK(SwNavigationPI, ToolBox5DropdownClickHdl, const OString&, rCommand, vo m_xHeadingsMenu->set_active(OString::number(m_xContentTree->GetOutlineLevel()), true); } -FactoryFunction SwNavigationPI::GetUITestFactory() const -{ - return SwNavigationPIUIObject::create; -} - // Action-Handler Edit: // Switches to the page if the structure view is not turned on. bool SwNavigationPI::EditAction() |