[Libreoffice-commits] core.git: sw/qa

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jan 31 13:22:42 UTC 2019


 sw/qa/uitest/writer_tests/data/LibreOffice_external_logo_100px.png |binary
 sw/qa/uitest/writer_tests5/tdf107494.py                            |   95 ++++++++++
 2 files changed, 95 insertions(+)

New commits:
commit 1c2691f0ab192347da1507076ac16a248298a848
Author:     Zdeněk Crhonek <zcrhonek at gmail.com>
AuthorDate: Thu Jan 31 11:57:47 2019 +0100
Commit:     Zdenek Crhonek <zcrhonek at gmail.com>
CommitDate: Thu Jan 31 14:22:15 2019 +0100

    uitest for bug tdf#107494
    
    Change-Id: I78857cc47222a1ac81eff134b3cb570bd113ffb1
    Reviewed-on: https://gerrit.libreoffice.org/67202
    Tested-by: Jenkins
    Reviewed-by: Zdenek Crhonek <zcrhonek at gmail.com>

diff --git a/sw/qa/uitest/writer_tests/data/LibreOffice_external_logo_100px.png b/sw/qa/uitest/writer_tests/data/LibreOffice_external_logo_100px.png
new file mode 100644
index 000000000000..d55048283f91
Binary files /dev/null and b/sw/qa/uitest/writer_tests/data/LibreOffice_external_logo_100px.png differ
diff --git a/sw/qa/uitest/writer_tests5/tdf107494.py b/sw/qa/uitest/writer_tests5/tdf107494.py
new file mode 100644
index 000000000000..a9914cb40279
--- /dev/null
+++ b/sw/qa/uitest/writer_tests5/tdf107494.py
@@ -0,0 +1,95 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
+#
+# 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/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_state_as_dict
+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.debug import sleep
+from uitest.path import get_srcdir_url
+
+def get_url_for_data_file(file_name):
+    return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name
+
+#Bug 107494 - CRASH: LibreOffice crashes while deleting the header containing an image
+
+class tdf107494(UITestCase):
+    def test_tdf107494_delete_header_with_image(self):
+        writer_doc = self.ui_test.create_doc_in_start_center("writer")
+        document = self.ui_test.get_component()
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+        xWriterEdit = xWriterDoc.getChild("writer_edit")
+        #insert header
+        self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
+        self.xUITest.executeCommand(".uno:InsertPageHeader?PageStyle:string=Default%20Style&On:bool=true")
+        self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, True)
+        #insert image
+        text = document.getText()
+        cursor = text.createTextCursor()
+        oStyleFamilies = document.getStyleFamilies()
+        #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227
+        obj2 = oStyleFamilies.getByName("PageStyles")
+        obj3 = obj2.getByName("Standard")
+        oHeaderText = obj3.HeaderText
+        oHeaderText.setString("New text for header")  #write text to header
+        obj4 = oHeaderText.createTextCursor()
+        text = obj4.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_external_logo_100px.png")}))
+        textGraphic.Graphic = graphic
+        text.insertTextContent(cursor, textGraphic, False)
+        # Delete the header
+        self.ui_test.execute_dialog_through_command(".uno:InsertPageHeader?PageStyle:string=Default%20Style&On:bool=false")
+        xDialog = self.xUITest.getTopFocusWindow()  #question dialog
+        xOption = xDialog.getChild("yes")
+        xOption.executeAction("CLICK", tuple())
+
+        self.assertEqual(document.StyleFamilies.PageStyles.Standard.HeaderIsOn, False)
+
+        self.ui_test.close_doc()
+
+    def test_tdf107494_delete_footer_with_image(self):
+        writer_doc = self.ui_test.create_doc_in_start_center("writer")
+        document = self.ui_test.get_component()
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+        xWriterEdit = xWriterDoc.getChild("writer_edit")
+        #insert footer
+        self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
+        self.xUITest.executeCommand(".uno:InsertPageFooter?PageStyle:string=Default%20Style&On:bool=true")
+        self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, True)
+        #insert image
+        text = document.getText()
+        cursor = text.createTextCursor()
+        oStyleFamilies = document.getStyleFamilies()
+        #https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=71227
+        obj2 = oStyleFamilies.getByName("PageStyles")
+        obj3 = obj2.getByName("Standard")
+        oFooterText = obj3.FooterText
+        oFooterText.setString("New text for footer")  #write text to footer
+        obj4 = oFooterText.createTextCursor()
+        text = obj4.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_external_logo_100px.png")}))
+        textGraphic.Graphic = graphic
+        text.insertTextContent(cursor, textGraphic, False)
+        # Delete the footer
+        self.ui_test.execute_dialog_through_command(".uno:InsertPageFooter?PageStyle:string=Default%20Style&On:bool=false")
+        xDialog = self.xUITest.getTopFocusWindow()  #question dialog
+        xOption = xDialog.getChild("yes")
+        xOption.executeAction("CLICK", tuple())
+
+        self.assertEqual(document.StyleFamilies.PageStyles.Standard.FooterIsOn, False)
+
+        self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list