summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdeněk Crhonek <zcrhonek@gmail.com>2018-06-28 21:26:57 +0200
committerZdenek Crhonek <zcrhonek@gmail.com>2018-06-29 07:01:28 +0200
commit616917f4e15d30307062f3c1a73656c8c9fbf3a9 (patch)
tree89246b701f4e82597195f9fafcde3f35aec71ff2
parente7d3976cb80f7e7401be071f905a764dd6cb4d6e (diff)
uitest for bug tdf#116474
Change-Id: I6b19626bf872c2eff61c57342579ec682a1c37d0 Reviewed-on: https://gerrit.libreoffice.org/56632 Tested-by: Jenkins Reviewed-by: Zdenek Crhonek <zcrhonek@gmail.com>
-rw-r--r--sw/Module_sw.mk1
-rw-r--r--sw/UITest_writer_tests2.mk16
-rw-r--r--sw/qa/uitest/writer_tests/data/LibreOffice.jpgbin0 -> 18218 bytes
-rw-r--r--sw/qa/uitest/writer_tests2/tdf116474.py55
4 files changed, 72 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/uitest/writer_tests/data/LibreOffice.jpg
Binary files 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