sw/Module_sw.mk                          |    1 
 sw/UITest_sw_styleInspector.mk           |   16 +++++++++++
 sw/qa/uitest/styleInspector/tdf137105.py |   43 +++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+)

New commits:
commit 86026711b10484753aa0f84f89986db9bbf34c9e
Author:     Xisco Fauli <[email protected]>
AuthorDate: Wed Oct 28 20:16:18 2020 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Oct 29 12:19:29 2020 +0100

    tdf#137105: sw: add first UItest for styles inspector
    
    Change-Id: If704e26f3dcfa818c805ceac3a03b6c2483867c8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104974
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index d63839a6a578..d5535f57061f 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -174,6 +174,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sw,\
        UITest_librelogo \
        UITest_sw_navigator \
        UITest_sw_options \
+       UITest_sw_styleInspector \
        UITest_sw_ui_fmtui \
        UITest_classification \
        UITest_writer_macro_tests \
diff --git a/sw/UITest_sw_styleInspector.mk b/sw/UITest_sw_styleInspector.mk
new file mode 100644
index 000000000000..d255dfbd756f
--- /dev/null
+++ b/sw/UITest_sw_styleInspector.mk
@@ -0,0 +1,16 @@
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call  gb_UITest_UITest,sw_styleInspector))
+
+$(eval $(call gb_UITest_add_modules,sw_styleInspector,$(SRCDIR)/sw/qa/uitest,\
+       styleInspector/ \
+))
+
+$(eval $(call gb_UITest_set_defs,sw_styleInspector, \
+    TDOC="$(SRCDIR)/sw/qa/uitest/data" \
+))
diff --git a/sw/qa/uitest/styleInspector/tdf137105.py 
b/sw/qa/uitest/styleInspector/tdf137105.py
new file mode 100644
index 000000000000..bbe8eaae93f5
--- /dev/null
+++ b/sw/qa/uitest/styleInspector/tdf137105.py
@@ -0,0 +1,43 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_state_as_dict
+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()
+
+class tdf137105(UITestCase):
+
+   def test_tdf137105(self):
+        writer_doc = self.ui_test.create_doc_in_start_center("writer")
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+        document = self.ui_test.get_component()
+        text = document.getText()
+        cursor = text.createTextCursor()
+        textGraphic = 
document.createInstance('com.sun.star.text.TextGraphicObject')
+        provider = 
self.xContext.ServiceManager.createInstance('com.sun.star.graphic.GraphicProvider')
+        graphic = provider.queryGraphic( mkPropertyValues({"URL": 
get_url_for_data_file("LibreOffice.jpg")}))
+        textGraphic.Graphic = graphic
+        text.insertTextContent(cursor, textGraphic, False)
+        #select image
+        document.getCurrentController().select(document.getDrawPage()[0])
+
+        xWriterEdit = xWriterDoc.getChild("writer_edit")
+
+        self.xUITest.executeCommand(".uno:Sidebar")
+        # Without the fix in place, this test would have crashed here
+        xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": 
"InspectorTextPanel"}))
+
+        # if the image is selected, there is nothing in the panel
+        self.assertEqual('0', 
get_state_as_dict(xWriterEdit.getChild('listbox_fonts'))['Children'])
+
+        self.xUITest.executeCommand(".uno:Sidebar")
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to