diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-04-21 15:04:19 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-04-29 12:05:40 +0200 |
commit | 1f4a2b698cb5bb987cad5bc2a5503e23dd8a7b9c (patch) | |
tree | 8a25d489e00692b874f61063db742f911741595d | |
parent | 768882d4e9b955ee1b79ad39cb4232789d0d5ee9 (diff) |
[API CHANGE] uitest: make HasInfoBarWithID accessible from API
This is useful for checking in uitests whether the infobar exists
Change-Id: I436c2659abd40756673634f7cd1f8e4846c03836
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92635
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r-- | include/sfx2/sfxbasecontroller.hxx | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/frame/XInfobarProvider.idl | 9 | ||||
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 7 | ||||
-rw-r--r-- | sw/qa/uitest/classification/classification.py | 34 |
4 files changed, 41 insertions, 10 deletions
diff --git a/include/sfx2/sfxbasecontroller.hxx b/include/sfx2/sfxbasecontroller.hxx index 33a14090e3e7..7fd536a14ef7 100644 --- a/include/sfx2/sfxbasecontroller.hxx +++ b/include/sfx2/sfxbasecontroller.hxx @@ -186,6 +186,7 @@ public: const OUString& sSecondaryMessage, sal_Int32 aInfobarType) override; virtual void SAL_CALL removeInfobar(const OUString& sId) override; + virtual sal_Bool SAL_CALL hasInfobar(const OUString& sId) override; // FIXME: TL needs this in sw/source/ui/uno/unotxdoc.cxx now; // either the _Impl name should vanish or there should be an "official" API diff --git a/offapi/com/sun/star/frame/XInfobarProvider.idl b/offapi/com/sun/star/frame/XInfobarProvider.idl index 1fbaa4657188..889be2aa4bcd 100644 --- a/offapi/com/sun/star/frame/XInfobarProvider.idl +++ b/offapi/com/sun/star/frame/XInfobarProvider.idl @@ -94,6 +94,15 @@ interface XInfobarProvider: uno::XInterface If no such Infobar exists (it might have been closed by the user already) */ void removeInfobar([in] string id) raises(com::sun::star::container::NoSuchElementException); + + /** Check if Infobar exists. + + @param id + The ID which was used when creating this Infobar. + + @since LibreOffice 7.0 + */ + boolean hasInfobar([in] string id); }; diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 1ad856065b8e..9baebe0be2ff 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -1535,4 +1535,11 @@ void SAL_CALL SfxBaseController::removeInfobar(const OUString& sId) pViewFrame->RemoveInfoBar(sId); } +sal_Bool SAL_CALL SfxBaseController::hasInfobar(const OUString& sId) +{ + SolarMutexGuard aGuard; + SfxViewFrame* pViewFrame = m_pData->m_pViewShell->GetFrame(); + return pViewFrame->HasInfoBarWithID(sId); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/uitest/classification/classification.py b/sw/qa/uitest/classification/classification.py index 373d4b5ad012..e7fde9d70ec7 100644 --- a/sw/qa/uitest/classification/classification.py +++ b/sw/qa/uitest/classification/classification.py @@ -10,14 +10,13 @@ from uitest.uihelper.common import select_pos from uitest.uihelper.calc import enter_text_to_cell from libreoffice.calc.document import get_cell_by_position from libreoffice.uno.propertyvalue import mkPropertyValues -from uitest.uihelper.common import get_state_as_dict, type_text +from uitest.uihelper.common import get_state_as_dict from uitest.debug import sleep -# import org.libreoffice.unotest -# import pathlib -from uitest.path import get_srcdir_url +import org.libreoffice.unotest +import pathlib + def get_url_for_data_file(file_name): -# return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() - return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name + return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri() #TSCP: add advanced classification dialog https://cgit.freedesktop.org/libreoffice/core/commit/?id=71ee09947d5a71105d64fd225bb3672dfa7ce834 # This adds an advanced classification dialog, which enables the user @@ -69,6 +68,13 @@ class classification(UITestCase): # self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) + + header = document.StyleFamilies.PageStyles.Standard.HeaderText.createEnumeration().nextElement() + self.assertEqual(header.String, "Confidential") + + controller = self.ui_test.get_component().getCurrentController() + self.assertTrue(controller.hasInfobar("classification")) + #verify watermark #Bug 122586 - Classification: by using the dialog, Watermark text from policy is not placed in the document self.ui_test.execute_dialog_through_command(".uno:Watermark") @@ -103,13 +109,15 @@ class classification(UITestCase): #verify International is set too self.assertEqual(get_state_as_dict(internationalClassificationCB)["SelectEntryText"], "Confidential") #verify textBox Content TODO textbox not supported -# self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") + #self.assertEqual(get_state_as_dict(classificationEditWindow)["Text"], "Conf") # print(get_state_as_dict(classificationEditWindow)) xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) - # verify the text on characters 0-6 : "(Conf)" + self.assertEqual(document.Text.String[0:6], "(Conf)") + self.assertEqual(header.String, "Confidential") + self.assertTrue(controller.hasInfobar("classification")) self.ui_test.close_doc() @@ -138,8 +146,11 @@ class classification(UITestCase): xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) - # verify the text on characters 0-6 : "(Conf)" + + controller = self.ui_test.get_component().getCurrentController() self.assertEqual(document.Text.String[0:6], "(Conf)") + self.assertFalse(controller.hasInfobar("classification")) + self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) self.ui_test.close_doc() @@ -169,8 +180,11 @@ class classification(UITestCase): xOKBtn = xDialog.getChild("ok") self.ui_test.close_dialog_through_button(xOKBtn) - # verify the text on characters 0-6 : "(AAIO)" + + controller = self.ui_test.get_component().getCurrentController() self.assertEqual(document.Text.String[0:6], "(AAIO)") + self.assertFalse(controller.hasInfobar("classification")) + self.assertFalse(document.StyleFamilies.PageStyles.Standard.HeaderIsOn) self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: |