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

Zdeněk Crhonek zcrhonek at gmail.com
Fri Jun 29 05:01:54 UTC 2018


 sw/Module_sw.mk                                |    1 
 sw/UITest_writer_tests2.mk                     |   16 +++++++
 sw/qa/uitest/writer_tests/data/LibreOffice.jpg |binary
 sw/qa/uitest/writer_tests2/tdf116474.py        |   55 +++++++++++++++++++++++++
 4 files changed, 72 insertions(+)

New commits:
commit 616917f4e15d30307062f3c1a73656c8c9fbf3a9
Author: Zdeněk Crhonek <zcrhonek at gmail.com>
Date:   Thu Jun 28 21:26:57 2018 +0200

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

diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index 1e56264ac8de..a05c310abdb9 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -134,6 +134,7 @@ $(eval $(call gb_Module_add_screenshot_targets,sw,\
 
 $(eval $(call gb_Module_add_uicheck_targets,sw,\
 	UITest_writer_tests \
+	UITest_writer_tests2 \
 ))
 endif
 
diff --git a/sw/UITest_writer_tests2.mk b/sw/UITest_writer_tests2.mk
new file mode 100644
index 000000000000..11fcfcb0e992
--- /dev/null
+++ b/sw/UITest_writer_tests2.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,writer_tests2))
+
+$(eval $(call gb_UITest_add_modules,writer_tests2,$(SRCDIR)/sw/qa/uitest,\
+	writer_tests2/ \
+))
+
+$(eval $(call gb_UITest_set_defs,writer_tests2, \
+    TDOC="$(SRCDIR)/sw/qa/uitest/writer_tests/data" \
+))
diff --git a/sw/qa/uitest/writer_tests/data/LibreOffice.jpg b/sw/qa/uitest/writer_tests/data/LibreOffice.jpg
new file mode 100644
index 000000000000..23812dcfdd7e
Binary files /dev/null and b/sw/qa/uitest/writer_tests/data/LibreOffice.jpg differ
diff --git a/sw/qa/uitest/writer_tests2/tdf116474.py b/sw/qa/uitest/writer_tests2/tdf116474.py
new file mode 100644
index 000000000000..1354efa7b899
--- /dev/null
+++ b/sw/qa/uitest/writer_tests2/tdf116474.py
@@ -0,0 +1,55 @@
+# -*- 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 time
+from uitest.path import get_srcdir_url
+from uitest.debug import sleep
+from uitest.uihelper.common import select_pos
+
+#Bug 116474 - Undo/redo: The redo of adding caption to an image isn't working: no image
+
+def get_url_for_data_file(file_name):
+    return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name
+
+class tdf116474(UITestCase):
+
+   def test_tdf116474_insert_caption_undo(self):
+        writer_doc = self.ui_test.create_doc_in_start_center("writer")
+        xWriterDoc = self.xUITest.getTopFocusWindow()
+        xWriterEdit = xWriterDoc.getChild("writer_edit")
+        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().getByIndex(0))
+
+        self.ui_test.execute_dialog_through_command(".uno:InsertCaptionDialog")   #  caption
+        xDialogCaption = self.xUITest.getTopFocusWindow()
+
+        xCapt = xDialogCaption.getChild("caption_edit")
+        xCapt.executeAction("TYPE", mkPropertyValues({"TEXT":"Caption"}))
+
+        xOkBtn=xDialogCaption.getChild("ok")
+        xOkBtn.executeAction("CLICK", tuple())
+
+        xFrame = document.TextFrames.getByIndex(0)
+        self.assertEqual(document.TextFrames.getByIndex(0).Text.String, "\nFigure 1: Caption")
+        self.assertEqual(document.GraphicObjects.getCount(), 1)  #nr. of images
+        #Undo, redo
+        self.xUITest.executeCommand(".uno:Undo")
+        self.xUITest.executeCommand(".uno:Redo")
+        #Verify
+        self.assertEqual(document.TextFrames.getByIndex(0).Text.String, "\nFigure 1: Caption")
+        self.assertEqual(document.GraphicObjects.getCount(), 1)  #nr. of images
+
+        self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file


More information about the Libreoffice-commits mailing list